[gelöst] Keine Datenverbindung zu FTP-Servern möglich

Probleme mit Samba, NFS, FTP und Co.
Antworten
rne
Beiträge: 30
Registriert: 29.05.2017 14:15:13
Lizenz eigener Beiträge: GNU Free Documentation License

[gelöst] Keine Datenverbindung zu FTP-Servern möglich

Beitrag von rne » 29.05.2017 14:34:16

Hallo zusammen,

ich habe Ende letzter Woche von Debian 8.8 auf Debian 9 geupdated.
Leider funktioniert seit dem die Datenverbindung zum FTP Server nicht mehr.
Ich benutze als serverseitige Softwarefirewall ufw mit folgenden Regeln:

Code: Alles auswählen

-P INPUT DROP
-P FORWARD DROP
-P OUTPUT ACCEPT
-N ufw-after-forward
-N ufw-after-input
-N ufw-after-logging-forward
-N ufw-after-logging-input
-N ufw-after-logging-output
-N ufw-after-output
-N ufw-before-forward
-N ufw-before-input
-N ufw-before-logging-forward
-N ufw-before-logging-input
-N ufw-before-logging-output
-N ufw-before-output
-N ufw-logging-allow
-N ufw-logging-deny
-N ufw-not-local
-N ufw-reject-forward
-N ufw-reject-input
-N ufw-reject-output
-N ufw-skip-to-policy-forward
-N ufw-skip-to-policy-input
-N ufw-skip-to-policy-output
-N ufw-track-forward
-N ufw-track-input
-N ufw-track-output
-N ufw-user-forward
-N ufw-user-input
-N ufw-user-limit
-N ufw-user-limit-accept
-N ufw-user-logging-forward
-N ufw-user-logging-input
-N ufw-user-logging-output
-N ufw-user-output
-A INPUT -j ufw-before-logging-input
-A INPUT -j ufw-before-input
-A INPUT -j ufw-after-input
-A INPUT -j ufw-after-logging-input
-A INPUT -j ufw-reject-input
-A INPUT -j ufw-track-input
-A FORWARD -j ufw-before-logging-forward
-A FORWARD -j ufw-before-forward
-A FORWARD -j ufw-after-forward
-A FORWARD -j ufw-after-logging-forward
-A FORWARD -j ufw-reject-forward
-A FORWARD -j ufw-track-forward
-A OUTPUT -j ufw-before-logging-output
-A OUTPUT -j ufw-before-output
-A OUTPUT -j ufw-after-output
-A OUTPUT -j ufw-after-logging-output
-A OUTPUT -j ufw-reject-output
-A OUTPUT -j ufw-track-output
-A ufw-after-input -p udp -m udp --dport 137 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp -m udp --dport 138 -j ufw-skip-to-policy-input
-A ufw-after-input -p tcp -m tcp --dport 139 -j ufw-skip-to-policy-input
-A ufw-after-input -p tcp -m tcp --dport 445 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp -m udp --dport 67 -j ufw-skip-to-policy-input
-A ufw-after-input -p udp -m udp --dport 68 -j ufw-skip-to-policy-input
-A ufw-after-input -m addrtype --dst-type BROADCAST -j ufw-skip-to-policy-input
-A ufw-after-logging-forward -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK] "
-A ufw-after-logging-input -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK] "
-A ufw-before-forward -i intr0 -j ACCEPT
-A ufw-before-forward -i term0 -j ACCEPT
-A ufw-before-forward -j ufw-user-forward
-A ufw-before-input -i lo -j ACCEPT
-A ufw-before-input -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-input -m state --state INVALID -j ufw-logging-deny
-A ufw-before-input -m state --state INVALID -j DROP
-A ufw-before-input -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 4 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 12 -j ACCEPT
-A ufw-before-input -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A ufw-before-input -p udp -m udp --sport 67 --dport 68 -j ACCEPT
-A ufw-before-input -j ufw-not-local
-A ufw-before-input -d 224.0.0.251/32 -p udp -m udp --dport 5353 -j ACCEPT
-A ufw-before-input -d 239.255.255.250/32 -p udp -m udp --dport 1900 -j ACCEPT
-A ufw-before-input -j ufw-user-input
-A ufw-before-output -o lo -j ACCEPT
-A ufw-before-output -m state --state RELATED,ESTABLISHED -j ACCEPT
-A ufw-before-output -j ufw-user-output
-A ufw-logging-allow -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW ALLOW] "
-A ufw-logging-deny -m conntrack --ctstate INVALID -m limit --limit 3/min --limit-burst 10 -j RETURN
-A ufw-logging-deny -m limit --limit 3/min --limit-burst 10 -j LOG --log-prefix "[UFW BLOCK] "
-A ufw-not-local -m addrtype --dst-type LOCAL -j RETURN
-A ufw-not-local -m addrtype --dst-type MULTICAST -j RETURN
-A ufw-not-local -m addrtype --dst-type BROADCAST -j RETURN
-A ufw-not-local -m limit --limit 3/min --limit-burst 10 -j ufw-logging-deny
-A ufw-not-local -j DROP
-A ufw-skip-to-policy-forward -j DROP
-A ufw-skip-to-policy-input -j DROP
-A ufw-skip-to-policy-output -j ACCEPT
-A ufw-track-output -p tcp -m conntrack --ctstate NEW -j ACCEPT
-A ufw-track-output -p udp -m conntrack --ctstate NEW -j ACCEPT
-A ufw-user-input -p tcp -m multiport --dports 80,443 -m comment --comment "\'dapp_Nginx%20Full\'" -j ACCEPT
-A ufw-user-input -p tcp -m tcp --dport 22 -m comment --comment "\'dapp_OpenSSH\'" -j ACCEPT
-A ufw-user-input -p udp -m udp --dport 1194 -m comment --comment "\'dapp_OpenVPN\'" -j ACCEPT
-A ufw-user-input -p udp -m udp --dport 1195 -j ACCEPT
-A ufw-user-input -s 10.8.0.0/16 -d 10.8.0.1/32 -i term0 -p tcp -m tcp --dport 8080 -j ACCEPT
-A ufw-user-input -s 10.8.0.0/16 -d 10.9.0.0/24 -i term0 -j ACCEPT
-A ufw-user-input -s 10.9.0.0/24 -d 10.8.0.0/16 -i intr0 -j ACCEPT
-A ufw-user-input -d 10.9.0.1/32 -i intr0 -p tcp -m tcp --dport 3306 -j ACCEPT
-A ufw-user-input -s 10.9.0.0/24 -d 10.9.0.1/32 -i intr0 -p tcp -m tcp --dport 53 -j ACCEPT
-A ufw-user-input -s 10.9.0.0/24 -d 10.9.0.1/32 -i intr0 -p udp -m udp --dport 53 -j ACCEPT
-A ufw-user-input -p tcp -m multiport --dports 20,21 -m comment --comment "\'dapp_FTP\'" -j ACCEPT
-A ufw-user-input -p tcp -m tcp --dport 20 -j ACCEPT
-A ufw-user-input -p tcp -m tcp --dport 21 -j ACCEPT
-A ufw-user-limit -m limit --limit 3/min -j LOG --log-prefix "[UFW LIMIT BLOCK] "
-A ufw-user-limit -j REJECT --reject-with icmp-port-unreachable
-A ufw-user-limit-accept -j ACCEPT
-A ufw-user-output -p tcp -m tcp --dport 465 -j ACCEPT
-A ufw-user-output -p tcp -m tcp --dport 25 -j ACCEPT
Ich habe die folgenden Szenarien jeweils mit und ohne aktive Firewall getestet. In beiden Fällen traten die selben Fehler auf.

Versuch 1
Server: vsftpd_3.0.3-8+b1

Client:

Code: Alles auswählen

$ ftp --version
ftp (GNU inetutils) 1.9.4
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by many authors.
auf ArchLinux.

Verbindungsversuch:

Code: Alles auswählen

Connected to <host>
220 (vsFTPd 3.0.3)
Name (<host>:<lokaler_benutzername>): <ftp_benutzername>
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
ftp> 
Versuch 2

Server: vsftpd_3.0.2-17+deb8u1
Client: s.o.

Verbinungsversuch:

Code: Alles auswählen

Connected to <host>.
220 (vsFTPd 3.0.2)
Name (<host>:<lokaler_benutzername>): <ftp_benutzername>
331 Please specify the password.
Password: 
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
200 PORT command successful. Consider using PASV.
425 Failed to establish connection.
ftp> 
Versuch 3
Server: proftpd-basic_1.3.5b-4
Client: s.o.

Code: Alles auswählen

Connected to <host>.
220 ProFTPD 1.3.5b Server (Debian) [<ip_addresse>]
Name (<host>:<lokaler_benutzername>): <ftp_benutzername>
331 Password required for <ftp_benutzername>
Password: 
230-Welcome, archive user <ftp_benutzername>@<lokaler_host> !
230-
230-The local time is: Mon May 29 14:03:33 2017
230-
230-This is an experimental FTP server.  If you have any unusual problems,
230-please report them via e-mail to <root@<host>>.
230-
230 User <ftp_benutzername> logged in
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
200 PORT command successful
425 Unable to build data connection: Keine Route zum Zielrechner
ftp> 
Benutzte Konfigurationen
/etc/vsftpd.conf

