Dragon2fly / vpngate-with-proxy

vpn gate client for linux, be able to connect to open vpn server through proxy
GNU General Public License v2.0
249 stars 71 forks source link

Run Open VPN as a different user #43

Open partisansb opened 1 year ago

partisansb commented 1 year ago

Hi Dragon2fly,

Me again, the problem I'm facing now is the script needs to be run as qvpn user to get through the dns on the system... I tried adding command = ['sg qvpn -c openvpn', '--config', ovpn] but it failed.

Where can I preappend sg qvpn -c to the openvpn command? Thanks

Dragon2fly commented 1 year ago

Hi @partisansb,

You could run the whole thing as a different user instead of just only the openvpn process something similar to the command below. That is much easier in my opinion. sudo sg qvpn -c "python vpnproxy_cli.py $arg"

As for the command, I think it should be command = ['sg', 'qvpn', '-c', openvpn', '--config', ovpn]

But since you are chaining 2 commands together, that may not work. You may even need to pass the shell=True to the Popen's parameter which is not security recommended.

So, first, you should try to run the whole thing as a different user first.