relecture
This commit is contained in:
parent
7eadbaac38
commit
c22ff6cc12
138
HowtoProFTPD.md
138
HowtoProFTPD.md
|
@ -1,35 +1,37 @@
|
||||||
**Cette page a été importée automatiquement de notre ancien wiki mais n'a pas encore été révisée.**
|
---
|
||||||
|
categories: web
|
||||||
|
title: Howto ProFTPD
|
||||||
|
...
|
||||||
|
|
||||||
# Howto ProFTPD
|
* Documentation : <http://www.proftpd.org/docs/>
|
||||||
|
|
||||||
|
[ProFTPD](http://www.proftpd.org/) est un serveur [FTP](https://fr.wikipedia.org/wiki/File_Transfer_Protocol) libre. Il est particulièrement configurable grâce à des modules. Il permet notamment de facilement restreinte un compte dans un répertoire donné (_chroot_) ou d'utiliser les protocoles FTPS (FTP over SSL/TLS) et SFTP/SCP (issus de SSH).
|
||||||
|
|
||||||
<http://www.proftpd.org/docs/>
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
# aptitude install proftpd
|
# apt install proftpd
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Le fichier de configuration principal est _/etc/proftpd/proftpd.conf_.
|
Le fichier de configuration principal est `/etc/proftpd/proftpd.conf`, voici les directives que nous conseillons de changer en général :
|
||||||
Voici les directives à changer :
|
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
UseIPv6 off
|
ServerName "Foo FTP Server"
|
||||||
ServerName "XXX FTP Server"
|
PassivePorts 60000 61000
|
||||||
PassivePorts 60000 61000
|
MaxInstances 50
|
||||||
MaxInstances 50
|
MaxClients 40
|
||||||
MaxClients 40
|
MaxClientsPerHost 20
|
||||||
MaxClientsPerHost 20
|
Umask 137 027
|
||||||
Umask 137 027
|
|
||||||
UseReverseDNS off
|
UseReverseDNS off
|
||||||
IdentLookups off
|
IdentLookups off
|
||||||
DefaultRoot ~
|
DefaultRoot ~
|
||||||
RequireValidShell off
|
RequireValidShell off
|
||||||
UseFtpUsers off
|
UseFtpUsers off
|
||||||
ServerIdent on "FTP Server Ready"
|
ServerIdent on "FTP Server Ready"
|
||||||
AccessGrantMsg "Hey, bienvenue %u sur le serveur FTP XXX.evolix.net !"
|
AccessGrantMsg "Hey, bienvenue %u sur le serveur FTP example.com !"
|
||||||
# Allow RESUME (REST command)
|
# Allow RESUME (REST command)
|
||||||
AllowStoreRestart on
|
AllowStoreRestart on
|
||||||
|
|
||||||
|
@ -40,24 +42,35 @@ AllowStoreRestart on
|
||||||
</Limit>
|
</Limit>
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Les utilisateurs pouvant utilisant le FTP doivent être dans le groupe _ftpusers_ (à créer !).
|
Avec cette configuration proposée, un utilisateur doit être dans le groupe `ftpusers` (à créer) pour pouvoir utiliser le FTP.
|
||||||
|
|
||||||
## Création de comptes virtuels
|
Si l'IPv6 n'est pas fonctionnel sur votre serveur :
|
||||||
|
|
||||||
À ajouter dans _/etc/proftpd/proftpd.conf_ :
|
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
AuthOrder mod_auth_file.c
|
UseIPv6 off
|
||||||
AuthUserFile /etc/proftpd/vpasswd
|
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
La commande complète :
|
|
||||||
|
## Comptes virtuels
|
||||||
|
|
||||||
|
ProFTPD peut utiliser des comptes Unix ou des comptes virtuels définis dans SQL/LDAP ou simplement un fichier.
|
||||||
|
|
||||||
|
On détaille ici l'utilisation de comptes avec un simple fichier `/etc/proftpd/vpasswd`.
|
||||||
|
|
||||||
|
Il faut ajouter dans _/etc/proftpd/proftpd.conf_ :
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
# ftpasswd --file=/etc/proftpd/vpasswd --name=FTP_user --home=/home/example/FTP_user --shell=/bin/false --uid=1664 --gid=1664 --passwd
|
AuthOrder mod_auth_file.c
|
||||||
|
AuthUserFile /etc/proftpd/vpasswd
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Préciser les UID et GID du compte UNIX propriétaire du répertoire dans lequel est le $HOME du compte virtuel créé.
|
On peut alors ajouter un compte FTP avec la commande suivante :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
# ftpasswd --file=/etc/proftpd/vpasswd --name=foo --home=/home/example/foo --shell=/bin/false --uid=1664 --gid=1664 --passwd
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Si l'on veut que le compte FTP soit une sorte de sous-compte d'un compte existant restreint dans un répertoire, il faut préciser les UID et GID du compte UNIX propriétaire du répertoire dans lequel est le $HOME du compte virtuel créé.
|
||||||
|
|
||||||
Pour modifier le mot de passe d'un compte existant :
|
Pour modifier le mot de passe d'un compte existant :
|
||||||
|
|
||||||
|
@ -65,7 +78,8 @@ Pour modifier le mot de passe d'un compte existant :
|
||||||
# ftpasswd --file /etc/proftpd/vpasswd --name=FTP_user --change-password --passwd
|
# ftpasswd --file /etc/proftpd/vpasswd --name=FTP_user --change-password --passwd
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### Divers
|
|
||||||
|
## Divers
|
||||||
|
|
||||||
Pour limiter les uploads de fichiers de taille supérieure à 50 Mo :
|
Pour limiter les uploads de fichiers de taille supérieure à 50 Mo :
|
||||||
|
|
||||||
|
@ -73,7 +87,7 @@ Pour limiter les uploads de fichiers de taille supérieure à 50 Mo :
|
||||||
MaxStoreFileSize 50 Mb
|
MaxStoreFileSize 50 Mb
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
### Changer droits defaut (umask)
|
Pour changer les droits par défaut (umask) :
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
<Directory /path/to/dir>
|
<Directory /path/to/dir>
|
||||||
|
@ -81,6 +95,7 @@ MaxStoreFileSize 50 Mb
|
||||||
</Directory>
|
</Directory>
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
|
||||||
## Quota
|
## Quota
|
||||||
|
|
||||||
Pour activer les quotas spécifiquement à ProFTPD avec gestion via fichiers :
|
Pour activer les quotas spécifiquement à ProFTPD avec gestion via fichiers :
|
||||||
|
@ -113,7 +128,7 @@ Imaginons que vous positionnez le quota alors que l'utilisateur a déjà 170 Go,
|
||||||
# ftpquota --update-record --type=tally --bytes-upload=170 --units=Gb --name=foo --quota-type=user
|
# ftpquota --update-record --type=tally --bytes-upload=170 --units=Gb --name=foo --quota-type=user
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Vous pouvez lister les données de quota sur le serveur ainsi :
|
On peut lister les données de quota sur le serveur ainsi :
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
# ftpquota --show-records --type=tally
|
# ftpquota --show-records --type=tally
|
||||||
|
@ -159,7 +174,7 @@ ftp> quote SITE QUOTA
|
||||||
200 Veuillez contacter ftpmaster@example.com si ces données sont inexactes
|
200 Veuillez contacter ftpmaster@example.com si ces données sont inexactes
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
Enfin, vous pouvez réinitialiser un compteur (tous les jours par exemple) :
|
Enfin, on peut réinitialiser un compteur (tous les jours par exemple) :
|
||||||
|
|
||||||
~~~
|
~~~
|
||||||
# ftpquota --update-record --type=tally --name=foo --quota-type=user
|
# ftpquota --update-record --type=tally --name=foo --quota-type=user
|
||||||
|
@ -171,3 +186,62 @@ Ou même effacer toutes les données de quota d'un utilisateur :
|
||||||
# ftpquota --delete-record --type=limit --name=foo --quota-type=user
|
# ftpquota --delete-record --type=limit --name=foo --quota-type=user
|
||||||
# ftpquota --delete-record --type=tally --name=foo --quota-type=user
|
# ftpquota --delete-record --type=tally --name=foo --quota-type=user
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
|
||||||
|
## FTPS
|
||||||
|
|
||||||
|
On peut configurer FTP over SSL/TLS ainsi :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
LoadModule mod_tls.c
|
||||||
|
|
||||||
|
<IfModule mod_tls.c>
|
||||||
|
TLSEngine on
|
||||||
|
TLSLog /var/log/proftpd/tls.log
|
||||||
|
TLSProtocol TLSv1
|
||||||
|
|
||||||
|
TLSRSACertificateFile /etc/ssl/certs/ftp.example.com.crt
|
||||||
|
TLSRSACertificateKeyFile /etc/ssl/private/ftp.example.com.key
|
||||||
|
TLSCACertificateFile /etc/ssl/certs/ftp.example.com_ca.pem
|
||||||
|
|
||||||
|
#TLSOptions AllowClientRenegotiations
|
||||||
|
|
||||||
|
TLSOptions AllowPerUser
|
||||||
|
TLSVerifyClient off
|
||||||
|
<IfUser ecorner>
|
||||||
|
TLSVerifyClient on
|
||||||
|
</IfUser>
|
||||||
|
|
||||||
|
TLSRequired off
|
||||||
|
|
||||||
|
TLSRenegotiate required off
|
||||||
|
TLSOptions NoSessionReuseRequired
|
||||||
|
</IfModule>
|
||||||
|
~~~
|
||||||
|
|
||||||
|
|
||||||
|
### SFTP
|
||||||
|
|
||||||
|
On peut configurer FTP over SSH ainsi :
|
||||||
|
|
||||||
|
~~~
|
||||||
|
LoadModule mod_tls.c
|
||||||
|
|
||||||
|
<IfModule mod_sftp.c>
|
||||||
|
SFTPEngine on
|
||||||
|
Port 222
|
||||||
|
DefaultRoot ~
|
||||||
|
|
||||||
|
SFTPLog /var/log/proftpd/sftp.log
|
||||||
|
|
||||||
|
SFTPAuthMethods password publickey
|
||||||
|
SFTPHostKey /etc/ssh/ssh_host_dsa_key
|
||||||
|
SFTPHostKey /etc/ssh/ssh_host_ecdsa_key
|
||||||
|
SFTPHostKey /etc/ssh/ssh_host_rsa_key
|
||||||
|
|
||||||
|
SFTPAuthorizedUserKeys file:/etc/sftp/authorized_keys/%u
|
||||||
|
|
||||||
|
SFTPCompression delayed
|
||||||
|
</IfModule>
|
||||||
|
~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue