I use openconnect
in Ubuntu 16.04 terminally, when I want to run it, I need to enter three phases:
- "yes/no"
- "username"
- "password"
How can I bypass above phases using openconnect
in a line (e.g. using openconnect
options)?
Are there any options for that such as the following line?
sudo openconnect <server-name> --user=<'username'> --pass=<'password'>
I used openconnect --help
and found out a way to filling username, but I haven't any idea to filling password and SSL verification.
If you type
man openconnect
in a terminal you will get a manual page describing usage.Relevant sections:
Additionally, you may need to disable certificate warnings:
Or you could add the certificate to a file.
All this can be combined:
This works for me:
To skip the certificate check, The
--no-cert-check
parameter was removed in new versions. You can use--servercert
instead.--servercert sha256:sdflkdsjflsdjkfds
I was able to automate both sudo password, VPN user, VPN password and secondary challenge using the following command (tested on mac):
As I read the solutions, finally this is the script that is working for me:
When you run the above command without SERVERCERT(because you don't have it), it gives an error to you that contains the SERVERCERT inside it, something like:
Server SSL certificate didn't match: pin-sha256:76v/J0dQR44xdeBCxKUq/Slvtikc+0xTyRdjaZk/5fA=
and that's it, the string started with pin-sha256:...(the whole of it, include pin-sha256 itself) is your SERVERCERTSo? the final result in this case for example is:
You can try this very easy to use shell script: https://github.com/sorinipate/vpn-up-for-openconnect
From the project's description:
"
"
--no-cert-check
is deprecated from the command argument by openconnect (my version: OpenConnect version v7.08-3ubuntu0.18.04.2)