Sie sind nicht angemeldet.

1

02.04.2008, 12:46

proftpd + ssl + mysql

Hi Leute

Hab mal wieder ein Problem. Hoffe ihr könnt mir helfen :)

Folgendes:
Ich hab nun versucht einen proftpd server inkl ssl und einer mysql Database für die Benutzerkonten einzurichten.
Beim einrichten bin ich nach diesem Tut vorgegangen: http://www.cplinux.de/debian-proftpd-mit-mysql.view.html

Soweit dürfte auch alles funktioniert haben. Der Server läuft jedoch komm ich nicht drauf.
Hier mal ein paar ausgaben ;)

Server ist auf port 21 erreichbar:

Quellcode

1
2
3
4
5
6
7
8
9
10
Starting Nmap 4.53 ( http://insecure.org ) at 2008-04-02 12:11 CEST
Interesting ports on tunafix.xonet (192.168.3.10):
Not shown: 1710 closed ports
PORT 	STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
631/tcp  open  ipp
2001/tcp open  dc

Nmap done: 1 IP address (1 host up) scanned in 0.120 seconds


Meine proftpd conf:

Quellcode

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# This is a basic ProFTPD configuration file (rename it to 
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anonymous access.

#UseIPv6                    	off
ServerName                  	"Experience Online FTP"
ServerType                  	standalone
DeferWelcome        	off
MultilineRFC2228    	on
DefaultServer       	on
ShowSymlinks        	on
TimeoutNoTransfer   	600
TimeoutStalled      	600
TimeoutIdle         	1200
#DisplayLogin       	welcome.msg
#DisplayFirstChdir  	.message
ListOptions         	"-l"
#DenyFilter         	*.*/

TransferLog 	/var/log/proftpd/xferlog
SystemLog   	/var/log/proftpd/proftpd.log

#RequireValidShell  	off
#AuthPAM                            	off
#AuthPAMConfig      	ftp
# Port 21 is the standard FTP port.
Port                        	21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                       	022 	022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit the maximum number of processes per service
# (such as xinetd).
MaxInstances        	10

# Set the user and group under which the server will run.
User                        	proftpd
Group                       	nogroup

# Normally, we want files to be overwriteable.
<Directory />
    	AllowOverwrite      	on
</Directory>

# A basic anonymous configuration, with no upload directories.
#<Anonymous ~ftp>
#   	User                        	ftp
#   	Group                       	ftp
#
#   	# We want clients to be able to login with "anonymous" as well as "ftp".
#   	UserAlias                   	anonymous ftp
#
#   	# Limit the maximum number of anonymous logins.
#   	MaxClients                  	10
#
#   	# We want 'welcome.msg' displayed at login, and '.message' displayed
#   	# in each newly chdired directory.
#   	DisplayLogin                	welcome.msg
#   	DisplayFirstChdir           	.message
#
#   	# Limit WRITE everywhere in the anonymous chroot.
#   	<Limit WRITE>
#           	DenyAll
#   	</Limit>
#</Anonymous>


<IfModule mod_ctrls.c>
ControlsEngine      	on
ControlsMaxClients  	2
ControlsLog         	/var/log/proftpd/controls.log
ControlsInterval    	5
ControlsSocket      	/var/run/proftpd/proftpd.sock
</IfModule>

<IfModule mod_ctrls_admin.c>
AdminControlsEngine on
</IfModule>

SQLAuthTypes	Crypt
SQLAuthenticate users*
SQLConnectInfo  proftpd@tunafix ftp *****
SQLDefaultGID   65534
SQLDefaultUID   65534
SQLMinUserGID   100
SQLMinUserUID   500
SQLUserInfo 	ftpuser username password uid gid homedir shell
SQLLOGFILE  	/var/log/proftpd/proftpd.sql.log


TLSEngine   	on
TLSLog  /var/log/proftpd/tls.log
TLSProtocol 	SSLv23
TLSOptions  	NoCertRequest
TLSRSACertificateFile   /etc/proftpd/ssl/proftpd.cert.pem
TLSRSACertificateKeyFile    	/etc/proftpd/ssl/proftpd.key.pem
TLSVerifyClient off
TLSRequired 	on


Log Ausgaben:

proftpd.log

Quellcode

1
Apr 02 13:35:39 tunafix proftpd[1700] tunafix.xonet (asterix.xonet[192.168.2.31]): FTP session closed.


proftpd.sql.log

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Apr 02 13:34:51 mod_sql/4.2.2[1695]: defaulting to 'mysql' backend
Apr 02 13:34:51 mod_sql/4.2.2[1695]: backend module 'mod_sql_mysql/4.0.7'
Apr 02 13:34:51 mod_sql/4.2.2[1695]: backend api	'mod_sql_api_v1'
Apr 02 13:34:51 mod_sql/4.2.2[1695]: >>> sql_sess_init
Apr 02 13:34:51 mod_sql/4.2.2[1695]: entering   mysql cmd_defineconnection
Apr 02 13:34:51 mod_sql/4.2.2[1695]:   name: 'default'
Apr 02 13:34:51 mod_sql/4.2.2[1695]:   user: 'ftp'
Apr 02 13:34:51 mod_sql/4.2.2[1695]:   host: 'tunafix'
Apr 02 13:34:51 mod_sql/4.2.2[1695]: 	db: 'proftpd'
Apr 02 13:34:51 mod_sql/4.2.2[1695]:   port: '3306'
Apr 02 13:34:51 mod_sql/4.2.2[1695]:	ttl: '0'
Apr 02 13:34:51 mod_sql/4.2.2[1695]: exiting	mysql cmd_defineconnection
Apr 02 13:34:51 mod_sql/4.2.2[1695]: entering   mysql cmd_open
Apr 02 13:34:51 mod_sql/4.2.2[1695]: exiting	mysql cmd_open
Apr 02 13:34:51 mod_sql/4.2.2[1695]: unrecoverable backend error
Apr 02 13:34:51 mod_sql/4.2.2[1695]: error: '1045'
Apr 02 13:34:51 mod_sql/4.2.2[1695]: message: 'Access denied for user 'ftp'@'localhost' (using password: YES)'


Also so wie ich das jetzt verstehe hat der Benutzer keine rechte auf mysql zuzugreifen:
jedoch sollte er die haben:

Quellcode

1
2
3
4
5
6
7
8
mysql> show grants for 'ftp'@'tunafix';
+----------------------------------------------------------------------------------------------------------+
| Grants for ftp@tunafix                                                                               	|
+----------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ftp'@'tunafix' IDENTIFIED BY PASSWORD '*530DA59A35CE96F7F443A0B0DDA124EDE4EA4A4B' | 
| GRANT ALL PRIVILEGES ON `proftpd`.`ftpuser` TO 'ftp'@'tunafix'                                       	| 
+----------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

die Datenbank heißt "proftpd" und die Tabelle heißt "ftpuser".

Zu dem ganzen hab ich jetzt noch ne Frage:
Muss der User "ftp" auch im System vorhanden sein?
Zwar sollte er das:

Quellcode

1
ftp:x:21:21:added by portage for ftpbase:/home/ftp:/sbin/nologin

jedoch ist dieser nicht aktiv. Oder liegt das Problem wo anders.

PS: In der mysql Datenbank werden ja die Benutzer abgespeichert. Müssen diese Benutzer auch im System vorhanden sein?

greetz devion

Edit:
Falls noch ausgaben gebraucht werden, bitte sagen ;)
To mess up a Linux box, you need to work at it; to mess up your Windows box, you just need to work on it.

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »devion« (03.04.2008, 10:17)


2

03.04.2008, 10:15

So nach einigem herumspielen hab ich es nun geschafft.. Der Server löuft :D :D

Eigentlich wargar nicht mal so viel falsch. Ich post mal die Fehler die ich hatte ;)

Erstens, der Bentuzer der auf die mysql datanbank schreiben durfte war falsch:

Ich hatte : "'ftp@tunafix"
Der Rechner hieß in diesem Fall "tunafix", jedoch musste ich es ändern in "localhost" (hab gedacht es sei egal ;) )
Die entsprechenden Einträge hab ich dann bearbeitet, und nun gehts:

mysql:

Quellcode

1
2
3
4
5
6
7
8
mysql> show grants for 'ftp'@'localhost';
+------------------------------------------------------------------------------------------------------------+
| Grants for ftp@localhost                                                                               	|
+------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'ftp'@'localhost' IDENTIFIED BY PASSWORD '*530DA59A35CE96F7F443A0B0DDA124EDE4EA4A4B' | 
| GRANT ALL PRIVILEGES ON `proftpd`.`ftpuser` TO 'ftp'@'localhost'                                       	| 
+------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)



Zweitens, hatte ich auch noch 2 Fehler in der proftpd.conf:
TLSRequired on --> gehört auf off
RequireValidShell off hatte ich vergessen

