Skip to content
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

docs(portforwarding): Explain how to use custom port forwarding command #89

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lavalleeale
Copy link

See qdm12/gluetun#2399 for non-documentation discussion

Comment on lines +22 to +24
- Can be set via `VPN_PORT_FORWARDING_UP_COMMAND=command`
- Doesn't understand shell specific syntax such as `&&`, and one should use `/bin/sh -c "my shell syntax"` to do so if they want (bash isn't installed by default, only sh)
- Will have the string `{{PORTS}}` replaced by a comma separated list of the ports that have been forwarded (Example: `VPN_PORT_FORWARDING_UP_COMMAND=/script.sh {{PORTS}}`)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Can be set via `VPN_PORT_FORWARDING_UP_COMMAND=command`
- Doesn't understand shell specific syntax such as `&&`, and one should use `/bin/sh -c "my shell syntax"` to do so if they want (bash isn't installed by default, only sh)
- Will have the string `{{PORTS}}` replaced by a comma separated list of the ports that have been forwarded (Example: `VPN_PORT_FORWARDING_UP_COMMAND=/script.sh {{PORTS}}`)
A command can be set with `VPN_PORT_FORWARDING_UP_COMMAND`. For example `VPN_PORT_FORWARDING_UP_COMMAND=/bin/sh -c "echo {{PORTS}}"`.
Notes:
- The special string `{{PORTS}}` is replaced by a comma separated list of the ports that have been forwarded. For example `/bin/sh -c "echo {{PORTS}}"` would become `/bin/sh -c "echo 5678,9876"`
- shell specific syntax such as `&&` is not understood in the command, and one should use `/bin/sh -c "my shell syntax"` to do so if they want.
- one can bind mount a shell script in Gluetun and execute it with for example `VPN_PORT_FORWARDING_UP_COMMAND=/bin/sh -c /gluetun/myscript.sh` - 💁 feel free to propose a pull request to add commonly used shell scripts for port forwarding!
- the output of the command is written to the port forwarding logger within Gluetun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants