Debian » ProFTP

ID #1024

ProFTP (Standalone, mit TLS Verschlüsslung) installieren

ProFTP ist ein sehr guter FTP-Server welcher sich in sehr kurzer zeit installieren lässt. Auf einen FTP-Server sollte man nicht mit einer unverschlüsselten Verbindung zugreifen, da sonst das Passwort in Klartext übertragen wird.

1. ProFTP installieren:
apt-get install proftpd

2. OpenSSL installieren:
apt-get install openssl

3. Einen neuen Schlüssel für OpenSSL generieren:
openssl req -new -x509 -days 365 -nodes  -out /etc/ssl/certs/proftpd.cert.pem -keyout /etc/ssl/certs/proftpd.key.pem

4. Eine neue Benutzergruppe namens "ftpuser" anlegen:
addgroup ftpuser

5. Da der FTP-Benutzer nicht auf die "richtige" Shell zugreifen soll folgendes durchführen:
cp /bin/false /bin/ftp
echo "/bin/ftp" >> /etc/shells

6. FTP-Benutzer erstellen:
adduser --shell /bin/ftp --ingroup ftpuser [Benutzername][Benutzername] = Name des Benutzers

7. Konfigurations-Datei von ProFTP sichern und danach die bestehende Konfiguration anpassen:
cp /etc/proftpd.conf /etc/proftpd.sav
nano /etc/proftpd.conf

8. Die bestehende Konfiguration wird nun angezeigt, der Inhalt der Datei kann gelöscht werden, da ja eine neue Konfiguration erstellt werden soll (geht am schnellsten mit Ctrl+k), danach folgendes einfügen:
# 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 anon.

ServerName "Name des FTP-Servers" # den eigenen Server angeben
ServerType                      standalone # initd oder standalone
DeferWelcome            off

ShowSymlinks            on
MultilineRFC2228                on
DefaultServer           on
AllowOverwrite on
AllowRetrieveRestart on
AllowStoreRestart on

TimeoutNoTransfer       600
TimeoutStalled          600
TimeoutIdle                     1200

DisplayLogin                    welcome.msg
DisplayFirstChdir               .message
ListOptions                     "-l"

DenyFilter \\*.*/

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

# Port 21 is the standard FTP port.
Port                            21

# 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                            nobody
Group                           nogroup


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

AllowOverwrite on
</Directory>

# Hier meine Ergänzungen

# chroot für alle User der Gruppe ftpuser
DefaultRoot                     ~ ftpuser

# Login nur von Mitgliedern der Gruppe ftpuser erlauben
<Limit LOGIN>
DenyGroup                       !ftpuser
</Limit>

# Root-Login verbieten und gültige Shell verlangen (in /etc/shells)
<Global>
RootLogin                       off
RequireValidShell       on
</Global>

# Speed erhoehen
UseReverseDNS   off
IdentLookups            off

# Logging Formate
LogFormat                       default "%h %l %u %t \\"%r\\" %s %b"
LogFormat                       auth "%v [%P] %h %t \\"%r\\" %s"
LogFormat                       write "%h %l %u %t \\"%r\\" %s %b"

# Logging aktivieren

# alle logins
ExtendedLog             /var/log/ftp_auth.log AUTH auth

# file/dir Zugriff
ExtendedLog             /var/log/ftp_access.log WRITE,READ write

# für paranoide (vorsicht, erzeugt grosse Logfiles)
#ExtendedLog /var/log/ftp_paranoid.log ALL default

# Uncomment this if you would use TLS module:
TLSEngine                               on
TLSLog                                  /var/log/tls.log
TLSProtocol                             SSLv23
TLSOptions                              NoCertRequest
TLSRSACertificateFile                   /etc/ssl/certs/proftpd.cert.pem
TLSRSACertificateKeyFile                /etc/ssl/certs/proftpd.key.pem
TLSRequired                             on
TLSVerifyClient                         off

7. ProFTP-Konfiguration testen und wenn alles ok ist, den ProFTP-Daemon neu starten:
/usr/sbin/proftpd --configtest
/etc/init.d/proftpd restart

8. Nun kann man mit dem Benutzer den man vorher erstellt hat auf den FTP-Server einloggen. Im FTP-Client muss jedoch "FTP over SSL explicit" ausgewählt werden, da eine unverschlüsselte Anmeldung am FTP-Server nicht mehr möglich ist.

Hinweis: Diese hier aufgelistete proftpd.conf-Datei stammt ursprünglich von http://www.debianhowto.de/doku.php/de:howtos:sarge:proftpd_tls, diese Datei wurde aber von mir angepasst und nach meinen Bedürfnissen optimiert.

 



Tags: standalone, tls, proftp

Verwandte Artikel:

Letzte Änderung des Artikels: 2007-06-21 12:27
Autor: Andy Blank
Revision: 1.17

Digg it! Artikel ausdrucken Artikel weiterempfehlen Als PDF-Datei anzeigen
Übersetzungsvorschlag für Übersetzungsvorschlag für
Bewertung der Nützlichkeit dieses Artikels:

Durchschnittliche Bewertung: 0 von 5 (0 Bewertungen)

vollkommen überflüssig 1 2 3 4 5 sehr wertvoll

Es ist möglich, diesen Artikel zu kommentieren.