Документация по ОС FreeBSD Четверг, 25.04.2024, 09:14
Приветствую Вас Гость | RSS
Меню сайта

Категории каталога
Apache [58]
DNS [25]
FTP [27]
Mail [74]
Samba [24]
Squid [46]
SSH [23]
VPN [35]
РРР [20]
Net [173]

Главная » Статьи » Сеть » FTP

Устанавливаем ФТП сервер ProFTPD c TLS (SSL) шифрованием [2010]
Сегодня занимался установкой ФТП сервера, пришлось чуток посидеть в интернете, ибо кое что забылось. Чтоб больше такого не было, решил сделать заметку. Пригодится.

Приступаем к установке. Я использую ФТП сервер ProFTPD, просто потому, что он мне нравится за его простоту и надежность. Не забываем перед установкой обновить порты.

/home/user/#cd /usr/ports/ftp/proftpd
/usr/ports/ftp/proftpd/#make install clean

Я раскажу, как поставить без поддержки базы данных MySQL, ибо у меня пользователи системные, и вешать их еще в базу данных не интересно. После выполнения вышеуказанных комманд, Вы увидите следующее:



Выбираете необходимые Вам параметры, и жмете ОК. Как только Вы увидите нечто, похожее на это, значит у Вас все правильно установилось.

===> SECURITY REPORT:
      This port has installed the following files which may act as network
      servers and may therefore pose a remote security risk to the system.
/usr/local/sbin/proftpd

      This port has installed the following startup scripts which may cause
      these network services to be started at boot time.
/usr/local/etc/rc.d/proftpd

      If there are vulnerabilities in these programs there may be a security
      risk to the system. FreeBSD makes no guarantee about the security of
      ports included in the Ports Collection. Please type 'make deinstall'
      to deinstall the port if this is a concern.

      For more information, and contact details about the security
      status of this software, see the following webpage:
http://www.proftpd.org/
===>  Cleaning for proftpd-1.3.3a
/usr/ports/ftp/proftpd/#

На этом установка оконченна. Теперь начинаем создавать конфигурационный файл. По умолчанию, дефолтный конфигурационный файл находится в директории

/etc/#ll /usr/local/etc/ | grep proftpd
-rw-r--r--  1 root  wheel   2478 Aug 31 10:44 proftpd.conf
-rw-r--r--  1 root  wheel   2478 Aug 31 09:56 proftpd.conf.sample

Внимательно его читаем, и рисуем конфиг "под себя". Вот, что получилось у меня.

/usr/local/etc/#cat proftpd.conf | grep -v '#' | grep -v ^$
ServerName                      "FTP Server"
ServerType                      standalone
DefaultServer                   on
ScoreboardFile                  /var/run/proftpd.scoreboard
ServerIdent                     off
RequireValidShell               off
Port                            21
Umask                           022
DeferWelcome                    off
MaxInstances                    50
MaxLoginAttempts                5       "Try again later"
CommandBufferSize       512
User                            nobody
Group                           nogroup
DefaultRoot ~
AllowOverwrite          on
<Limit SITE_CHMOD>
        AllowAll
</Limit>
LogFormat         default "%h [%a] %l %u %t \"%r\" %s %f %b"
LogFormat         auth    "%v [%P] %h [%a] %t \"%r\" %s"
LogFormat         read    "%v [%P] %h [%a] %t \"%r\" %s %f %b"
LogFormat         write   "%h [%a] %l %u %t \"%r\" %s %f %b"
TransferLog /var/log/proftpd/proftpd-tranfer.log
SystemLog /var/log/proftpd/proftpd-error.log
ExtendedLog /var/log/proftpd/proftpd-extended.log
UseReverseDNS                   off
AllowForeignAddress             off
AllowLogSymlinks                off
DenyFilter                      \*.*/
TimeoutIdle             600
TimeoutLogin            30
TimeoutNoTransfer       60000
TimeoutSession          60000
TimeoutStalled          36000
RLimitCPU               1200 1200
RLimitMemory            256M 256M
RLimitOpenFiles         1024 1024
<IfModule mod_tls.c>
        TLSEngine on
        TLSLog /var/log/proftpd/proftpd-tls.log
        TLSProtocol SSLv3
        TLSOptions NoCertRequest
        TLSRSACertificateFile /usr/local/etc/proftpd_ssl/proftpd.cert.pem
        TLSRSACertificateKeyFile /usr/local/etc/proftpd_ssl/proftpd.key.pem
        TLSVerifyClient on
        TLSRequired off
