[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

proftpd + inetd + ssl/tls и другие вопросы.



Выяснил что plain ftp передает пароль в открытом виде в момент авторизации.

Есть https://ru.wikipedia.org/wiki/FTPS в разных версиях / режимах работы.

Не могу вьехать что делать что бы proftpd + inetd работал безопасно.

В общем на сервере выполнил:

  $ sudo proftpd-gencert

/etc/proftpd/proftpd.conf::

  Include /etc/proftpd/tls.conf

/etc/proftpd/tls.conf::

  TLSEngine                               on
  TLSLog                                  /var/log/proftpd/tls.log
  TLSProtocol                             SSLv23

  TLSRSACertificateFile                   /etc/ssl/certs/proftpd.crt
  TLSRSACertificateKeyFile                /etc/ssl/private/proftpd.key
  TLSOptions                      NoCertRequest EnableDiags
  TLSVerifyClient                         off
  TLSRequired                             on

Пробую:

  bash# lftp ftp://user@vps
  Password:
  lftp user@vps:~> ls
  ls: Fatal error: Certificate verification: Not trusted
  lftp user@vps:~> exit

  bash# lftp -e 'set ssl:verify-certificate no' ftp://user@vps
  Password:
  lftp user@vps:~> ls
  drwxr-xr-x   5 user     user         4096 Nov 22 18:04 devel
  drwxr-xr-x   2 user     user         4096 Oct 10 16:14 tmp

Обычная команда `ftp` из `/usr/bin/netkit-ftp` не поддерживает SSL:

  bash# ftp -n vps
  Connected to vps.
  220 ProFTPD 1.3.5 Server (Debian) [149.202.132.30]
  ftp> ls
  550 SSL/TLS required on the control channel
  ftp: bind: Address already in use
  ftp> user user
  ^C
  421 Service not available, remote server has closed connection
  ftp> exit

`curl` тоже работает::

  $ curl --ftp-ssl -k --netrc ftp://user@vps/.bashrc

Нужно ли в inetd.conf использовать ftps или ftp:

  ftp    stream  tcp nowait  root /usr/sbin/tcpd /usr/sbin/proftpd                                                                       
  ftps    stream  tcp nowait  root /usr/sbin/tcpd /usr/sbin/proftpd

У меня на ftps ошибки:

  bash# curl --ftp-ssl -k --netrc ftps://user@vps/.bashrc
  curl: (35) gnutls_handshake() failed: An unexpected TLS packet was received.

  bash# lftp ftps://user@vps
  lftp user@vps:~> ls
  ls: Fatal error: gnutls_handshake: An unexpected TLS packet was received.

Такое ощущение что для ftps:// используется другой протокол, чем на ftp:// с
включенным SSL.

Как правильно запретить общение открытым текстом и настроить SSL/TLS в proftpd?

Далее вопрос как в Debian сделать публичный ключ proftpd доверенным на
клиентах?

Я пробовал как:

  $ sudo mkdir /usr/share/ca-certificates/vps
  $ sudo scp user@vps:/etc/ssl/certs/proftpd.crt /usr/share/ca-certificates/vps/proftpd.crt
  $ sudo dpkg-reconfigure ca-certificates
  $ sudo update-ca-certificates --fresh

Но curl и lftp игнорируют Дебиановские соглашения о сертификатах. Или я
неверно готовлю. При том proftpd.crt виден в конце:

  /etc/ssl/certs/ca-certificates.crt

Также если кормить напрямую:

  bash# curl -v --ftp-ssl --cacert /usr/share/ca-certificates/vps/proftpd.crt --netrc ftp://user@vps/.bashrc
  *   Trying 149.202.132.30...
  * Connected to vps (149.202.132.30) port 21 (#0)
  < 220 ProFTPD 1.3.5 Server (Debian) [149.202.132.30]
  > AUTH SSL
  < 234 AUTH SSL successful
  * found 1 certificates in /usr/share/ca-certificates/vps/proftpd.crt
  * found 728 certificates in /etc/ssl/certs
  * ALPN, offering http/1.1
  * SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
  * server certificate verification failed. CAfile: /usr/share/ca-certificates/vps/proftpd.crt CRLfile: none
  * Closing connection 0
  curl: (60) server certificate verification failed. CAfile: /usr/share/ca-certificates/vps/proftpd.crt CRLfile: none
  More details here: http://curl.haxx.se/docs/sslcerts.html

  curl performs SSL certificate verification by default, using a "bundle"
   of Certificate Authority (CA) public keys (CA certs). If the default
   bundle file isn't adequate, you can specify an alternate file
   using the --cacert option.
  If this HTTPS server uses a certificate signed by a CA represented in
   the bundle, the certificate verification probably failed due to a
   problem with the certificate (it might be expired, or the name might
   not match the domain name in the URL).
  If you'd like to turn off curl's verification of the certificate, use
   the -k (or --insecure) option.

-- 
Best regards!


Reply to: