Proftpd Portfreigabe

Tockra

Lt. Commander
Registriert
Dez. 2008
Beiträge
1.063
Hallo Leute,

Ich benutze das FTP Programm Proftpd auf meinem Server und habe ein Problem:
Ich habe den Standartport in der proftpd.conf in 23023 geändert und diesen sowohl für udp als auch für tcp in meiner Firewall freigegeben. Das Problem ist nun, dass ich nur eine Art "halbe Verbindung" zum Server bekomme. Das sagt mein filezilla:
Code:
Status:	Auflösen der IP-Adresse für IP
Status:	Verbinde mit IP:23023...
Status:	Verbindung hergestellt, warte auf Willkommensnachricht...
Antwort:	220 ProFTPD 1.3.3a Server (Unlimited-Network) [IP]
Befehl:	USER ftpuser
Antwort:	331 Password required for ftpuser
Befehl:	PASS *******************
Antwort:	230 User ftpuser logged in
Befehl:	SYST
Antwort:	215 UNIX Type: L8
Befehl:	FEAT
Antwort:	211-Features:
Antwort:	 LANG en-US.UTF-8;en-US*
Antwort:	 MDTM
Antwort:	 MFMT
Antwort:	 TVFS
Antwort:	 UTF8
Antwort:	 MFF modify;UNIX.group;UNIX.mode;
Antwort:	 MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
Antwort:	 SITE MKDIR
Antwort:	 SITE RMDIR
Antwort:	 SITE UTIME
Antwort:	 SITE SYMLINK
Antwort:	 REST STREAM
Antwort:	 SIZE
Antwort:	211 End
Befehl:	OPTS UTF8 ON
Antwort:	200 UTF8 set to on
Status:	Verbunden
Status:	Empfange Verzeichnisinhalt...
Befehl:	PWD
Antwort:	257 "/" is the current directory
Befehl:	TYPE I
Antwort:	200 Type set to I
Befehl:	PASV
Antwort:	227 Entering Passive Mode (IP,169,176).
Befehl:	MLSD
Fehler:	Zeitüberschreitung der Verbindung
Fehler:	Verzeichnisinhalt konnte nicht empfangen werden

Wenn ich die Firewall ausschalte, läuft alles super, deswegen denke ich es liegt an der Portfreigabe. Aber welcher Port muss noch freigegeben werden?

Das sagt mein proftpd Log:

Code:
Dec 26 00:54:24 Unlimited-Network ftpuser[24072] Unlimited-Network (dslb-092-073-009-009.pools.arcor-ip.net[meineIP]): FTP session opened.
Dec 26 00:54:24 Unlimited-Network ftpuser[24072] Unlimited-Network (dslb-092-073-009-009.pools.arcor-ip.net[meineIP]): Preparing to chroot to directory '/home/ftpuser'
Dec 26 00:54:24 Unlimited-Network ftpuser[24072] Unlimited-Network (dslb-092-073-009-009.pools.arcor-ip.net[meineIP]): USER ftpuser: Login successful.
 
Wie witzig, hätte ich gerade nicht schon 15 Minuten gegoogelt, würde ich vielleicht jetzt lachen.
Das einzige was man immer wieder findet, ist das man Port 20 und 21 freigegeben muss. Jetzt habe ich den Port 21 in 23023 geändert, also muss ich doch wohl 23023 und 20 freigeben. Das klappt leider nicht.

€dit: Es funktioniert auch nicht Port 23023 und 21 freizugeben. Eine Information wäre auch cool, ob sich der Port 21 eventuell in meinem Fall auf 23024 ändert...
 
Zuletzt bearbeitet:
du hast den passiven modus aktiviert. also werden die ports benutzt, welche bei PassivePorts stehen. schau dir mal die entsprechende zeile in der proftpd.conf genauer an.
 
Hallo

den dafaultport würde ich nicht ändern. stadessen würde ich einen virtuellen server erstellen der dem neuen zugewiesen ist.

Dis am ende deiner Modules.config einfügen

<VirtualHost 192.168.1.xxx> [ <----- Die interne IP adresse eingeben ]
Port 23023
ServerName "Mein Vitueller Server"
</VirtualHost>


MFG
 
es ist scheiss egal was er für einen port nimmt - solange er nicht schon für andere services definiert ist. wichtig ist, dass die iptables auf dem server stimmen und proftpd richtig konfiguriert. die offenen ports bekommt man eh ganz simple mit nmap raus (falls du den port deswegen ändern möchtest).
 
So das steht in meiner proftpd.config:
Ich finde einfach nicht die gemeinte Stelle...
Code:
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes reload proftpd after modifications.
# 

# Includes DSO modules
Include /etc/proftpd/modules.conf

# Set off to disable IPv6 support which is annoying on IPv4 only boxes.
UseIPv6				off
# If set on you can experience a longer connection delay in many cases.
IdentLookups			off

ServerName			"Unlimited-Network"
ServerType			standalone
DeferWelcome			off

MultilineRFC2228		on
DefaultServer			on
ShowSymlinks			on

TimeoutNoTransfer		600
TimeoutStalled			600
TimeoutIdle			1200

DisplayLogin                    welcome.msg
DisplayChdir               	.message true
ListOptions                	"-l"

DenyFilter			\*.*/

# Use this to jail all users in their homes 
# DefaultRoot			~

# Users require a valid shell listed in /etc/shells to login.
# Use this directive to release that constrain.
RequireValidShell		off

# Port 21 is the standard FTP port.
Port				23023

# In some cases you have to specify passive ports range to by-pass
# firewall limitations. Ephemeral ports can be used for that, but
# feel free to use a more narrow range.
# PassivePorts                  49152 65534

# If your host was NATted, this option is useful in order to
# allow passive tranfers to work. You have to use your public
# address and opening the passive ports used on your firewall as well.
# MasqueradeAddress		1.2.3.4

# This is useful for masquerading address with dynamic IPs:
# refresh any configured MasqueradeAddress directives every 8 hours
<IfModule mod_dynmasq.c>
# DynMasqRefresh 28800
</IfModule>

# 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 maximum number of processes per service
# (such as xinetd)
MaxInstances			30

# Set the user and group that the server normally runs at.
User				proftpd
Group				nogroup

# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask				022  022
# Normally, we want files to be overwriteable.
AllowOverwrite			on

# Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords:
# PersistentPasswd		off

# This is required to use both PAM-based authentication and local passwords
# AuthOrder			mod_auth_pam.c* mod_auth_unix.c

# Be warned: use of this directive impacts CPU average load!
# Uncomment this if you like to see progress and transfer rate with ftpwho
# in downloads. That is not needed for uploads rates.
#
# UseSendFile			off

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

<IfModule mod_quotatab.c>
QuotaEngine off
</IfModule>

<IfModule mod_ratio.c>
Ratios off
</IfModule>


# Delay engine reduces impact of the so-called Timing Attack described in
# http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02
# It is on by default. 
<IfModule mod_delay.c>
DelayEngine on
</IfModule>

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

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

#
# Alternative authentication frameworks
#
#Include /etc/proftpd/ldap.conf
#Include /etc/proftpd/sql.conf

#
# This is used for FTPS connections
#
#Include /etc/proftpd/tls.conf

#
# Useful to keep VirtualHost/VirtualRoot directives separated
#
#Include /etc/proftpd/virtuals.con

# A basic anonymous configuration, no upload directories.

# <Anonymous ~ftp>
#   User				ftp
#   Group				nogroup
#   # We want clients to be able to login with "anonymous" as well as "ftp"
#   UserAlias			anonymous ftp
#   # Cosmetic changes, all files belongs to ftp user
#   DirFakeUser	on ftp
#   DirFakeGroup on ftp
# 
#   RequireValidShell		off
# 
#   # 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
#   DisplayChdir		.message
# 
#   # Limit WRITE everywhere in the anonymous chroot
#   <Directory *>
#     <Limit WRITE>
#       DenyAll
#     </Limit>
#   </Directory>
# 
#   # Uncomment this if you're brave.
#   # <Directory incoming>
#   #   # Umask 022 is a good standard umask to prevent new files and dirs
#   #   # (second parm) from being group and world writable.
#   #   Umask				022  022
#   #            <Limit READ WRITE>
#   #            DenyAll
#   #            </Limit>
#   #            <Limit STOR>
#   #            AllowAll
#   #            </Limit>
#   # </Directory>
# 
# </Anonymous>

<Global>
        RequireValidShell off
</Global>

DefaultRoot ~
<Limit LOGIN>
        DenyGroup !ftpuser
</Limit>

Wie soll ich das mit dem Virtuellen Server verstehen?
Ich glaube kaum, dass ich durchs Einfügen von
Code:
<VirtualHost 192.168.1.xxx> [ <----- Die interne IP adresse eingeben ]
Port 23023
ServerName "Mein Vitueller Server"
</VirtualHost>
in die modules.conf einen Virtuellen Server auf meinem Server habe.
 
Ist doch nicht aktiviert. Aber du könntest es mal mit auskommentieren versuchen (Zeile 45). Damit weicht er auf die PassivePorts aus, um der Firewall aus dem Weg zu gehen. Jetzt noch Port von 23023 wieder zurücksetzen auf 21. Dann muss du noch die iptables auf dem Server anpassen.

nicht vergessen bei jeder änderung /etc/init.d/proftpd restart

iptables -A INPUT -m tcp -p tcp –-dport 49152:65534 -j ACCEPT
oder kleinere Portrange (dann aber auch PassivePorts anpassen):
iptables -A INPUT -m tcp -p tcp –-dport 50000:51000 -j ACCEPT

anzeigen lassen mit:
iptables -L

löschen mit:
iptables -D INPUT nummervonregel

wenn ich das richtig verstanden habe, du hast nen vserver und du sitzt selbst hinter einem router oder ist etwa dein server hinter nem router? wenn nur du hinter dem router sitzt, musst du für ftp port 21 und 20 tcp freigeben. 21 ist für den verbindungsaufbau und 20 für die daten.
 
Zuletzt bearbeitet:
und warum eigentlich? wegen firewall oder wegen "sicherheit"?
 
naja, aber so wirklich sicher wird es ja dadurch auch nicht. das wird zwar gegen die meistens bots helfen, aber ein humanoider angreifer wird darin kein hinderniss sehen :P. wie gesagt, so ein port lässt sich ganz einfach mit nmap herausbekommen.

befindet sich denn nun der server hinter nem router/firewall oder nur dein rechner?
 
Zurück
Oben