</IfModule>

И последнее, осталось подключить SSL для того, чтоб усложнить жизнь тем, кто захочет "заснифить" пароль и создать все необходимые каталоги:

/usr/local/etc/#mkdir /var/log/proftpd
/usr/local/etc/#touch /var/log/proftpd/proftpd-tranfer.log
/usr/local/etc/#touch /var/log/proftpd/proftpd-error.log
/usr/local/etc/#touch /var/log/proftpd/proftpd-extended.log
/usr/local/etc/#touch /var/log/proftpd/proftpd-tls.log
/usr/local/etc/#mkdir proftpd_ssl
/usr/local/etc/#cd proftpd_ssl/

И теперь создаем сертификаты.

/usr/local/etc/proftpd_ssl/#openssl req -new -x509 -days 365 -nodes -out /usr/local/etc/proftpd_ssl/proftpd.cert.pem -keyout /usr/local/etc/proftpd_ssl/proftpd.key.pem
Generating a 1024 bit RSA private key
..................++++++
....++++++
writing new private key to '/usr/local/etc/proftpd_ssl/proftpd.key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:UA
State or Province Name (full name) [Some-State]:Kyiv Oblast
Locality Name (eg, city) []:Kyiv
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Firma
Organizational Unit Name (eg, section) []:Otdel
Common Name (eg, YOUR name) []:your_server_name
Email Address []:your@email.com
/usr/local/etc/proftpd_ssl/#ll
total 4
-rw-r--r--  1 root  wheel  1375 Aug 31 10:17 proftpd.cert.pem
-rw-r--r--  1 root  wheel   887 Aug 31 10:17 proftpd.key.pem

Теперь, необходимо это все запуститьи проверить.

/usr/local/etc/proftpd_ssl/#cat /etc/rc.conf | grep proftpd
proftpd_enable="YES"
/usr/local/etc/proftpd_ssl/#/usr/local/etc/rc.d/proftpd start
Starting proftpd.
/usr/local/etc/proftpd_ssl/#ps aux | grep proftpd
nobody 43160  0.0  0.1  7788  4756  ??  Ss   10:19AM   0:00.00 proftpd: (accepting connections) (proftpd)
root   43162  0.0  0.0  3496  1264   0  S+   10:19AM   0:00.00 grep proftpd
/usr/local/etc/proftpd_ssl/#tail -f /var/log/proftpd/proftpd-
proftpd-error.log     proftpd-extended.log  proftpd-tls.log       proftpd-tranfer.log
/usr/local/etc/proftpd_ssl/#tail -f /var/log/proftpd/proftpd-error.log
Aug 31 10:19:44 testhost.com proftpd[43160] 195.78.5.1: ProFTPD 1.3.3a (maint) (built Tue Aug 31 2010 09:55:20 EEST) standalone mode STARTUP
^C
/usr/local/etc/#tail -f /var/log/proftpd/proftpd-tls.log
Aug 31 10:44:34 mod_tls/2.4.1[43359]: using default OpenSSL verification locations (see $SSL_CERT_DIR environment variable)
^C
/usr/local/etc/#

Вот и все. При подключении по ФТП связь между Вами и сервером шифруется. В случае, если у Вас что то не получилось, читайте логи или задавайте вопросы.


Источник: http://zmej.org.ua/node/71
Категория: FTP | Добавил: oleg (02.10.2010) | Автор: Zmej
Просмотров: 2173 | Рейтинг: 0.0/0 |
Всего комментариев: 0
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]
Форма входа

Beastie

Друзья сайта

Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
links
pdf unlocker

Copyright MyCorp © 2024