Die conf sieht nun wie folgt aus:

Quellcode

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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# This is a basic ProFTPD configuration file (rename it to 
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anonymous access.

#UseIPv6                        off
ServerName                      "Experience Online FTP"
ServerType                      standalone
DeferWelcome            off
MultilineRFC2228        on
DefaultServer           on
ShowSymlinks            on
TimeoutNoTransfer       600
TimeoutStalled          600
TimeoutIdle             1200
#DisplayLogin           welcome.msg
#DisplayFirstChdir      .message
ListOptions             "-l"
#DenyFilter             *.*/
RequireValidShell       off

TransferLog     /var/log/proftpd/xferlog
SystemLog       /var/log/proftpd/proftpd.log

#RequireValidShell      off
#AuthPAM                                off
#AuthPAMConfig          ftp
# Port 21 is the standard FTP port.
Port                            21

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask                           022     022

# To prevent DoS attacks, set the maximum number of child processes
# to 30. If you need to allow more than 30 concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit the maximum number of processes per service
# (such as xinetd).
MaxInstances            10

# Set the user and group under which the server will run.
User                            proftpd
Group                           nogroup

# Normally, we want files to be overwriteable.
<Directory />
        AllowOverwrite          on
</Directory>

# A basic anonymous configuration, with no upload directories.
#<Anonymous ~ftp>
#       User                            ftp
#       Group                           ftp
#
#       # We want clients to be able to login with "anonymous" as well as "ftp".
#       UserAlias                       anonymous ftp
#
#       # Limit the maximum number of anonymous logins.
#       MaxClients                      10
#
#       # We want 'welcome.msg' displayed at login, and '.message' displayed
#       # in each newly chdired directory.
#       DisplayLogin                    welcome.msg
#       DisplayFirstChdir               .message
#
#       # Limit WRITE everywhere in the anonymous chroot.
#       <Limit WRITE>
#               DenyAll
#       </Limit>
#</Anonymous>


<IfModule mod_ctrls.c>
ControlsEngine          on
ControlsMaxClients      2
ControlsLog             /var/log/proftpd/controls.log
ControlsInterval        5
ControlsSocket          /var/run/proftpd/proftpd.sock
</IfModule>

<IfModule mod_ctrls_admin.c>
AdminControlsEngine on
</IfModule>

SQLAuthTypes    Crypt
SQLAuthenticate users*
SQLConnectInfo  proftpd@localhost ftp acxsql
SQLDefaultGID   65534
SQLDefaultUID   65534
SQLMinUserGID   100
SQLMinUserUID   500
SQLUserInfo     ftpuser username password uid gid homedir shell
SQLLOGFILE      /var/log/proftpd/proftpd.sql.log


TLSEngine       on
TLSLog  /var/log/proftpd/tls.log
TLSProtocol     SSLv23
TLSOptions      NoCertRequest
TLSRSACertificateFile   /etc/proftpd/ssl/proftpd.cert.pem
TLSRSACertificateKeyFile        /etc/proftpd/ssl/proftpd.key.pem
TLSVerifyClient off
TLSRequired     off
To mess up a Linux box, you need to work at it; to mess up your Windows box, you just need to work on it.