LFTP:证书公用名与请求的主机名不匹配

Mau*_*043 9 certificate debian-jessie

使用lftp将文件从我的网络上的两台电脑上传到远程服务器。使用完全相同的代码,这在一个上运行良好,在另一个上不起作用。问题会话和成功会话的成绩单如下所示。我得到的错误是:

证书验证:证书公用名与请求的主机名不匹配

谷歌搜索这个错误找到了一个似乎适用于大多数人的解决方案(使用:)set ssl:verify-certificate no。但是正如您在下面的成绩单中看到的那样,这不适用于“有问题的计算机”。

因为两台计算机都使用相同的 DNS 和路由器来上网,所以我只能假设这可能是由问题计算机上的不同设置引起的。很想得到关于除lftp设置之外的检查内容的建议。

问题电脑

库存 Debian 系统 jessie 8.7: 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux

lftp 正在使用的版本:

$ apt show lftp
Package: lftp
Version: 4.6.0-1+deb8u1
:
:
Run Code Online (Sandbox Code Playgroud)

失败的会话(主机名替换为“示例”):

$ lftp
lftp :~> debug
lftp :~> set
set dns:order "inet6 inet"
set file:charset UTF-8
set ftp:timezone ""
set net:max-retries 2
set net:timeout 30
set ssl:verify-certificate no
set xfer:log yes
set xfer:log-file /tmp/lftp.log
set xfer:max-log-size 1048576
set xfer:max-redirections 10
set xfer:verify-command /usr/share/lftp/verify-file
lftp :~> open example.nl
---- using user `ftp2@example.nl' and password from ~/.netrc
---- Resolving host address...
---- 2 addresses found: (????????, ????????)
lftp ftp2@example.nl@example.nl:~> dir
---- Connecting to example.nl (????????) port 21
**** connect(control_sock): Network is unreachable
---- Closing control socket
---- Connecting to example.nl (????????) port 21
<--- 220 ProFTPD 1.3.5b Server ready.
---> FEAT
<--- 211-Features:
<---  CCC
<---  PBSZ
<---  AUTH TLS
<---  MFF modify;UNIX.group;UNIX.mode;
<---  REST STREAM
<---  MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
<---  LANG en-US.UTF-8*
<---  UTF8
<---  EPRT
<---  EPSV
<---  MDTM
<---  SSCN
<---  TVFS
<---  MFMT
<---  SIZE
<---  PROT
<--- 211 End
---> AUTH TLS
<--- 234 AUTH TLS successful
---> LANG
Certificate: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.zxcs.nl
 Issued by: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
WARNING: Certificate verification: Not trusted
WARNING: Certificate verification: certificate common name doesn't match requested host name ‘example.nl’
<--- 200 Using default language en_US.UTF-8
---> OPTS UTF8 ON
<--- 200 UTF8 set to on
---> OPTS MLST modify;perm;size;type;UNIX.group;UNIX.mode;UNIX.owner;
<--- 200 OPTS MLST modify;perm;size;type;UNIX.group;UNIX.mode;UNIX.owner;
---> USER ftp2@example.nl
<--- 331 Password required for ftp2@example.nl
---> PASS XXXX
<--- 230 User ftp2@example.nl logged in
---> PWD
<--- 257 "/" is the current directory
---> PBSZ 0
<--- 200 PBSZ 0 successful
---> PROT P
<--- 200 Protection set to Private
---> PASV
<--- 227 Entering Passive Mode (????????).
---- Connecting data socket to (????????) port 35302
---- Data connection established
---> LIST
<--- 150 Opening ASCII mode data connection for file list
Certificate: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.zxcs.nl
 Issued by: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
WARNING: Certificate verification: Not trusted
WARNING: Certificate verification: certificate common name doesn't match requested host name ‘ example.nl’
<--- 425 Unable to build data connection: Operation not permitted
---- Closing data socket
<--- 450 LIST: Operation not permitted
**** extra server response
ls: Fatal error: max-retries exceeded
lftp ftp2@example.nl@example.nl:/>
Run Code Online (Sandbox Code Playgroud)

另一台电脑

基于 Debian 的 Raspbian jessie 8.0:4.4.38+ #938 Thu Dec 15 15:17:54 GMT 2016 armv6l GNU/Linux 在这台计算机上,我有完全相同的版本lftp

$ apt show lftp
Package: lftp
Version: 4.6.0-1+deb8u1
:
:
Run Code Online (Sandbox Code Playgroud)

但是现在lftp会话没有问题:

$ lftp
lftp :~> debug
lftp :~> set
set dns:order "inet6 inet"
set file:charset UTF-8
set ftp:timezone ""
set net:max-retries 2
set net:timeout 30
set ssl:verify-certificate no
set xfer:log yes
set xfer:log-file /tmp/lftp.log
set xfer:max-log-size 1048576
set xfer:max-redirections 10
set xfer:verify-command /usr/share/lftp/verify-file
lftp :~> open example.nl
---- using user `ftp2@example.nl' and password from ~/.netrc
---- Resolving host address...
---- 2 addresses found: ????????, ????????
lftp ftp2@example.nl@example.nl:~> dir
---- Connecting to example.nl (????????) port 21
**** connect(control_sock): Network is unreachable
---- Closing control socket
---- Connecting to example.nl (????????) port 21
<--- 220 ProFTPD 1.3.5b Server ready.
---> FEAT
<--- 211-Features:
<---  CCC
<---  PBSZ
<---  AUTH TLS
<---  MFF modify;UNIX.group;UNIX.mode;
<---  REST STREAM
<---  MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
<---  LANG en-US.UTF-8*
<---  UTF8
<---  EPRT
<---  EPSV
<---  MDTM
<---  SSCN
<---  TVFS
<---  MFMT
<---  SIZE
<---  PROT
<--- 211 End
---> AUTH TLS
<--- 234 AUTH TLS successful
---> LANG
Certificate: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.zxcs.nl
 Issued by: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
WARNING: Certificate verification: Not trusted
WARNING: Certificate verification: certificate common name doesn't match requested host name ‘example.nl’
<--- 200 Using default language en_US.UTF-8
---> OPTS UTF8 ON
<--- 200 UTF8 set to on
---> OPTS MLST modify;perm;size;type;UNIX.group;UNIX.mode;UNIX.owner;
<--- 200 OPTS MLST modify;perm;size;type;UNIX.group;UNIX.mode;UNIX.owner;
---> USER ftp2@example.nl
<--- 331 Password required for ftp2@example.nl
---> PASS XXXX
<--- 230 User ftp2@example.nl logged in
---> PWD
<--- 257 "/" is the current directory
---> PBSZ 0
<--- 200 PBSZ 0 successful
---> PROT P
<--- 200 Protection set to Private
---> PASV
<--- 227 Entering Passive Mode (????????).
---- Connecting data socket to (????????) port 35035
---- Data connection established
---> LIST
<--- 150 Opening ASCII mode data connection for file list
Certificate: OU=Domain Control Validated,OU=PositiveSSL Wildcard,CN=*.zxcs.nl
 Issued by: C=GB,ST=Greater Manchester,L=Salford,O=COMODO CA Limited,CN=COMODO RSA Domain Validation Secure Server CA
WARNING: Certificate verification: Not trusted
WARNING: Certificate verification: certificate common name doesn't match requested host name ‘example.nl’
---- Got EOF on data connection
---- Closing data socket
drwxr-xr-x  11 ftp      ftp          4096 Feb 11 16:56 .
drwxr-xr-x  11 ftp      ftp          4096 Feb 11 16:56 ..
drwxr-xr-x   2 ftp      ftp          4096 Dec 29 10:48 01.home
lftp ftp2@example.nl@example.nl:/>
Run Code Online (Sandbox Code Playgroud)

小智 6

正如评论所说, ssl:check-hostname 将起作用。它可以通过在 lftp shell 中设置

set ssl:check-hostname no
Run Code Online (Sandbox Code Playgroud)


小智 0

该问题可能是由过时的 SSL 库引起的。
另外,如果它是ProFTPd服务器,则在其配置中会添加提示TLSOptions NoSessionReuseRequired
你看过ftp服务器的日志吗?