You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, I would like to request the ability to pass a user-specified callback script to port_forwarding.sh to be executed after binding the port.
I already have an existing OpenVPN configuration and scripts to connect to PIA (which also perform iptables and routing rules to force a split VPN for a specified user account). This worked great until the old port forwarding API stopped working recently. To be able to utilize the port_forwarding.sh script in this project, I made a small change to execute a callback script (this is immediately above the sleep command:
154 if [ -n "$PF_CALLBACK" ]; then 155 # Execute the specified callback script 156 export PF_PORT=$port 157 /usr/bin/env bash -c "$PF_CALLBACK" 158 # Unset so this does not get called again 159 PF_CALLBACK= 160 fi
This allows me to do the following:
Wrap get_token.sh and port_forwarding.sh into a daemon that runs independently.
Immediately receive the port number after binding, for use in other scripts.
Capture the exported payload_and_signature variable for future calls to port_forwarding.sh (for example, upon VPN reconnect).
Obviously this is a fairly simple implementation, and you may wish to write it differently or more robustly. Any thoughts? This would be extremely useful for allowing people to use the port forwarding script with only minimal changes to existing setups.
The text was updated successfully, but these errors were encountered:
Hi all, I would like to request the ability to pass a user-specified callback script to port_forwarding.sh to be executed after binding the port.
I already have an existing OpenVPN configuration and scripts to connect to PIA (which also perform iptables and routing rules to force a split VPN for a specified user account). This worked great until the old port forwarding API stopped working recently. To be able to utilize the port_forwarding.sh script in this project, I made a small change to execute a callback script (this is immediately above the sleep command:
154 if [ -n "$PF_CALLBACK" ]; then
155 # Execute the specified callback script
156 export PF_PORT=$port
157 /usr/bin/env bash -c "$PF_CALLBACK"
158 # Unset so this does not get called again
159 PF_CALLBACK=
160 fi
This allows me to do the following:
Obviously this is a fairly simple implementation, and you may wish to write it differently or more robustly. Any thoughts? This would be extremely useful for allowing people to use the port forwarding script with only minimal changes to existing setups.
The text was updated successfully, but these errors were encountered: