Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chacha20 一直在客户端报错 #61

Closed
sbwtw opened this issue Aug 3, 2017 · 23 comments
Closed

chacha20 一直在客户端报错 #61

sbwtw opened this issue Aug 3, 2017 · 23 comments
Assignees
Labels

Comments

@sbwtw
Copy link

sbwtw commented Aug 3, 2017

[2017-08-03][16:19:54][ERROR] Failed to handle client: Invalid Socks5 version
[2017-08-03][16:19:54][ERROR] Failed to handle client: Connection refused (os error 111)
[2017-08-03][16:19:54][ERROR] Failed to connect remote server, Error { repr: Os { code: 111, message: "Connection refused" } }

换 aes-256-cfb 则没有任何问题

@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 3, 2017

  1. 密码是一样的么?
  2. 使用的是哪个后端

@sbwtw
Copy link
Author

sbwtw commented Aug 3, 2017

@zonyitoo 对,只换了加密方式。
后端是指 libsodium 这个库吗? server 和 local 都链接了同版本的 libsodium.so.18 (1.0.13-1, Archlinux)

@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 3, 2017

是指连接的shadowsocks server使用的实现

@sbwtw
Copy link
Author

sbwtw commented Aug 3, 2017

server/client 都是这个项目编译出来的
没有试过别的 server + rust client,刚手机上用 Shadowsocks 连着试了一下发现也报错,ssl library 什么的错,看起来可能是 server 那边出错的?

@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 3, 2017

cc @quininer Please check this issue about chacha20 decryption. chacha20 decryptor failed to decrypt packets that is encrypted by itself.

@quininer
Copy link
Contributor

quininer commented Aug 3, 2017

似乎是因爲 shadowsocks 的 chacha20 系列需要自定義 ic。目前 sodiumoxide 不支持 _xor_ic,我在早前經已提了一個 PR

@zonyitoo zonyitoo added the bug label Aug 3, 2017
@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 3, 2017

那至少这个项目里的sslocal和ssserver的包是可以互相解密的吧

@quininer
Copy link
Contributor

quininer commented Aug 3, 2017

如果 client/server 都是 shadowsocks-rust 的話,不應該會有問題。

@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 3, 2017

server/client 都是这个项目编译出来的

@sbwtw 的描述,是同一个

@quininer
Copy link
Contributor

quininer commented Aug 3, 2017

@zonyitoo 我試了一下,都是 shadowsocks-rust 的話,可以正常使用。

@sbwtw 可以提供更多日誌嗎?

@sbwtw
Copy link
Author

sbwtw commented Aug 3, 2017

server 的日志:

$ sudo /usr/bin/ssserver -c 1.json
[2017-08-03][18:48:39][INFO] ShadowSocks 1.5.2
[2017-08-03][18:48:39][INFO] ShadowSocks TCP Listening on [::]:xxxx
[2017-08-03][18:48:59][INFO] Connecting to remote www.google.com:443
[2017-08-03][18:48:59][ERROR] Invalid address type 85
[2017-08-03][18:48:59][ERROR] Failed to handle client (xxxx): failed to decode Address, may be wrong method or key
[2017-08-03][18:49:00][INFO] Connecting to remote clients4.google.com:443
[2017-08-03][18:49:00][ERROR] Invalid address type 85
[2017-08-03][18:49:00][ERROR] Failed to handle client (xxxxx): failed to decode Address, may be wrong method or key
[2017-08-03][18:49:00][INFO] Connecting to remote www.google.com:443
[2017-08-03][18:49:01][ERROR] Invalid address type 85
[2017-08-03][18:49:01][ERROR] Failed to handle client (xxxxx): failed to decode Address, may be wrong method or key
[2017-08-03][18:49:06][INFO] Connecting to remote www.google.com:443
[2017-08-03][18:49:06][ERROR] Invalid address type 85
[2017-08-03][18:49:06][ERROR] Failed to handle client (xxxxxx): failed to decode Address, may be wrong method or key

client 的日志:

➜  ~ ./.sslocal -c 1.json                                                     ~
[2017-08-03][18:48:55][INFO] ShadowSocks 1.5.2
[2017-08-03][18:48:55][INFO] ShadowSocks TCP Listening on [::]:xxxx
[2017-08-03][18:48:58][INFO] CONNECT www.google.com:443
[2017-08-03][18:48:59][INFO] CONNECT www.google.com:443
[2017-08-03][18:49:00][INFO] CONNECT clients4.google.com:443
[2017-08-03][18:49:06][INFO] CONNECT www.google.com:443
[2017-08-03][18:49:36][INFO] CONNECT www.google.com:443
[2017-08-03][18:49:37][ERROR] Failed to connect remote server, Error { repr: Os
{ code: 111, message: "Connection refused" } }
[2017-08-03][18:49:37][ERROR] Failed to handle client: Connection refused (os er
ror 111)
[2017-08-03][18:49:42][INFO] CONNECT www.google.com:443
[2017-08-03][18:49:42][ERROR] Failed to connect remote server, Error { repr: Os
{ code: 111, message: "Connection refused" } }
[2017-08-03][18:49:42][ERROR] Failed to handle client: Connection refused (os er
ror 111)

chrome 的报错信息:

This site can’t provide a secure connection

www.google.com uses an unsupported protocol.
ERR_SSL_VERSION_OR_CIPHER_MISMATCH

Unsupported protocol
The client and server don't support a common SSL protocol version or cipher suite.

同样的配置仅仅改了加密方式到 aes-256-cfb 之后是正常的,所以不是密码错误的问题

@quininer
Copy link
Contributor

quininer commented Aug 3, 2017

確實是 ic 的原因導致的。現在的 StreamCipher 並不是真的 Stream ,不滿足 Ex(M) + Ex(M2) = Ex(M + M2),導致解密失敗。

在本地會因爲 IO 太快測試不出來…

@wongsyrone
Copy link

这个你可以切换成你自己写的sodium binding啊,在 https://download.libsodium.org/doc/bindings_for_other_languages/ 都被官方认可了。这样就不用纠结另外一个库什么时候添加 *_xor_ic 了

https://github.com/zonyitoo/libsodium-sys

@zonyitoo
Copy link
Collaborator

名字在crates.io上被人占了 :(

@quininer
Copy link
Contributor

我建議刪除其他 cipher,只支持 ring 的 aead。反正我用不到

@zonyitoo
Copy link
Collaborator

只为了backward compatibility. 我也用不到

zonyitoo added a commit that referenced this issue Aug 30, 2017
@zonyitoo
Copy link
Collaborator

zonyitoo commented Aug 30, 2017

@sbwtw 可以试一下最新的commit,试一下看看chacha20能不能用?
最新的BUILD shadowsocks-1.6.2-release.x86_64-unknown-linux-musl.tar.gz

@sbwtw
Copy link
Author

sbwtw commented Aug 30, 2017

@zonyitoo
thread 'main' panicked at 'Cipher type ChaCha20 does not supported by OpenSSLCrypt yet', src/crypto/openbssl.rs:31

zonyitoo added a commit that referenced this issue Aug 30, 2017
@zonyitoo
Copy link
Collaborator

shadowsocks-latest-release.x86_64-unknown-linux-musl.tar.gz
忘了删掉一个#[feature(...)]

zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
@sbwtw
Copy link
Author

sbwtw commented Aug 30, 2017

很奇怪,server 和 client 都没有报错,访问的地址也是正常的,就是浏览器这边一直连接失败。
在手机上换别的 client 连接和之前一样是 ssl 相关的报错

zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
@zonyitoo
Copy link
Collaborator

zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
zonyitoo added a commit that referenced this issue Aug 30, 2017
Removed sodiumoxide, use self contained libsodium-ffi
@sbwtw
Copy link
Author

sbwtw commented Aug 30, 2017

测试了最新提交,android shadowsocks 客户端和 shadowsocks-rust 的客户端都没有问题了

@zonyitoo
Copy link
Collaborator

Fixed. Will be released with v1.6.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants