jamesmcm / vopono

Run applications through VPN tunnels with temporary network namespaces
GNU General Public License v3.0
802 stars 44 forks source link

OpenVPN auth override and auth.txt perms #265

Open ciphersimian opened 4 months ago

ciphersimian commented 4 months ago

Two problems:

  1. vopono overrides the OpenVPN auth to a hardcoded value for some reason: --auth-user-pass /home/.../.config/vopono/proton/openvpn/auth.txt precluding the use of auth-user-pass in the config
  2. It keeps changing the permissions of that file and every time it starts up it prints the message:
    1712524542.815358 40 WARNING: file '/home/.../.config/vopono/proton/openvpn/auth.txt' is group or others accessible

but it did that itself... if I change the file to 600:

$ chmod 600 /home/.../.config/vopono/proton/openvpn/auth.txt
$ ls -l /home/.../.config/vopono/proton/openvpn/auth.txt
-rw------- 1 ... ... 57 Apr  7 14:44 /home/.../.config/vopono/proton/openvpn/auth.txt

then run vopono...

it keeps changing it back to:

$ ls -l /home/.../.config/vopono/proton/openvpn/auth.txt
-rw-r----- 1 ... ... 57 Apr  7 14:44 /home/.../.config/vopono/proton/openvpn/auth.txt
jamesmcm commented 4 months ago

Thanks,

  1. was to avoid having to enter the password every time, across all OpenVPN providers. The other issue is that we can't pass the stdin and read back the stdout directly, since we ultimately want it to run in the background. So we'd need to read OpenVPN's stdout to see if it asks for the password and communicate that back - I'm not sure if it's really worth the extra complexity.

  2. is caused by https://github.com/jamesmcm/vopono/blob/master/vopono_core/src/util/mod.rs#L140-L163 - this was originally added to ensure the configs are readable, but since the way vopono is invoked has changed with the sudo crate, etc. now I don't think this should even be necessary anymore. But could also be fixed to not make the auth files group readable.

Do you have a use case where 1. is important? As in my experience they are randomly generated credentials from the providers anyway.