FTPS does not work
- 主要语言
- Python
- 星标
- 46.6k
- 派生
- 1.9k
- 平均合并
- 10 天 16 小时
- 30 天内合并 PR
- 5
描述
### Describe the bug
FTPS does not work.
Using `curl ftps://[::1]:3990/` fails with `curl: (35) TLS connect error: error:0A00010B:SSL routines::wrong version number`.
`curl ftp://[::1]:3990/` returns `curl: (67) Access denied: 550`.
Plain FTP works fine: `curl ftp://[::1]:3921/`
### To Reproduce
```sh
XDG_CONFIG_HOME=/tmp/cppdb python copyparty-sfx.py --ftp 3921 --ftps 3990 -v /tmp/cpp:/:A
curl ftps://[::1]:3990/
```
Adding `--insecure` to curl does not change the behavior.
### Expected behavior
Using self-signed certificates:
`curl ftps://[::1]:3990/ --insecure` should show the same directory listing as `curl https://[::1]:3923/ --insecure` and `curl ftp://[::1]:3921/`.
(the `--https` option needs to be added to copypartys cmdline to make this test work. this was left out during tests to find a minimal reproducable example)
Using a certificate signed by a trusted CA won't need the `--insecure/-k` flag for curl:
`curl ftps://hostname.example.com:3990/`
### Server details (if you're NOT using docker/podman)
remove the ones that are not relevant:
* **server OS / version:** NixOS 25.05
* **what copyparty did you grab:** sfx
* **how you're running it:** in a terminal
* run copyparty with `--version` and grab the last 3 lines (they start with `copyparty`, `CPython`, `sqlite`) and paste them below this line:
```
copyparty v1.19.7 "usernames" (2025-08-28)
CPython v3.12.11 on Linux64 [GCC 14.3.0]
sqlite 3.48.0*1 | jinja 2.11.3 | pyftpd 1.5.10 | tftp 0.4.0
```
* **copyparty arguments and/or config-file:** see above
Note: pyopenssl is available to copyparty but is not shown in log by `--deps`.
### Client details
```
$ curl --version
curl 8.14.1 (x86_64-pc-linux-gnu) libcurl/8.14.1 quictls/3.3.0 zlib/1.3.1 brotli/1.1.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.65.0 ngtcp2/1.12.0 nghttp3/1.9.0
Release-Date: 2025-06-04
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
```
### Additional context
`curl ftps://[::1]:3990/ -vvvv`
```log
16:19:47.217885 [0-x] == Info: [MULTI] [INIT] added to multi, mid=1, running=1, total=2
16:19:47.217999 [0-x] == Info: [MULTI] [INIT] -> [SETUP]
16:19:47.218069 [0-x] == Info: [MULTI] [SETUP] -> [CONNECT]
16:19:47.218149 [0-x] == Info: [READ] client_reset, clear readers
16:19:47.218238 [0-x] == Info: [FTP] [STOP] setup connection -> 0
16:19:47.218320 [0-0] == Info: [MULTI] [CONNECT] [CPOOL] added connection 0. The cache now contains 1 members
16:19:47.218463 [0-0] == Info: [SETUP] added
16:19:47.218529 [0-0] == Info: [MULTI] [CONNECT] -> [CONNECTING]
16:19:47.218617 [0-0] == Info: [HAPPY-EYEBALLS] created ipv6 (timeout 300000ms)
16:19:47.218717 [0-0] == Info: [HAPPY-EYEBALLS] ipv6 starting (timeout=300000ms)
16:19:47.218832 [0-0] == Info: Trying [::1]:3990...
16:19:47.218902 [0-0] == Info: [TCP] cf_socket_open() -> 0, fd=4
16:19:47.219044 [0-0] == Info: [TCP] local address ::1 port 60456...
16:19:47.219131 [0-0] == Info: [HAPPY-EYEBALLS] ipv6 connect -> 0, connected=0
16:19:47.219220 [0-0] == Info: [SETUP] Curl_conn_connect(block=0) -> 0, done=0
16:19:47.219307 [0-0] == Info: [TCP] adjust_pollset, !connected, POLLOUT fd=4
16:19:47.219407 [0-0] == Info: [HAPPY-EYEBALLS] adjust_pollset -> 1 socks
16:19:47.219505 [0-0] == Info: [MULTI] [CONNECTING] multi_wait pollset[fd=4 OUT], timeouts=0
16:19:47.219633 [0-0] == Info: [TCP] connected
16:19:47.219696 [0-0] == Info: [HAPPY-EYEBALLS] ipv6 connect -> 0, connected=1
16:19:47.219791 [0-0] == Info: [HAPPY-EYEBALLS] Connected to ::1 (::1) port 3990
16:19:47.219889 [0-0] == Info: [SSL] cf_connect()
16:19:47.219949 [0-0] == Info: [SSL] ossl_connect, step1
16:19:47.221096 [0-0] == Info: [SSLS] find peer slot for ::1:3990:IMPL-quictls/3.3.0:G among 25 slots
16:19:47.221219 [0-0] == Info: [SSLS] peer not found for ::1:3990:IMPL-quictls/3.3.0:G
16:19:47.221327 [0-0] == Info: [SSLS] no cached session for ::1:3990:IMPL-quictls/3.3.0:G
16:19:47.221439 [0-0] == Info: [SSL] ossl_connect, step2
16:19:47.221615 [0-0] => Send SSL data, 5 bytes (0x5)
0000: .....
16:19:47.221721 [0-0] == Info: TLSv1.3 (OUT), TLS handshake, Client hello (1):
16:19:47.221838 [0-0] => Send SSL data, 512 bytes (0x200)
0000: ........a..b9.*>.......PS?Q.l..`..L..^ ..2U.R..o"XP.t.^.5i..tdQ;
0040: ..o.U...>.......,.0.........+./...$.(.k.#.'.g.....9.....3.....=.
0080: <.5./.....u...........................................1.....0...
00c0: ..............................................+........-.....3.&
0100: .$... .B5.....o.[...../`..3w...P..#hfw..........................
0140: ................................................................
0180: ................................................................
01c0: ................................................................
16:19:47.222885 [0-0] == Info: [TCP] send(len=517) -> 517, err=0
16:19:47.222960 [0-0] == Info: [SSL] ossl_bio_cf_out_write(len=517) -> 517, err=0
16:19:47.223071 [0-0] == Info: [TCP] recv(len=5) -> 5, err=0
16:19:47.223158 [0-0] == Info: [SSL] ossl_bio_cf_in_read(len=5) -> 5, err=0
16:19:47.223259 [0-0] == Info: [SSL] ossl_populate_x509_store, path=none, blob=0
16:19:47.233035 [0-0] <= Recv SSL data, 5 bytes (0x5)
0000: 220 p
16:19:47.233121 [0-0] == Info: [SSL] SSL_connect() -> err=-1, detail=1
16:19:47.233215 [0-0] == Info: TLS connect error: error:0A00010B:SSL routines::wrong version number
16:19:47.233348 [0-0] == Info: [SSL] cf_connect() -> 35, done=0
16:19:47.233423 [0-0] == Info: [SETUP] Curl_conn_connect(block=0) -> 35, done=0
16:19:47.233522 [0-0] == Info: [SETUP] Curl_conn_connect(), filter returned 35
16:19:47.233632 [0-0] == Info: [MULTI] [CONNECTING] multi_done: status: 35 prem: 1 done: 0
16:19:47.233757 [0-x] == Info: [MULTI] [CONNECTING] multi_done_locked, in use=0
16:19:47.233860 [0-0] == Info: [MULTI] [CONNECTING] multi_done, not reusing connection=0, forbid=0, close=1, premature=1, conn_multiplex=0
16:19:47.234068 [0-0] == Info: closing connection #0
16:19:47.234298 [0-0] == Info: [MULTI] [CONNECTING] -> [COMPLETED]
16:19:47.234403 [0-0] == Info: [MULTI] [COMPLETED] -> [MSGSENT]
16:19:47.234508 [0-0] == Info: [MULTI] [COMPLETED] removed from multi, mid=1, running=0, total=1
curl: (35) TLS connect error: error:0A00010B:SSL routines::wrong version number
```
---
copyparty log:
```log
--- cut ---
16:19:47.219 ::1:60456 [] FTP session opened (connect)
16:19:47.234 ::1:60456 [] FTP session closed (disconnect).
```
贡献指南
评估
这个 Issue 还没有评估数据。