
15th April 2008, 19:58
|
|
Junior Member
|
|
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
RHEL5.1\CENT.OS 5.1 VSFTPD auth via mysql
Hello
I want to setup vsftpd server like Virtual Hosting With vsftpd And MySQL On Debian Etch but on RHEL5.1(Cent.os)
I`ve install pam_mysql from EPEL, create database, use debian`s config for vsftpd.conf.... add to pam/vsftpd like in debian one ... but then I tried to login I have a message that login is incorrect
Can you help me?
|

16th April 2008, 22:26
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,665
Thanks: 1,896
Thanked 2,593 Times in 2,444 Posts
|
|
What's in /etc/vsftpd.conf and the vsftpd pam file?
What's the exact error message? Any errors in your logs?
|

17th April 2008, 09:14
|
|
Junior Member
|
|
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Vsftpd
/etc/vsftpd/vsftpd.conf
Quote:
listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
nopriv_user=vsftpd
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
#rsa_cert_file=/etc/ssl/certs/vsftpd.pem
guest_enable=YES
guest_username=vsftpd
local_root=/home/vsftpd/$USER
user_sub_token=$USER
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vsftpd_user_conf
|
/etc/pam.d/vsftpd
Quote:
auth required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
account required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
|
/var/log/vsftpd.log
Quote:
Tue Apr 15 17:42:26 2008 [pid 3260] [test] FAIL LOGIN: Client "192.168.1.2"
Tue Apr 15 17:56:53 2008 [pid 2354] CONNECT: Client "192.168.1.2"
Tue Apr 15 17:56:53 2008 [pid 2353] [test] FAIL LOGIN: Client "192.168.1.2"
Thu Apr 17 06:59:55 2008 [pid 2322] CONNECT: Client "192.168.1.2"
|
Last edited by Nikitos; 17th April 2008 at 09:17.
|

17th April 2008, 10:06
|
|
Senior Member
|
|
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 148 Times in 145 Posts
|
|
Turn on debug and see what is being logged in syslog
|

17th April 2008, 11:43
|
|
Junior Member
|
|
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
i add log all querys to my.cnf and i saw in log that
Quote:
080417 13:39:00 4 Connect vsftpd@localhost on vsftpd
4 Init DB vsftpd
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Quit
080417 13:39:06 5 Connect vsftpd@localhost on vsftpd
5 Init DB vsftpd
5 Query SELECT pass FROM accounts WHERE username = 'nikita'
5 Query SELECT pass FROM accounts WHERE username = 'nikita'
5 Quit
|
/var/logs/secure
Quote:
Apr 17 13:36:05 localhost vsftpd: pam_mysql - SELECT returned no result.
Apr 17 13:39:00 localhost last message repeated 4 times
Apr 17 13:40:38 localhost last message repeated 2 times
|
Last edited by Nikitos; 17th April 2008 at 13:03.
|

17th April 2008, 14:29
|
|
Senior Member
|
|
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 148 Times in 145 Posts
|
|
the query is not returning any data connect to the db as that user and run the same query.
|

17th April 2008, 20:59
|
|
Junior Member
|
|
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Query as vsftpd user works normal
Quote:
[root@linux log]# mysql -u vsftpd -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.22-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use vsftpd;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT pass FROM accounts WHERE username = 'test' ;
+------------------+
| pass |
+------------------+
| 428567f408994404 |
+------------------+
1 row in set (0.01 sec)
|
When i do your this query Log in /var/logs/secure don`t have any errors
Last edited by Nikitos; 17th April 2008 at 21:01.
|

17th April 2008, 21:00
|
|
Senior Member
|
|
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 148 Times in 145 Posts
|
|
Turn on pam_mysql's own debug such that you see what happens to the whole process.
logging queries from mysql will not give you the full picture.
|

19th April 2008, 21:16
|
|
Junior Member
|
|
Join Date: Feb 2008
Posts: 14
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Enable Pam_mysql log:
Quote:
auth required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2 sqllog=1 logtable=logs logmsgcolumn=msg logusercolumn=user logpidcolumn=pid loghostcolumn=host logrhostcolumn=rhost logtimecolumn=logtime
account required pam_mysql.so user=vsftpd passwd=password host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2 sqllog=1 logtable=logs logmsgcolumn=msg logusercolumn=user logpidcolumn=pid loghostcolumn=host logrhostcolumn=rhost logtimecolumn=logtime
|
Pam_mysql log
Quote:
+------------------------------------+------+------+-----------+-------------+---------------------+
| msg | user | pid | host | rhost | logtime |
+------------------------------------+------+------+-----------+-------------+---------------------+
| AUTHENTICATION FALURE (FIRST_PASS) | test | 2757 | 127.0.0.1 | 192.168.1.2 | 2008-04-19 23:07:24 |
| AUTHENTICATION FAILURE | test | 2757 | 127.0.0.1 | 192.168.1.2 | 2008-04-19 23:07:24 |
+------------------------------------+------+------+-----------+-------------+---------------------+
2 rows in set (0.00 sec)
|
Mysql query log:
Quote:
080419 23:07:24 4 Connect vsftpd@localhost on vsftpd
4 Init DB vsftpd
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Query INSERT INTO logs (msg, user, host, rhost, pid, logtime) VALUES ('AUTHENTICATION FALURE (FIRST_PASS)', 'test', '127.0.0.1', '192.168.1.2', '2757', NOW())
4 Query SELECT pass FROM accounts WHERE username = 'test'
4 Query INSERT INTO logs (msg, user, host, rhost, pid, logtime) VALUES ('AUTHENTICATION FAILURE', 'test', '127.0.0.1', '192.168.1.2', '2757', NOW())
4 Quit
|
/var/log/secure doesn`t have any errors
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 15:49.
|
|
Recent comments
2 days 6 hours ago
2 days 15 hours ago
2 days 18 hours ago
2 days 19 hours ago
2 days 21 hours ago
2 days 22 hours ago
3 days 11 min ago
3 days 1 hour ago
3 days 17 hours ago
3 days 18 hours ago