docker-vpn
docker-vpn copied to clipboard
Add custom dockerCmd and vpnCmd based on the configuration file
Currently, you cannot have extra arguments for the cmd. One example would be the --servercert to allow self-signed certificates for the vpn connection.
I'm willing to provide the changes, if someone could review and merge it.
vpnCmd should allow as many arguments as you give on the command line. But in the case of --servercert I imagine you'd also need a --mount flag passed to the dockerCmd in order to make the certificate available in the container.
My guess is it would be easiest to detect the argument or arguments you need to special case and then add the appropriate flags to dockerCmd and vpnCmd. Something like that is done here:
https://github.com/ethack/docker-vpn/blob/940c738b215c06e248f9ddeacd316cfad6eb58e9/vpn.sh#L42-L50
I'd be happy to review and merge.
I was more thinking about the following use case: https://github.com/dlenski/openconnect/issues/60#issuecomment-380568132, when you simply know already the certificate fingerprint and want to setup your connection. I was wondering if that should go directly into the .profile file or somewhere else. For example:
cat ~/.vpn/myvpn.profile
...
OC_EXTRA_COMMANDS=--servercert sha256:my-fingerprint-here
But you are right, the config file could solve those issues, if required. Maybe an update to the docs would sufface.
I'll take another look and open a PR if I see some possibility of improvement on the code or docs for that scenario.
Thanks for you response.