Code: Alles auswählen

#############################################################################
#
# Example config file /etc/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
#
# Run standalone?  vsftpd can run either from an inetd or as a standalone
# daemon started from an initscript.
listen=YES
#
# Run standalone with IPv6?
# Like the listen parameter, except vsftpd will listen on an IPv6 socket
# instead of an IPv4 one. This parameter and the listen parameter are mutually
# exclusive.
#listen_ipv6=YES
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
local_enable=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
#local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
dirmessage_enable=YES
force_dot_files=YES
#
# If enabled, vsftpd will display directory listings with the time
# in  your  local  time  zone.  The default is to display GMT. The
# times returned by the MDTM FTP command are also affected by this
# option.
use_localtime=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# You may override where the log file goes if you like. The default is shown
# below.
#xferlog_file=/var/log/vsftpd.log
#
# If you want, you can have your log file in standard ftpd xferlog format.
# Note that the default log file location is /var/log/xferlog in this case.
#xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
#idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd.banned_emails
#
# You may restrict local users to their home directories.  See the FAQ for
# the possible risks in this before using chroot_local_user or
# chroot_list_enable below.
chroot_local_user=YES
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
# (Warning! chroot'ing can be very dangerous. If using chroot, make sure that
# the user does not have write access to the top level directory within the
# chroot)
#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# Customization
#
# Some of vsftpd's settings don't fit the filesystem layout by
# default.
#
# This option should be the name of a directory which is empty.  Also, the
# directory should not be writable by the ftp user. This directory is used
# as a secure chroot() jail at times vsftpd does not require filesystem
# access.
secure_chroot_dir=/var/run/vsftpd/empty
#
# This string is the name of the PAM service vsftpd will use.
pam_service_name=vsftpd
#
# This option specifies the location of the RSA certificate to use for SSL
# encrypted connections.
#rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO

# Debugging seccomp according to:
# https://technologytales.com/2013/09/21/turning-off-seccomp-sandbox-in-vsftpd/
#seccomp_sandbox=NO
/etc/pam.d/vsftpd

Code: Alles auswählen

# Standard behaviour for ftpd(8).
auth	required	pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed

# Note: vsftpd handles anonymous logins on its own. Do not enable pam_ftp.so.

# Standard pam includes
@include common-account
@include common-session
@include common-auth
auth	required	pam_shells.so

# Only allow FTP access for users in the 'ftponly' group
auth	required	pam_succeed_if.so quiet user ingroup ftponly
/etc/proftpd/conf.d/auth.conf

Code: Alles auswählen

<IfModule mod_auth_pam.c>
    AuthPAM off
</IfModule>

<Limit LOGIN>
    AllowGroup ftponly
    DenyAll
</Limit>
Wie bekomme ich nun FTP zum laufen?
Zuletzt geändert von rne am 19.10.2017 09:31:23, insgesamt 2-mal geändert.
Der Nachteil der Intelligenz besteht darin, daß man ununterbrochen gezwungen ist, dazuzulernen. -- George Bernard Shaw

Benutzeravatar
MSfree
Beiträge: 10686
Registriert: 25.09.2007 19:59:30

Re: Keine Datenverbindung zu FTP-Servern möglich

Beitrag von MSfree » 29.05.2017 15:07:31

Läuft die Firewall auf dem Gerät, das du auf Debian 9 aktualisiert hast?

Funktioniert es, nachdem du

Code: Alles auswählen

modprobe nf_conntrack_ftp
ausführst?

rne
Beiträge: 30
Registriert: 29.05.2017 14:15:13
Lizenz eigener Beiträge: GNU Free Documentation License

Re: Keine Datenverbindung zu FTP-Servern möglich

Beitrag von rne » 29.05.2017 15:18:17

MSfree hat geschrieben:Läuft die Firewall auf dem Gerät, das du auf Debian 9 aktualisiert hast?
Ja. Funzt aber auch nicht ohne.
Ohne =

Code: Alles auswählen

systemctl disable ufw
ufw disable
reboot
MSfree hat geschrieben: Funktioniert es, nachdem du

Code: Alles auswählen

modprobe nf_conntrack_ftp
ausführst?
Nein.

Ich habe noch etwas interessantes herausgefunden:
Auf einem Windows 10 Client kann ich das dir Kommando ausführen und bekomme die Ordnerinhalte angezeigt.
Jedoch nur im CMD. Wenn ich FTP über die URL des Windows explorer benutze, streikt es auch hier.
Dies betrifft sowohl vsftpd als auch proftpd.
Sehr, sehr merkwürdig.
Der Nachteil der Intelligenz besteht darin, daß man ununterbrochen gezwungen ist, dazuzulernen. -- George Bernard Shaw

rne
Beiträge: 30
Registriert: 29.05.2017 14:15:13
Lizenz eigener Beiträge: GNU Free Documentation License

Re: Keine Datenverbindung zu FTP-Servern möglich

Beitrag von rne » 29.05.2017 16:19:28

Nach einem komplett fehlgeschlagenen Downgrade zurück nach Jessie (8.8 ) habe ich unseren Hostingprovider nun gebeten ein Backup von vor dem Upgrade einzuspielen.
Ich bin mal gespannt, ob die FTP Server nach dem offiziellen Release Mitte Juni funktionieren werden. Ist ja kaum zu fassen, dass so kurz vor dem Release ein solch verbreitet genutzter Dienst überhaut nicht funktioniert. :evil:
Der Nachteil der Intelligenz besteht darin, daß man ununterbrochen gezwungen ist, dazuzulernen. -- George Bernard Shaw

uname
Beiträge: 12045
Registriert: 03.06.2008 09:33:02

Re: [erledigt] Keine Datenverbindung zu FTP-Servern möglich

Beitrag von uname » 30.05.2017 08:59:47

Könnte daran liegen, dass FTP als Dateitransport für normale Anwender vollkommen ungeeignet ist. Interessant ist es eigentlich nur für Webseiten-Betreiber mit Tausenden von Benutzern. Wie viele Benutzer verwaltest du damit? Für sftp hättest du nur eine Konfigurationszeile in /etc/ssh/sshd_config ändern müssen. Selbst Filezilla unter Windows kann mittlerweile sftp.

rne
Beiträge: 30
Registriert: 29.05.2017 14:15:13
Lizenz eigener Beiträge: GNU Free Documentation License

Re: [erledigt] Keine Datenverbindung zu FTP-Servern möglich

Beitrag von rne » 30.05.2017 12:40:45

uname hat geschrieben:Könnte daran liegen, dass FTP als Dateitransport für normale Anwender vollkommen ungeeignet ist.
Was sind "normale Anwender"? Bin ich keiner? Ich benutze Debian, wie wahrscheinlich die meisten seiner Benutzer, als Serverbetriebssystem.
uname hat geschrieben:Interessant ist es eigentlich nur für Webseiten-Betreiber mit Tausenden von Benutzern.
Wohl kaum. FTP ist, was mir durchaus bewußt ist, total unsicher. Allerdings kann die Client-Software einiger unserer Kunden (immer noch) kein SFTP.
uname hat geschrieben:Wie viele Benutzer verwaltest du damit?

Code: Alles auswählen

$ grep ^ftponly /etc/group | sed 's/,/\n/g' | wc -l
17
uname hat geschrieben:Für sftp hättest du nur eine Konfigurationszeile in /etc/ssh/sshd_config ändern müssen.
Der SFTP Server auf dem Debian-System schnurrt(e) nach wie vor wie ein Kätzchen und ist auch überhaupt nicht das Problem (gewesen).
uname hat geschrieben:Selbst Filezilla unter Windows kann mittlerweile sftp.
Leider gewisse proprietäre Software unserer Kunden nicht. :wink:
Der Nachteil der Intelligenz besteht darin, daß man ununterbrochen gezwungen ist, dazuzulernen. -- George Bernard Shaw

uname
Beiträge: 12045
Registriert: 03.06.2008 09:33:02

Re: [erledigt] Keine Datenverbindung zu FTP-Servern möglich

Beitrag von uname » 30.05.2017 14:38:35

Ok. Dann bleibt dir wohl nur dieses komische FTP.

rne
Beiträge: 30
Registriert: 29.05.2017 14:15:13
Lizenz eigener Beiträge: GNU Free Documentation License

Re: Keine Datenverbindung zu FTP-Servern möglich

Beitrag von rne » 19.10.2017 09:31:11

So,

nachdem ich den Fehler vor einigen Wochen nach einem Kernelupdate aus den Backports erneut hatte, habe ich noch ein Mal dazu recherchiert.
Das Problem war die Firewall des Servers. FTP ist zwar freigegeben, jedoch muss bei neuen Kernel >= 4.7 in der Netfilterkonfiguration der nf_conntrack_helper aktiviert werden:
https://wiki.archlinux.org/index.php/Ve ... g_iptables
Der Nachteil der Intelligenz besteht darin, daß man ununterbrochen gezwungen ist, dazuzulernen. -- George Bernard Shaw

Antworten