-
Notifications
You must be signed in to change notification settings - Fork 116
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
Certificate is not working for TLS with self-signed .cer #16
Comments
I recently also met this problem, the root cause should lie in how this plugin handles |
Already fixed in the upstream shadowsocks/v2ray-plugin#128 @madeye Please make a new release? |
The root cause was well-explained in the pull request. Although I think it should be fixed on the caller side (e.g. Android app / WinGUI)... Maybe we should obsolete JSON, and start to use YAML. |
JSON supports line break properly (have you tried |
FYI, https://www.gun.io/blog/multi-line-strings-in-json . |
I agree with @Mygod , it's OK to use Also when I tested self-signed certificate using the build from this But when I tried the exactly same settings on Android, it never succeeds. |
I don't know which version of plugin and which implementation of ss are you testing. Have you tried a JSON validator before use it? |
@lixin9311 JSON comes from JavaScript, and in JavaScript, |
sry, my bad, I mean it should be: {
"var" : "first line
second line"
} you mean: {
"var" : "first line\nsecond line"
} |
The root cause should be this: After user inputs the PEM format certificate, the following code removes all the v2ray-plugin-android/app/src/main/java/com/github/shadowsocks/plugin/v2ray/ConfigFragment.kt#L66
In addition, the following code also prevents from passing in the original PEM format certificate through plugin options. shadowsocks-android/plugin/src/main/java/com/github/shadowsocks/plugin/PluginOptions.kt#L41
In order to fix this we need to come up with a solution to safely pass PEM format certificate. I have thought about using Base64 to encode/decode the certificate, what do you guys think? |
We cannot allow control characters. We could try removing the begin end lines and add it later. |
The problem is not only about the begin end lines, removing all the |
Are you sure about that? I read RFC and I think it should be fine. |
Here is the code related to
|
Removing Is it possible to allow control characters? Or just escape them like replacing BTW does |
Okay, as @lixin9311 says in shadowsocks/v2ray-plugin#128, the PR should fix the bug in CLI. Seems v1.3.1 has included upstream changes, however it's still not working, server-side still get Also v1.3.1 doesn't include config GUI, only has a single config input. |
Mine does show the configuration dialogue properly, have you tried switching the system language to English? @ccloli |
I submitted #22 to fix this issue. And another PR is also necessary to fix this: Could you help review and merge that fix? |
@jonkerfan I downloaded the debug apk file of your PR from Circle CI, seems it works fine (the config UI is also working). On server-side it says |
What do you think ? @madeye |
Apply for a certificate from Let’s Encrypt, then v2ray-plugin from F-droid works fine. Detail: |
@jonkerfan What version of android does plugin under? It doesn't work on android 10, seems ok when start but failed when I try to connect, the pc plugin works well. |
@ODtian |
@jonkerfan Oh, it seems author 've already fix the problems which were mentioned in exist issues, in version 1.3.0, and I also try 1.3.1, but clearly none of them work on my device. |
Same issue here on Mi 9 with Android 11 at Nov. 2021. get "remote error: tls: bad certificate" on server side with this plugin. windows & linux client works good. The discussion last for 2 years. do you guys have plan to fix this? I currently have to use websocket+http to get v2ray-plugin work on android. BTW, why do we have to pass a CA? it could be optional, in my case I definitely trust my server and it's cert, as I signed it with a root CA created by me. I also installed it into android's trust CA storage. still not work. it could be phone's bug. so could we make supplying a CA from client optional? In GFW Trojan android client, install the CA certificate also not working. but trojan client can simply turn off verifing server cert with client CA functionality. ss android v2ray plugin could do same to get rid of this issue. Sounds like v2ray plugin were trying to use root CA as a authentication way from server side, as the error is come up from server side! This is no point. because root CA normally is public. it is only used to verify the server is trustworthy in practice history of CA certificate. |
I encountered the same problem and found a workaround. My server is self-registered using acme.sh. The public key file is generated as domain.cer. The content of domain.cer looks similar to the following: The issue only occurs when I hide my VPS IP using cloudflare and try to access the VPS directly by its IP address. So I guess this issue is caused by inconsistency between the IP address and the domain name. |
it's a mess, I'm having the same issue. For me I tried self-signed and zerossl certificates, they both failed , and I had the same bad certificate error, whic is so annoying. |
workaround: copy content betwean |
If the server side using a self-signed certificate, and the certificate using an invalid host name, the client cannot connect to the server, as the server side logs
remote error: tls: bad certificate
.For example, I configured a server on
1.2.3.4
, and self-signed a certificate and its host name isexample.com
(but I'm not holding it, so accessing the domain directly won't be my server). Then on the client side, I set the server to1.2.3.4
, and specifiedHostname
in plugin options asexample.com
, and paste the base64-encoded certificate content. Then I started the connection, but it's not working, server-side saysremote error: tls: bad certificate
.The same configuration is working on Windows by importing the
.cer
file to trusted root certificate, and working on iOS by ignoring SSL error.The text was updated successfully, but these errors were encountered: