gpt4 book ai didi

php - FTPS 问题 : "A TLS packet with unexpected length was received."

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:45:58 27 4
gpt4 key购买 nike

我正在尝试连接到 FTPS 服务器(不是 SFTP)。我从 linux 系统连接,所以我尝试了 lftp、ftp-ssl,甚至使用 php 的 ftp_ssl_connect,但它们都不起作用。 (我已经能够使用上述所有或至少部分方法连接到其他 FTPS 服务器)。

我遇到的最具描述性的错误来自 lftp,调试一直到 11:

$ lftplftp :~> open -u my-username ftps://server.netPassword: lftp my-username@server.net:~> debug 99999999999lftp my-username@server.net:~> lsFileCopy(0x717bf0) enters state INITIALFileCopy(0x717bf0) enters state DO_COPY---- dns cache hit---- Connecting to server.net (IP ADDRESS) port 990GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_RSA_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_RSA_CAMELLIA_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_RSA_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_RSA_CAMELLIA_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_RSA_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_DSS_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_DSS_CAMELLIA_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_DSS_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_DSS_CAMELLIA_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_DSS_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: DHE_DSS_ARCFOUR_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: DHE_PSK_SHA_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: DHE_PSK_SHA_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: DHE_PSK_SHA_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: DHE_PSK_SHA_ARCFOUR_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_RSA_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_RSA_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_RSA_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_DSS_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_DSS_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_DSS_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_CAMELLIA_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_CAMELLIA_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_ARCFOUR_SHA1GNUTLS: HSK[acfbb0]: Keeping ciphersuite: RSA_ARCFOUR_MD5GNUTLS: HSK[acfbb0]: Removing ciphersuite: PSK_SHA_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: PSK_SHA_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: PSK_SHA_3DES_EDE_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: PSK_SHA_ARCFOUR_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_AES_128_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_AES_256_CBC_SHA1GNUTLS: HSK[acfbb0]: Removing ciphersuite: SRP_SHA_3DES_EDE_CBC_SHA1GNUTLS: EXT[acfbb0]: Sending extension CERT_TYPEGNUTLS: HSK[acfbb0]: CLIENT HELLO was send [88 bytes]GNUTLS: REC[acfbb0]: Sending Packet[0] Handshake(22) with length: 88GNUTLS: ASSERT: gnutls_cipher.c:205GNUTLS: REC[acfbb0]: Sent Packet[1] Handshake(22) with length: 93GNUTLS: ASSERT: gnutls_buffers.c:638GNUTLS: ASSERT: gnutls_record.c:909GNUTLS: ASSERT: gnutls_buffers.c:1152GNUTLS: ASSERT: gnutls_handshake.c:1032GNUTLS: ASSERT: gnutls_handshake.c:2331**** gnutls_handshake: A TLS packet with unexpected length was received.---- Closing control socketls: Fatal error: gnutls_handshake: A TLS packet with unexpected length was received.

使用 PHP 我得到以下结果:

Warning: ftp_login(): SSL/TLS handshake failed in /home/user/ftp.php on line 7Warning: ftp_login(): SSL enabled start the negotiation in /home/user/ftp.php on line 7cannot login

第 6 行:$connect = ftp_ssl_connect("server.net") or die("cannot connect");

第 7 行:$result = ftp_login($connect,"my-username","my-password") or die("cannot login");

使用 ftp-ssl:

$ ftp-ssl -d -z debug server.netSSL_DEBUG_FLAG onConnected to server.net.220-Security Notice220-All activities may be monitored.  System use indicates consent to220 monitoring.  Information may be given to law enforcement.ftp: setsockopt: Bad file descriptorName (server.net:user): my-username---> AUTH SSL234 SSL enabled start the negotiationwrite to 0x68c190 (102 bytes => 102 (66))0000 - 80 64 01 03 01 00 4b 00-00 00 10 00 00 39 00 00   .d....K......9..0010 - 38 00 00 35 00 00 16 00-00 13 00 00 0a 07 00 c0   8..5............0020 - 00 00 33 00 00 32 00 00-2f 03 00 80 00 00 05 00   ..3..2../.......0030 - 00 04 01 00 80 00 00 15-00 00 12 00 00 09 06 00   ................0040 - 40 00 00 14 00 00 11 00-00 08 00 00 06 04 00 80   @...............0050 - 00 00 03 02 00 80 e9 28-25 ed ea 2d e4 d2 f2 25   .......(%..-...%0060 - 80 e1 2e f1 c3 71                                 .....qread from 0x68c190 (7 bytes => -1 (FFFFFFFFFFFFFFFF))ftp: SSL_connect error error:00000000:lib(0):func(0):reason(0): Connection reset by peer

如果这篇文章很长,我很抱歉,但我已经谷歌搜索了好几天都没有看到任何答案。只是希望我遗漏的一些调试信息对某人有用。

最佳答案

遇到相同错误时在 debian 上:

---- Closing control socket
ls: Fatal error: gnutls_handshake: An unexpected TLS packet was received.

首先我必须升级 debian 上的 ssl-cert 包:

$ sudo apt-get upgrade ssl-cert

然后我不得不使用 open ftp://not open ftps://:

lftp :~> open ftp://xxx.xxx.xxx.xxx:21
ltfp :~> user foo bar

然后错误变为:

lftp foo@xxx.xxx.xxx.xxxx:~> ls

ls: Fatal error: Certificate verification: Not trusted (XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX)

此选项删除了错误并允许访问:

lftp foo@xxx.xxx.xxx.xxxx:~> set ssl:verify-certificate no

关于php - FTPS 问题 : "A TLS packet with unexpected length was received.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3345438/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com