proftpd + mysql

Pagina: 1
Acties:

  • straat
  • Registratie: Augustus 2000
  • Laatst online: 13-04 19:54
Ik hen gentoo op mijn server staan en heb proftpd-1.2.8 ge-emerged. Werd allemaal mooi gecompileerd met mysql ondersteuning, tot hier geen problemen. Met een simpele configfile kon ik met een sytem-user gewoon inloggen:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
ServerName          "Straat's FTP Server"
ServerType          standalone
Port                21
SyslogLevel         debug

#<Global>
#SQLConnectInfo         ftpsql@localhost    ftpsql      <password>
#SQLAuthTypes           Plaintext
#SQLAuthenticate        users groups usersetfast groupsetfast

#RequireValidShell      off
#</Global>

Umask               022
MaxInstances            30
User                nobody
Group               nogroup
AuthPAM             off
DefaultServer           on



<Directory />
  AllowOverwrite        on
</Directory>


Wanneer ik echter de <Global>-sectie die de regels voor sql authenticatie bevat uncomment, kan ik niet meer inloggen met een system user. Ook met een user uit de mysql-tabel kan ik niet inloggen. Verschil is wel dat als ik met een system-user of onbestaande user in probeer te loggen dat ik nog wel de kans krijg om een password op te geven, als ik een user uit de database opgeen word de connectie meteen verbroken.

In de logs verschijnt hier geen info over en het lukt mij niet om te zorgen dat ik wat meer info uit een log kan halen. wel heb ik wat output gekregen door proftpd met "proftpd -n -d9 -c /etc/proftpd/proftpd.conf" te starten. Als ik met een user uit de database (test123) inlog, krijg ik dit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server.straat.nu (night[10.0.1.10]) - ROOT PRIVS at main.c:937
server.straat.nu (night[10.0.1.10]) - SETUP PRIVS at main.c:942
server.straat.nu (night[10.0.1.10]) - performing module session initializations
server.straat.nu (night[10.0.1.10]) - ROOT PRIVS at mod_auth.c:129
server.straat.nu (night[10.0.1.10]) - RELINQUISH PRIVS at mod_auth.c:132
server.straat.nu (night[10.0.1.10]) - connected - local  : 10.0.1.1:21
server.straat.nu (night[10.0.1.10]) - connected - remote : 10.0.1.10:4558
server.straat.nu (night[10.0.1.10]) - FTP session opened.
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER test123' to mod_tls
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER test123' to mod_core
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER test123' to mod_core
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER test123' to mod_auth
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching CMD command 'USER test123' to mod_ratio
server.straat.nu (night[10.0.1.10]) - dispatching CMD command 'USER test123' to mod_auth
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_sql
server.straat.nu (night[10.0.1.10]) - FTP session closed.


met een system-user het volgende:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
server.straat.nu (night[10.0.1.10]) - ROOT PRIVS at main.c:937
server.straat.nu (night[10.0.1.10]) - SETUP PRIVS at main.c:942
server.straat.nu (night[10.0.1.10]) - performing module session initializations
server.straat.nu (night[10.0.1.10]) - ROOT PRIVS at mod_auth.c:129
server.straat.nu (night[10.0.1.10]) - RELINQUISH PRIVS at mod_auth.c:132
server.straat.nu (night[10.0.1.10]) - connected - local  : 10.0.1.1:21
server.straat.nu (night[10.0.1.10]) - connected - remote : 10.0.1.10:4765
server.straat.nu (night[10.0.1.10]) - FTP session opened.
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER straat' to mod_tls
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER straat' to mod_core
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER straat' to mod_core
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'USER straat' to mod_auth
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching CMD command 'USER straat' to mod_ratio
server.straat.nu (night[10.0.1.10]) - dispatching CMD command 'USER straat' to mod_auth
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - RELINQUISH PRIVS at mod_auth.c:1465
server.straat.nu (night[10.0.1.10]) - dispatching POST_CMD command 'USER straat' to mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching LOG_CMD command 'USER straat' to mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching LOG_CMD command 'USER straat' to mod_log
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'PASS (hidden)' to mod_tls
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'PASS (hidden)' to mod_core
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'PASS (hidden)' to mod_core
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'PASS (hidden)' to mod_wrap
server.straat.nu (night[10.0.1.10]) - dispatching PRE_CMD command 'PASS (hidden)' to mod_auth
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endpwent" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "endgrent" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching CMD command 'PASS (hidden)' to mod_auth
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getgroups" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - RELINQUISH PRIVS at mod_auth.c:1465
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getpwnam" to module mod_sql
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getpwnam" to module mod_auth_file
server.straat.nu (night[10.0.1.10]) - dispatching auth request "getpwnam" to module mod_auth_unix
server.straat.nu (night[10.0.1.10]) - dispatching auth request "gid_name" to module mod_sql
server.straat.nu (night[10.0.1.10]) - FTP session closed.


uit de mysql logs blijkt dat er in beide gevallen wel een query in de database uitgeboerd word:
code:
1
2
3
4
5
6
7
8
9
10
030404 20:45:54     702 Connect     ftpsql@localhost on ftpsql
                    702 Query       SELECT userid, password, uid, gid, homedir, shell FROM users WHERE (userid='test123') LIMIT 1
                    702 Query       SELECT groupname FROM groups WHERE (gid = 65533) LIMIT 1
                    702 Quit
030404 20:47:00     703 Connect     ftpsql@localhost on ftpsql
                    703 Query       SELECT userid, password, uid, gid, homedir, shell FROM users WHERE (userid='straat') LIMIT 1
                    703 Query       SELECT userid, password, uid, gid, homedir, shell FROM users WHERE (userid='straat') LIMIT 1
                    703 Query       SELECT userid, password, uid, gid, homedir, shell FROM users WHERE (userid='straat') LIMIT 1
                    703 Query       SELECT groupname FROM groups WHERE (gid = 100) LIMIT 1
                    703 Quit