How do I get lftp to use SSL/TLS security mechanism from the command line?

后端 未结 8 2323
深忆病人
深忆病人 2021-02-15 13:11

I\'m trying to log into an ftps site. I\'ve tried giving the login creds at the command line (and putting set parameters in ~/.lftprc, the

8条回答
  •  时光取名叫无心
    2021-02-15 13:46

    It seems like lftp is not configured correctly on many systems, which makes it unable to verify server certificates (producing Fatal error: Certificate verification: Not trusted).

    The web (and answers in this post) 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, or ~/.config/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
    

提交回复
热议问题