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

Pass forwarded port to POSTUP script if port forwarding (Plex) #260

Closed
jamesmcm opened this issue Mar 23, 2024 · 1 comment
Closed

Pass forwarded port to POSTUP script if port forwarding (Plex) #260

jamesmcm opened this issue Mar 23, 2024 · 1 comment

Comments

@jamesmcm
Copy link
Owner

Currently the callback script runs every time the port is reobtained, but for some cases (e.g. Plex where we cannot re-map the local port) we would want to run a command just once (for a proxy on that port) after establishing the connections.

E.g. for Plex 32400 is fixed as the local port, and we need to locally forward the outward forwarded port to that, within the network namespace:

$ vopono exec --custom ~/Downloads/wg-RO-9.conf --protocol wireguard --provider custom --custom-port-forwarding protonvpn --create-netns-only --keep-alive --forward 32400 --no-killswitch -o 32400 dummy

$ LD_LIBRARY_PATH=/usr/lib/plexmediaserver/lib PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plex PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6 PLEX_MEDIA_SERVER_TMPDIR=/tmp TMPDIR=/tmp sudo -E ip netns exec vo_c_UPcvBno sudo -Eu plex /usr/lib/plexmediaserver/Plex\ Media\ Server

$ sudo ip netns exec vo_c_UPcvBno socat tcp-l:42754,fork,reuseaddr tcp:10.200.1.2:32400

We would want to put the last command in a script, but need to pass in the port 42754 there which we'll get from the ProtonVPN port forwarding in vopono (note 10.200.1.2 is the local IP address of the network namespace).

jamesmcm added a commit that referenced this issue Mar 28, 2024
- Fixes handling of target applications with spaces in the name. This
  applies for the target application and also postup and predown host
  scripts. Fixes issue #259
- Add argument handling for postup and predown scripts, so these can be
  passed arguments now.
- Add `vopono.host` entry to the hosts file in the network namespace
  with the `$VOPONO_HOST_IP` if `--allow-host-access` is used. This
  allows you to access services on the host at `http://vopono.host:80`
  etc. from inside the network namespace. Addresses issue #262
- Add `$VOPONO_FORWARDED_PORT` environment variable if
  `--port-forwarding` or `--custom-port-forwarding` are used for
  provider port forwarding. Addresses issue #260
- Added details on Plex port forwarding configuration to the
  USERGUIDE.md
@jamesmcm
Copy link
Owner Author

Added in #264 as $VOPONO_FORWARDED_PORT

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

No branches or pull requests

1 participant