Instalacja ProFTPD z TLS na Ubuntu 18.04 LTS
Poniższy poradnik opisuje proces instalacji serwera ftp na Ubuntu 18.04
Zapraszam do lektury.
Na początek dokonujemy aktualizacji repozytoriów oraz systemu:
1 2 | apt-get update apt-get upgrade |
Instalacja proftpd
1 | apt-get install proftpd-y |
Uruchamiamy go w systemie:
1 2 | systemctl start proftpd systemctl enable proftpd |
Sprawdzamy status usługi poleceniem:
1 | systemctl status proftpd |
Jeśli wszystko jest ok zobaczymy coś takiego:
1 2 3 4 5 6 7 8 9 10 11 12 | proftpd.service-LSB:Starts ProFTPD daemon Loaded:loaded(/etc/init.d/proftpd;generated) Active:active(running)since Sat2019-05-2509:18:19UTC;31sago Docs:man:systemd-sysv-generator(8) Tasks:1(limit:1114) CGroup:/system.slice/proftpd.service ??1927proftpd:(accepting connections) May2509:18:19ubuntu1804 systemd[1]:Starting LSB:Starts ProFTPD daemon... May2509:18:19ubuntu1804 proftpd[1906]: *Starting ftp server proftpd May2509:18:19ubuntu1804 proftpd[1906]: ...done. May2509:18:19ubuntu1804 systemd[1]:Started LSB:Starts ProFTPD daemon. |
Kolejny krok to edycja pliku konfiguracyjnego a mianowicie:
1 | /etc/proftpd/proftpd.conf |
edytujemy go poleceniem
1 | nano/etc/proftpd/proftpd.conf |
powinien wyglądać następująco:
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 | # # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file. # To really apply changes, reload proftpd after modifications, if # it runs in daemon mode. It is not required in inetd/xinetd mode. # # 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 "Debian" # Set to inetd only if you would run proftpd by inetd/xinetd. # Read README.Debian for more information on proper configuration. 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 ~ # Port 21 is the standard FTP port. Port 21 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 TransferLog/var/log/proftpd/xferlog SystemLog /var/log/proftpd/proftpd.log |
Poniżej opis najważniejszych ustawień
ServerName: Domyślna nazwa serwera ftp.
UseIPV6: Tutaj ustawiamy czy serwer ftp ma nasłuchiwać również na ipv6.
DefaultRoot: Powoduje zamknięcie użytkowników w ich katalogach domowych.
Port: Możesz zdefiniować własny port ftp .
SystemLog: Domyślna lokalizacja plików logu. Możesz to zmienić wedle upodobań
Teraz dokonamy zabezpieczenia ftp TLS
Instalujemy na początek niezbędną paczkę:
1 | apt-get install openssl-y |
Następnie generujemy certyfikat
1 | openssl req-x509-newkey rsa:1024-keyout/etc/ssl/private/proftpd.key-out/etc/ssl/certs/proftpd.crt-nodes-days365 |
Uzupełniamy go swoimi danymi.
Nadajemy uprawnienia na pliki certyfikatu:
1 2 | chmod600/etc/ssl/private/proftpd.key chmod600/etc/ssl/certs/proftpd.crt |
Edytujemy proftpd w celu uruchomienia TLS
1 | nano/etc/proftpd/proftpd.conf |
i odhaszujemy
1 | Include/etc/proftpd/tls.conf |
Całość powinna wyglądać następująco:
1 2 3 4 5 6 7 8 | TLSRSACertificateFile/etc/ssl/certs/proftpd.crt TLSRSACertificateKeyFile/etc/ssl/private/proftpd.key TLSEngine on TLSLog/var/log/proftpd/tls.log TLSProtocol SSLv23 TLSRequired on TLSOptions NoCertRequest EnableDiags NoSessionReuseRequired TLSVerifyClient off |
Ostatni krok to przeładowanie serwera ftp wykonamy to poleceniem:
1 | systemctl restart proftpd |
Użytkowników ftp dodajemy poleceniem:
1 | adduser nazwauzytkownika |
dla przykładu ftp1
1 | adduser ftp1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Adding user`ftp1' ... Adding new group `ftp1'(1006)... Adding newuser`ftp1' (1002) with group `ftp1'... Creating home directory`/home/ftp1' ... Copying files from `/etc/skel'... Enter newUNIX password: Retype newUNIX password: passwd:password updated successfully Changing the user information forftp1 Enter the newvalue,orpress ENTER forthe default Full Name[]: Room Number[]: Work Phone[]: Home Phone[]: Other[]: Isthe information correct?[Y/n]Y |
Teraz pozostało się tylko połączyć do naszego serwera wybranym przez nas programem np Filezilla.