Activer TLS pour proftpd?

Tags: #<Tag:0x00007f63f14accf0>

Bonjour à toutes et tous,

(Les anciens topics ici parlant de proftpd/tls datent de 2016 et ne semble pas correspondre à mon cas).

J’ai installé proftpd sur une Debian 12.4 à jour hébergée chez Hetzener.

J’ai suivi pas à pas le tuto de Malekal et de Ionos pour cela (merci à eux).

Mais lorsque je me connecte avec Filezilla, j’ai l’erreur suivante :

Statut : Serveur non sécurisé, celui‐ci ne prend pas en charge FTP sur TLS.

Le transfert de fichier fonctionne bien, mais pas en mode TLS donc.

Voici la configuration détaillée que j’ai appliquée pour activer TLS avec proftpd :

sudo apt install openssl 
sudo mkdir /etc/proftpd/ssl
sudo openssl req -new -x509 -keyout /etc/proftpd/ssl/proftpd.key.pem -days 365 -nodes -out /etc/proftpd/ssl/proftpd.cert.pem
sudo chmod 600 /etc/proftpd/ssl/proftpd.*
sudo nano /etc/proftpd/conf.d/tls.conf
sudo service proftpd restart 
sudo netstat -lpn|grep proftpd

Voici mon fichier de configuration TLS pour proftpd /etc/proftpd/conf.d/tls.conf :

<IfModule mod_tls.c>
[::]
TLSEngine                  on
TLSLog                     /var/log/proftpd/tls.log
TLSProtocol                TLSv1 TLSv1.1 TLSv1.2
TLSOptions                 NoCertRequest AllowClientRenegotiations
TLSRSACertificateFile      /etc/proftpd/ssl/proftpd.cert.pem
TLSRSACertificateKeyFile   /etc/proftpd/ssl/proftpd.key.pem
TLSVerifyClient            off
TLSRequired                on
RequireValidShell          no
TLSOptions                 NoSessionReuseRequired
</IfModule>

Le fichier /var/log/proftpd/tls.log n’existe pas :

$ ls -al /var/log/proftpd/
total 20
drwxr-xr-x 2 root root 4096 Jan 7 10:44 .
drwxr-xr-x 7 root root 4096 Jan 7 10:12 …
-rw-r----- 1 root root 0 Jan 7 10:12 controls.log
-rw-r----- 1 root root 4620 Jan 7 12:45 proftpd.log
-rw-r–r-- 1 root root 1088 Jan 7 11:54 xferlog

Le service FTP fonctionne :

$ sudo netstat -lpn|grep proftpd
tcp6 0 0 :::21 :::* LISTEN 2774/proftpd: (acce

Je suis allé voir la documentation officielle ProFTPD: FTP and SSL/TLS
et les tests suivants n’aboutissent pas :

$ sudo openssl s_client -connect 127.0.0.1:21 -starttls ftp
CONNECTED(00000003)

(Reste bloqué sur cette ligne, pas de retour au prompt sans ctrl+c même après plusieurs minutes d’attente)

 $ sudo ssldump -d -k /etc/proftpd/ssl/proftpd.key.pem -i lo port 21

(Reste bloqué sur cette ligne, pas de retour au prompt sans ctrl+c même après plusieurs minutes d’attente)

Auriez-vous des pistes ? Merci !

EDIT : pffff, suffit de se connecter via le port 22 plutôt que 21 et ça marche. Désolé pour le bruit, je passe en résolu.

Donc en sftp ce qui est différent du ftps …

1 J'aime

Diantre !
Donc, ça devrait fonctionner sur le port 21 avec TLS actif ? Ma configuration à donc bien un problème ?

EDIT :
FTPS (FTP sur SSL/TLS), et SFTP (FTP sur SSH)
Effectivement, ok en sftp mais ko en ftps…

Des pistes ? Merci.

reste en SFTP plutôt que le FTPS, car le second nécessite une série de ports à ouvrir, alors que le premier ne nécessite qu’un seul port.

Ah ok, faut que je regarde côté ip tables alors. Sinon tant pis, je resterais avec sftp. Bizarre que les tutos ne parlent pas de ça :wink:

EDIT : mmm, pas de iptables ou ufw d’installés sur ma VM. Bizarre.

Bonjour à toutes et tous,

J’ai continué mes investigations.
J’ai avancé d’un pas, premier point, il fallait que j’installe le module suivant :

sudo apt install proftpd-mod-crypto

Mais il me reste visiblement des problèmes de syntaxe à régler dans mes fichiers de configuration :

$ sudo service proftpd status
[sudo] password for chre:
● proftpd.service - ProFTPD FTP Server
     Loaded: loaded (/lib/systemd/system/proftpd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2024-01-16 20:35:08 UTC; 19h ago
       Docs: man:proftpd(8)
    Process: 120159 ExecStartPre=/usr/sbin/proftpd --configtest -c $CONFIG_FILE $OPTIONS (code=exited, status=0/SUCCESS)
    Process: 120160 ExecStart=/usr/sbin/proftpd -c $CONFIG_FILE $OPTIONS (code=exited, status=0/SUCCESS)
   Main PID: 120162 (proftpd)
      Tasks: 1 (limit: 9245)
     Memory: 5.4M
        CPU: 1.697s
     CGroup: /system.slice/proftpd.service
             └─120162 "proftpd: (accepting connections)"

Jan 16 20:35:08 chre-debian-ash-1 systemd[1]: Starting proftpd.service - ProFTPD FTP Server...
**Jan 16 20:35:08 chre-debian-ash-1 proftpd[120159]: Checking syntax of configuration file**
Jan 16 20:35:08 chre-debian-ash-1 systemd[1]: proftpd.service: Can't open PID file /run/proftpd.pid (yet?) after start:>
Jan 16 20:35:08 chre-debian-ash-1 systemd[1]: Started proftpd.service - ProFTPD FTP Server.

Je continue de chercher :slight_smile: