Ceci est une ancienne révision du document !
Table des matières
PROFTPD
Installation
Installer les paquetages pré-requis à la compilation de proftpd :
- gcc-4.1.2-44.el5.i386.rpm
- cpp-4.1.2-44.el5.i386.rpm
- glibc-devel-2.5-34.i386.rpm
- glibc-headers-2.5-34.i386.rpm
- libgomp-4.3.2-7.el5.i386.rpm
- kernel-headers-2.6.18-128.el5.i386.rpm
- gcc-c++-4.1.2-44.el5.i386.rpm
- libstdc++-devel-4.1.2-44.el5.i386.rpm
- openssl-devel-0.9.8e-7.el5.i386.rpm
- krb5-devel-1.6.1-31.el5.i386.rpm
- zlib-devel-1.2.3-3.i386.rpm
- e2fsprogs-devel-1.39-20.el5.i386.rpm
- keyutils-libs-devel-1.2-1.el5.i386.rpm
- libselinux-devel-1.33.4-5.1.el5.i386.rpm
- libsepol-devel-1.15.2-1.el5.i386.rpm
- mysql-5.0.45-7.el5.i386.rpm
- perl-DBI-1.52-2.el5.i386.rpm
- mysql-devel-5.0.45-7.el5.i386.rpm
Récupérer l'archive de proftpd sur http://www.proftpd.org
Décompresser l'archive :
cd /root tar xzf proftpd-1.3.2rc4.tar.gz
Installation et compilation de proftpd :
cd /ap01/ftpserver/src/proftpd-1.3.2rc4 ./configure --prefix=/usr/local/proftpd --sysconfdir=/usr/local/proftpd/etc --localstatedir=/ap01/ftpserver/appl/proftpd/var --with-modules=mod_tls:mod_sql:mod_sql_mysql --with-includes=/usr/include/mysql --with-libraries=/usr/lib/mysql make clean make make install
Configuration
Configuration basic
Exemple d'options pour sécuriser et optimiser le serveur FTP
# Permet de cloisonner les utilisateurs dans leur répertoire : DefaultRoot ~ # L'utilisateur FTP n'est pas obligé d'avoir un SHELL valide (telque bash, ksh etc...) pour se connecter RequireValidShell no # Evite les requetes DNS du serveur et permet donc une authentification plus rapide IdentLookups off UseReverseDNS off
Configuration avec SSL
Générer le certificat
Se positionner dans le répertoire de configuration apache :
cd /usr/local/proftpd/etc
Lancer la commande pour générer la clé privée RSA :
openssl genrsa -out server.key 1024
A partir de notre clé privée nous allons créer notre fichier de demande de signature (Certificate Signing Request) :
openssl req -new -key server.key -out request.csr
Auto-signer la clé et créer le certificat :
openssl x509 -req -days 365 -in request.csr -signkey server.key -out server.crt
Configuration
Ajouter les lignes suivantes dans le fichier de configuration /usr/local/proftpd/etc/proftpd.conf :
<IfModule mod_tls.c> TLSEngine on TLSLog /var/ftpd/tls.log # Support both SSLv3 and TLSv1 TLSProtocol SSLv3 TLSv1 # Are clients required to use FTP over TLS when talking to this server? TLSRequired on # Mettre TLSRequired off pour autoriser également les connexions non sécurisées. # Server's certificate TLSRSACertificateFile /usr/local/proftpd/etc/server.crt TLSRSACertificateKeyFile /usr/local/proftpd/etc/server.key # CA the server trusts #TLSCACertificateFile /etc/ftpd/root.cert.pem # Authenticate clients that want to use FTP over TLS? TLSVerifyClient off # Allow SSL/TLS renegotiations when the client requests them, but # do not force the renegotations. Some clients do not support # SSL/TLS renegotiations; when mod_tls forces a renegotiation, these # clients will close the data connection, or there will be a timeout # on an idle data connection. TLSRenegotiate required off </IfModule>
Cette configuration oblige une connexion sécurisée au client.
Tester
Lancer la commande suivante pour tester :
openssl s_client -connect 127.0.0.1:21 -starttls ftp
Pour tester avec un client sous linux :
# lftp 127.0.0.1 lftp 127.0.0.1:~> set ftp:ssl-force true lftp 127.0.0.1:~> user userftp Mot de passe:
Liste des client FTPS et FTPES
- lftp : (disponible dans la plupart des distributions Linux)
- Filezilla : http://filezilla-project.org
- CoreFTP : http://www.coreftp.com
Configuration avec Mysql
SQLEngine on SQLBackend mysql SQLAuthenticate on # Type de cryptage SQLAuthTypes Plaintext Crypt OpenSSL # Auth base Mysql SQLConnectInfo proftpd@mysqlserver proftpd password # Nom des champs (respecter l'ordre) SQLUserInfo users username password uid gid homedir shell # Activation ou non du compte SQLUserWhereClause "LoginAllowed = 'true'" # Evite affichage nom compte systeme SQLMinUserUID 700 SQLMinUserGID 700 # Mise a jour droits pendant la session SQLNegativeCache on
