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

How to disable certificate validation? #946

Closed
seventhsite opened this issue Oct 15, 2021 · 7 comments
Closed

How to disable certificate validation? #946

seventhsite opened this issue Oct 15, 2021 · 7 comments

Comments

@seventhsite
Copy link

seventhsite commented Oct 15, 2021

I used FortiClient with "Client certificate: none" and "Do not warn invalid server certificate". How I can use same thing in openforticlient?
I'm in search for config option.

@DimitriPapadopoulos
Copy link
Collaborator

There's no such option. Get the cert from the server and use the trusted-cert option.

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 15, 2021

You may automate that in a script shell. I don't have an example right now, but it shouldn't be too difficult:

  • Get SSL certificate from server.
  • Calculate the sha256 sum.
  • Feed the sha256sum to openfortivpn with trusted-cert.

If you come up with such a script, I would be happy to add it to the wiki:
https://github.com/adrienverge/openfortivpn/wiki

@fabianonunes
Copy link
Contributor

fabianonunes commented Oct 16, 2021

If you come up with such a script, I would be happy to add it to the wiki:

echo | openssl s_client -connect $ip:$port 2>/dev/null | \
  openssl x509 -outform der | \
  sha256sum | \
  awk '{ print $1 }'

If SNI is enabled on the server, you must use the domain instead of the IP. On older openssl versions, SNI is not enabled by default and you must pass the domain to the -servername option

@seventhsite
Copy link
Author

seventhsite commented Oct 17, 2021

Thank you for answers!

The answer of this script is ...54acd
My config:

host = x.x.x.x
port = yyy
username = seventh
password = mypass
trusted-cert = ...54acd

Then:

root@7thUbuntu:/home/seventh# openfortivpn -v
DEBUG:  openfortivpn 1.12.0
DEBUG:  Loaded config file "/etc/openfortivpn/config".
DEBUG:  Loaded password from config file "/etc/openfortivpn/config"
DEBUG:  Config host = "x.x.x.x"
DEBUG:  Config realm = ""
DEBUG:  Config port = "yyy"
DEBUG:  Config username = "seventh"
DEBUG:  Resolving gateway host ip
DEBUG:  Establishing ssl connection
DEBUG:  server_addr: x.x.x.x
DEBUG:  server_port: yyy
DEBUG:  gateway_addr: x.x.x.x
DEBUG:  gateway_port: yyy
DEBUG:  Setting cipher list to: HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4
DEBUG:  Gateway certificate validation failed.
DEBUG:  Gateway certificate digest found in white list.
INFO:   Connected to gateway.
ERROR:  Could not authenticate to gateway. Please check the password, client certificate, etc.
DEBUG:  HTTP status code 405
INFO:   Closed connection to gateway.
DEBUG:  server_addr: x.x.x.x
DEBUG:  server_port: yyy
DEBUG:  gateway_addr: x.x.x.x
DEBUG:  gateway_port: yyy
DEBUG:  Setting cipher list to: HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4
DEBUG:  Gateway certificate validation failed.
DEBUG:  Gateway certificate digest found in white list.
INFO:   Logged out.

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 17, 2021

@seventhsite It looks like @fabianonunes has solved your initial problem:

DEBUG:  Gateway certificate digest found in white list.

By the way, instead of blindly accepting a server certificate, you could add the certification authority (CA) that signed the server certificate to the system certificate store. See for example:
How do you add a certificate authority (CA) to Ubuntu?

Now you seem to have a new and different problem:

ERROR:  Could not authenticate to gateway. Please check the password, client certificate, etc.

I suggest you close this issue and open a new issue to address this new problem.

@seventhsite
Copy link
Author

Ok, thank you.
#947

@mrbaseman
Copy link
Collaborator

By the way, instead of blindly accepting a server certificate, you could add the certification authority (CA) that signed the server certificate to the system certificate store.

Absolutely. I would like to second this. Another approach would be to run the sequence just once and add the --trusted-cert option to the call (or to the config file).

Don't calculate the sha256sum each time you connect and blindly accept it. If you do this once, from a secure environment, you have obtained a checksum for the certificate, which allows you to verify if future ssl-vpn connections are secure or not.

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

No branches or pull requests

4 participants