Skip to content

Add client parameter -certfile to provide certificate to trust#65

Open
mporsch wants to merge 1 commit intoflexera-public:masterfrom
mporsch:self-signed-explicit
Open

Add client parameter -certfile to provide certificate to trust#65
mporsch wants to merge 1 commit intoflexera-public:masterfrom
mporsch:self-signed-explicit

Conversation

@mporsch
Copy link
Contributor

@mporsch mporsch commented Feb 10, 2022

When reading up on the TLS option InsecureSkipVerify (set via command line argument -insecure) I found lots of hints that this is more insecure than users may expect and should not be used in production code.
An alternative approach is to provide a certificate (chain) to trust. This is e.g. explained in https://forfuncsake.github.io/post/2017/08/trust-extra-ca-cert-in-go-app/

Generally asking; is there interest to integrate this?
Alternatively the user can place the certificate in the OS' global certificate store (e.g. /etc/ssl/certificates/). But it might be undesirable to put system-wide trust onto some self-signed certificate the user provided for one application.

I have not yet looked into test run results, but the initial prototype test works as expected against a self-signed server certificate:

# wstunnel cli -tunnel wss://sensor:sensor@192.168.100.233:8080 -token 02:A2:5A:01:00:1A -server http://127.0.0.1
INFO[02-10|14:34:58] WStunnel starting                        pkg=WStuncli
INFO[02-10|14:34:58] Setting WS keep-alive                    timeout=30s
INFO[02-10|14:34:58] wstunnel dev - 2022-02-10 12:00:00 - devel pkg=WStuncli
INFO[02-10|14:34:58] Dispatching to external server(s)        pkg=WStuncli server=http://127.0.0.1 regexp=nil
INFO[02-10|14:34:58] WS   Opening                             pkg=WStuncli url=wss://192.168.100.233:8080/_tunnel token=02:A2...
EROR[02-10|14:34:58] Error opening connection                 pkg=WStuncli err="x509: certificate signed by unknown authority" info=
# wstunnel cli -tunnel wss://sensor:sensor@192.168.100.233:8080 -token 02:A2:5A:01:00:1A -server http://127.0.0.1 --insecure
INFO[02-10|14:35:03] WStunnel starting                        pkg=WStuncli
INFO[02-10|14:35:03] Setting WS keep-alive                    timeout=30s
INFO[02-10|14:35:03] wstunnel dev - 2022-02-10 12:00:00 - devel pkg=WStuncli
INFO[02-10|14:35:03] Accepting unverified SSL certs from local HTTPS servers pkg=WStuncli
INFO[02-10|14:35:03] Dispatching to external server(s)        pkg=WStuncli server=http://127.0.0.1 regexp=nil
INFO[02-10|14:35:03] WS   Opening                             pkg=WStuncli url=wss://192.168.100.233:8080/_tunnel token=02:A2...
INFO[02-10|14:35:03] WS   ready                               pkg=WStuncli ws=0x197a000 server=http://127.0.0.1
INFO[02-10|14:35:03] pinger starting                          pkg=WStuncli ws=0x197a000
# wstunnel cli -tunnel wss://sensor:sensor@192.168.100.233:8080 -token 02:A2:5A:01:00:1A -server http://127.0.0.1 -certfile /tmp/cert.pem 
INFO[02-10|14:35:07] WStunnel starting                        pkg=WStuncli
INFO[02-10|14:35:07] Setting WS keep-alive                    timeout=30s
INFO[02-10|14:35:07] wstunnel dev - 2022-02-10 12:00:00 - devel pkg=WStuncli
INFO[02-10|14:35:07] Dispatching to external server(s)        pkg=WStuncli server=http://127.0.0.1 regexp=nil
INFO[02-10|14:35:07] WS   Opening                             pkg=WStuncli url=wss://192.168.100.233:8080/_tunnel token=02:A2...
INFO[02-10|14:35:07] WS   ready                               pkg=WStuncli ws=0x198c000 server=http://127.0.0.1
INFO[02-10|14:35:07] pinger starting                          pkg=WStuncli ws=0x198c000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant