Proftpd + SSL
Устанавливаем Proftpd.
Install Proftpd.
# pkg install proftpd
Редактируем конфиг Proftpd.
Edit config Proftpd.
# vi /usr/local/etc/proftpd.conf
Расскоментируем параметр DefaultRoot ~, чтобы пользователь не смог выходить за пределы своей домашней директории.
Uncomment parameter DefaultRoot ~, It is necessary that the user can not go beyond its home directory.
И добавим в конец файла параметр PassivePorts 60000 65000.
Add at the end of config this parameter PassivePorts 60000 65000.
Добавляем наш сервис в автозагрузку.
Add service to autostart.
# echo 'proftpd_enable="YES"' >> /etc/rc.conf
Открываем файл /etc/hosts и добавляем туда наш хост.
Open file /etc/hosts and add your host.
# vi /etc/hosts
192.168.1.11 f11rn
Создаем директорию ftp.
Create directory ftp.
# mkdir /usr/ftp
Чтобы создать пользователя и группу используем утилиту ftpasswd.
To create user and group use ftpasswd.
Устанавливаем пакет perl5 чтобы устранить ошибку - env: perl: No such file or directory, которая возникает когда вы закускаете утилиту ftpasswd.
Install packet perl5. It’s need to resolve an issue - env: perl: No such file or directory, Which appears then you run ftpasswd.
Создаем директорию для файлов пользователя и переходим туда.
Create directory for user and group files. And go there.
# mkdir /usr/local/etc/proftpd/ug
# cd /usr/local/etc/proftpd/ug
Создаем пользователя и группу.
Create user and group.
# ftpasswd --name ftpuser --file /usr/local/etc/proftpd/ug/ftpd.passwd --home /usr/ftp --uid 1004 --gid 1004 --shell /sbin/nologin --passwd
Появится приглашение на ввод пароля.
# ftpasswd --group --name ftpgroup --gid 1004 --member ftpuser
Идем в конфиг proftpd и добавляем в конец следующие параметры:
Go to config proftpd and add at the end of file this parameters:
ServerIdent Off
RequireValidShell off
AuthUserFile /usr/local/etc/proftpd/ug/ftpd.passwd
AuthGroupFile /usr/local/etc/proftpd/ug/ftpd.group
Стартуем proftpd.
Start proftpd.
# service proftpd start
Создаем директорию для SSL сертификатов и переходим туда.
Create directory for SSL certificates and go there.
# mkdir /usr/local/etc/proftpd/ssl
# cd /usr/local/etc/proftpd/ssl
Создаем сертификаты.
Create certificates.
# openssl req -new -x509 -days 365 -nodes -out /usr/local/etc/proftpd/ssl/proftpd.cert.pem -keyout /usr/local/etc/proftpd/ssl/profptd.key.pem
Добавляем следующий код в конец конфига proftpd:
Add this code at the end of config proftpd:
<IfModule mod_dso.c>
LoadModule mod_tls.c
</IfModule>
<IfModule mod_tls.c>
TLSEngine on
TLSLog /var/log/proftpd-tls.log
TLSProtocol SSLv3 TLSv1
TLSRequired off
TLSECCertificateFile /usr/local/etc/proftpd/ssl/proftpd.cert.pem
TLSECCertificateKeyFile /usr/local/etc/proftpd/ssl/proftpd.key.pem
TLSVerifyClient off
TLSRenegotiate none
</IfModule>
Создаем лог файл.
Create log file.
# touch /var/log/proftpd-tls.log
Перезапускаем proftpd.
Restart proftpd.
# service proftpd restart