You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by João Alberto Pereira de Araújo <j....@viaquanta.com> on 2009/01/07 17:41:05 UTC
Problems authenticating users using HSQLDB
Hi.
I have some problems related to authenticating users in the FtpServer, i
always get this error message:
530 Authentication failed.
Falha no início de sessão.
I have managed to change the ftpd-typical.xml to make the connection to
the HSQLDB possible, and it's like this:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version
2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by
applicable law or agreed to in writing, software distributed
under the
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the
License for
the specific language governing permissions and limitations
under the
License.
-->
<server xmlns="http://mina.apache.org/ftpserver/spring/v1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xsi:schemaLocation="
http://mina.apache.org/ftpserver/spring/v1
http://mina.apache.org/ftpserver/ftpserver-1.0.xsd
"
id="myServer">
<listeners>
<nio-listener name="default" port="21">
<ssl>
<keystore file="./res/ftpserver.jks" password="password" />
</ssl>
</nio-listener>
</listeners>
<!--file-user-manager file="./res/conf/users.properties"
encrypt-passwords="true"/-->
<db-user-manager encrypt-passwords="md5">
<data-source>
<beans:bean class="org.apache.commons.dbcp.BasicDataSource">
<beans:property name="driverClassName"
value="org.hsqldb.jdbcDriver" />
<beans:property name="url"
value="jdbc:hsqldb:file:C:\hsqldb\data\teste" />
<beans:property name="username" value="sa" />
<beans:property name="password" value="" />
</beans:bean>
</data-source>
<insert-user>INSERT INTO FTP_USER (userid, userpassword,
homedirectory, enableflag, writepermission, idletime,
uploadrate,
downloadrate) VALUES ('{userid}', '{userpassword}',
'{homedirectory}',
'{enableflag}', '{writepermission}', {idletime}, {uploadrate},
{downloadrate})</insert-user>
<update-user>UPDATE FTP_USER SET
userpassword='{userpassword}',homedirectory='{homedirectory}',enableflag='{enableflag}',writepermission='{writepermission}',idletime={idletime},uploadrate={uploadrate},downloadrate={downloadrate}
WHERE userid='{userid}'</update-user>
<delete-user>DELETE FROM FTP_USER WHERE userid='{userid}'
</delete-user>
<select-user>SELECT userid, userpassword, homedirectory,
enableflag, writepermission, idletime, uploadrate,
downloadrate FROM
FTP_USER WHERE userid='{userid}'</select-user>
<select-all-users>SELECT userid FROM FTP_USER ORDER BY userid
</select-all-users>
<is-admin>SELECT userid FROM FTP_USER WHERE userid='{userid}' AND
userid='admin'</is-admin>
<authenticate>SELECT userpassword FROM
FTP_USER WHERE userid='{userid}'</authenticate>
</db-user-manager>
<!--native-filesystem case-insensitive="false"
create-home="true" /-->
</server>
And the log generated it's like this:
[ INFO] 2009-01-07 16:37:22,232 [] [] Refreshing
org.springframework.context.support.FileSystemXmlApplicationContext@1eec612:
display name
[org.springframework.context.support.FileSystemXmlApplicationContext@1eec612];
startup date [Wed Jan 07 16:37:22 GMT 2009]; root of context hierarchy
[ INFO] 2009-01-07 16:37:22,296 [] [] Loading XML bean definitions from
file [c:\ftpserver\res\conf\ftpd-typical.xml]
[ INFO] 2009-01-07 16:37:22,501 [] [] Bean factory for application
context
[org.springframework.context.support.FileSystemXmlApplicationContext@1eec612]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@641e9a
[ INFO] 2009-01-07 16:37:22,521 [] [] Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@641e9a:
defining beans
[org.apache.ftpserver.listener.ListenerFactory#0,org.apache.ftpserver.usermanager.DbUserManagerFactory#0,org.apache.ftpserver.FtpServerFactory#0,myServer];
root of factory hierarchy
[ INFO] 2009-01-07 16:37:23,032 [] [] Database connection opened.
[ INFO] 2009-01-07 16:37:23,104 [] [] FTP server started
[ INFO] 2009-01-07 16:37:29,336 [] [127.0.0.1] CREATED
[ INFO] 2009-01-07 16:37:29,341 [] [127.0.0.1] OPENED
[ INFO] 2009-01-07 16:37:29,354 [] [127.0.0.1] SENT: 220 Service ready
for new user.
[ INFO] 2009-01-07 16:37:31,171 [] [127.0.0.1] RECEIVED: USER TESTE
[ INFO] 2009-01-07 16:37:31,173 [teste] [127.0.0.1] SELECT userid,
userpassword, homedirectory,
enableflag, writepermission, idletime, uploadrate,
downloadrate FROM
FTP_USER WHERE userid='teste'
[ INFO] 2009-01-07 16:37:31,189 [teste] [127.0.0.1] SENT: 331 User name
okay, need password for teste.
[ INFO] 2009-01-07 16:37:32,909 [teste] [127.0.0.1] RECEIVED: PASS *****
[ INFO] 2009-01-07 16:37:32,911 [teste] [127.0.0.1] SELECT userpassword FROM
FTP_USER WHERE userid='teste'
[ INFO] 2009-01-07 16:37:32,912 [teste] [127.0.0.1] SELECT userid,
userpassword, homedirectory,
enableflag, writepermission, idletime, uploadrate,
downloadrate FROM
FTP_USER WHERE userid='teste'
[ WARN] 2009-01-07 16:37:33,413 [teste] [127.0.0.1] Login failure - teste
[ INFO] 2009-01-07 16:37:33,414 [teste] [127.0.0.1] SENT: 530
Authentication failed.
I tried everything i come across but it's seems that doesn't work.
Could you teel me how i can setup this configuration well, if it's a
configuration problem, or if i need another dist since i use the M4.
Thanks in advance.
Best regards.
João Araújo.
Re: Problems authenticating users using HSQLDB
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Wed, Jan 7, 2009 at 5:41 PM, João Alberto Pereira de Araújo
<j....@viaquanta.com> wrote:
> Could you teel me how i can setup this configuration well, if it's a
> configuration problem, or if i need another dist since i use the M4.
Just to double check, the passwords stored in the database are also
MD5 hashed? If not, can you try running the user manager in clear
mode? For 1.1, I hope to implement a more robust solution for this,
where we actually track what encryption we have used for the password.
/niklas