-
Notifications
You must be signed in to change notification settings - Fork 46
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
PostUp and PreDown commands #71
Comments
Sure, what would the aim be? To provide an executable script/binary as arguments for each when using I don't think it makes sense to parse these from the wg-quick config files, because usually we have already done whatever they would do anyway (i.e. DNS or killswitch configuration). |
It would be for spinning up and shutting down local services that serve the namespace. I for example like to use dnscrypt-proxy, because I kinda enjoy having the added peace of mind of routing through independent DNS servers over encrypted channels, with DNSSEC enabled. The same logic would also serve shadowsocks, privoxy, tor node routed through vpn, etc.. Note that these aren't services you want to run through the vpn - they are services serving your local vpn session. Your own Firefox instance in the namespace will use privoxy and dnscrypt-proxy. They have to be there when the user application starts, and should be shut down along with the namespace when no longer needed by the user application. Also note the fact that whether I use Swedish or Tokelauan vpn servers have zero bearing on these local services. They are part of my own system configuration, not of the vpn connection configuration. So even if we ran scripts from wg-quick configs, that wouldn't solve it. There's a TON of those files - for Mullvad alone, we're talking over a hundred files, often randomly selected when you filter for an exit country for example. So yes, primarily I'd say these should be specifiable as parameters to vopnono... But ultimately, I feel like vopono is missing a crucial component - a user level config file for vopono in general. If I only use mullvad, there's no good reason to have to specify So it's not really part of this enhancement proposal, but there should be a |
That makes sense, could you please provide examples of both scripts, just to have something to test against? |
postUp.sh:
preDown.sh:
For now, a namespace can be pulled up with bash as the executed process, and the scripts run from there manually, providing the namespace name as argument. |
Hey, sorry it's been a while I've moved country and job 😂 I tried to sort out the defaults in configuration file idea in this PR: #72 I'll see if I can do the PostUp and PreDown scripts too (so they could be specified there or as command line arguments, as paths to any executable binary/script). |
Merged in #74 and in release 0.7.0 - please test it and see if it works for your use case. |
Alright, I'll have a look! |
Okay there is one thing... Could you set an environment variable inside the sandbox with the sandbox name, that's available to these scripts? |
Added |
Something incredibly weird is happening.
Something is REALLY messed up with bg/fg and all that. Note that no Ctrl+key combinations have been pressed, nothing strange was done, this is all happening by itself. There is no issue unless --postup and --predown are used. So it's clearly those scripts that are causing the issue. Are you using some kind of magic to call these scripts parallel or in the background? I don't think it's a good idea to do that. They should be executed in series with the startup at the appropriate point. |
One clear and rather big issue, even if it didn't blow up, would be that the postup and predown script execution isn't even mentioned in the (verbose) log output. |
Okay so I made a wrapper script that just allows me to kick off bash sessions with a set vpn connection and dnscrypt. I'll include it here (also as an example of the kind of behavior that would be ideal in my opinion): vpnbash.sh:
vpn_env_dnscrypt.sh:
This implements the postup/predown behavior automatically by wrapping the entire session in a bash script. When the child process (from the command passed as the first argument) terminates, the script resumes and kills the daemon, after which control is given back to vopono. Honestly, I'm starting to think that probably this makes the need for a built-in postUp/preDn moot - in case you have limited resources, I'd be perfectly fine if you dropped the feature rather than spent time fixing it. With security-critical software like this, it's probably better to have a smaller set of functionality. |
It would be nice to be able to run scripts when a new namespace got pulled up, and before it's shut down. One thing I'd use this for is to spin up a dnscrypt-proxy instance handling the vpn connection.
The text was updated successfully, but these errors were encountered: