Open spencerhughes opened 1 year ago
+1, I need this as well.
There is a way to do it but it doesn't stick. If you edit /root/wireguardup.sh
in the container to include your custom script then you can run logic after wireguard connection. But whenever the container gets recreated it resets /root
making this an annoying manual fix to apply.
There's a better fix than using VPN_OPTIONS
, since I don't think wireguard has an --up
equivalent.
Ideally the wg0.conf
file would not override custom added PostUp
lines. Then you could just add your own PostUp
config to do this.
@binhex is this possible to add? I would greatly appreciate it.
+1, I need this as well.
There is a way to do it but it doesn't stick. If you edit
/root/wireguardup.sh
in the container to include your custom script then you can run logic after wireguard connection. But whenever the container gets recreated it resets/root
making this an annoying manual fix to apply.There's a better fix than using
VPN_OPTIONS
, since I don't think wireguard has an--up
equivalent.Ideally the
wg0.conf
file would not override custom addedPostUp
lines. Then you could just add your ownPostUp
config to do this.@binhex is this possible to add? I would greatly appreciate it.
I need this as well @binhex. This would resolve all the compatibility issues on Synology NAS: https://www.derekseaman.com/2022/12/using-wireguard-with-your-synology-docker-containers.html
I have found a fix. You can stop overwriting of wg0.conf
by mapping wireguard
folder read only:
-v /root/docker/config/wireguard:/config/wireguard:ro
All mapped config volumes should look like this:
-v /root/docker/config/wireguard:/config/wireguard:ro
-v /root/docker/config:/config
I've just tried your solution on truenas and unfortunately making that folder read only leads to the /root/wireguardup.sh not running and the web interface never coming up. Would be great to have script support for wireguard if this is possible.
I feel like wireguardup.sh could call out to another script based on environment variable, e.g. WIREGUARD_POSTUP_SCRIPT=/path/to/script.sh
and wireguardup.sh could have if WIREGUARD_POSTUP_SCRIPT != null then sh $WIREGUARD_POSTUP_SCRIPT
or something (excuse by bad pseudocode).
Subscribing to this, also would like it for privoxyvpn, etc
Is it possible to run a user-defined script at during the Wireguard post-up? Something functionally equivalent to
-e VPN_OPTIONS=--up /path/to/script/tun_up.sh
for OpenVPN? There are some commands I need to run once the tunnel has connected from within the container, and I see that the Wireguard config already calls a PostUp script so I didn't want to mess with that script for forwards compatibility reasons.