Сохранить сертификат для использования с lftp

10804
Greg C

Как я могу сохранить сертификат для использования с lftp?

Данный сертификат не принимается lftp при загрузке с сервера. Я старался

openssl s_client -connect :21 -showcerts

от Как сохранить удаленный сертификат сервера SSL локально в виде файла, но это возвращает

CONNECTED(00000003) 3074045628:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:766:

no peer certificate available

Я соединяюсь с

lftp -p 21 -u

и получить

ls: Fatal error: Certificate verification: Not trusted

5

3 ответа на вопрос

8
marcwho

I think the problem here is that the FTP server uses plain FTP but supports explicit SSL/TLS. So to follow the protocol, the client must connect to the FTP server and invoke encryption through the AUTH command. (AUTH command is sent in plain text)

So to answer your question, I don't think it is possible to show the certificate. Unless you can somehow send the AUTH command to the FTP server.

Edit: To display certs do the following:

openssl s_client -connect x.x.x.x:21 -starttls ftp

2
user35800

Вы уверены, что эта конечная точка правильно защищена с помощью SSL? Из сообщения об ошибке вы видите, что сервер не предоставляет ssl? Также порт 21 в основном используется для обычного FTP, а не для FTP или SFTP.

Это то, что я получаю, когда запускаю команду на обычном FTP-сервере.

openssl s_client -connect xxx.yyy.zzz.www:21 -showcerts CONNECTED(00000003) 140165093090976:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:749: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 7 bytes and written 225 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE 

Ошибка lftp может быть из-за неправильной конфигурации lftp, где вам требуется ssl. Вы можете попробовать следующее:

set ftp:ssl-force false 

В любом случае вы также можете попробовать подключиться с помощью

set ssl:verify-certificate no 

Хотя это приемлемо только для тестирования и с тестовыми учетными записями (чтобы не пропускать учетные данные)

2
ingomueller.net

It seems like lftp is not configured correctly on many systems, which makes it unable to verify server certificates. Maybe this is the underlying cause for your problem.

The web is full of suggestions to fix this by disabling certificate verification or encryption altogether. This is unsecure as it allows man-in-the-middle attacks to pass unnoticed.

The better solution is to configure certificate verification correctly, which is easy, fortunately. To do so, add the following line to /etc/lftp.conf (or alternatively ~/.lftp/rc):

set ssl:ca-file "/etc/ssl/certs/ca-certificates.crt" 

ca-certificates.crt is a file that contains all CA certificates of the system. The location used above is the one from Ubuntu and may vary on different systems. To generate or update the file, run update-ca-certificates:

sudo update-ca-certificates 

If your system does not have this command, you can create one manually like this:

cat /etc/ssl/certs/*.pem | sudo tee /etc/ssl/certs/ca-certificates.crt > /dev/null 

Похожие вопросы