Skip to content

Commit

Permalink
Add check that natpmpc is installed for ProtonVPN port forwarding
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmcm committed Nov 4, 2023
1 parent d1c1967 commit 688cbe3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "vopono"
description = "Launch applications via VPN tunnels using temporary network namespaces"
version = "0.10.7"
version = "0.10.8"
authors = ["James McMurray <[email protected]>"]
edition = "2021"
license = "GPL-3.0-or-later"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ lynx all running through different VPN connections:

\*\*\* For ProtonVPN you can generate and download specific Wireguard config
files, and use them as a custom provider config. See the [User Guide](USERGUIDE.md)
for details. [Port Forwarding](https://protonvpn.com/support/port-forwarding-manual-setup/) is supported with the `--protonvpn-port-forwarding` argument for both OpenVPN and Wireguard (with `--provider custom --custom xxx.conf --protocol wireguard` ), note for OpenVPN you must generate the OpenVPN config files appending `+pmp` to your OpenVPN username, and you must choose servers which support this feature (e.g. at the time of writing, the Romania servers do). The assigned port is then printed to the terminal where vopono was launched - this should then be set in any applications that require it.
for details. [Port Forwarding](https://protonvpn.com/support/port-forwarding-manual-setup/) is supported with the `--protonvpn-port-forwarding` argument for both OpenVPN and Wireguard (with `--provider custom --custom xxx.conf --protocol wireguard` ). `natpmpc` must be installed. Note for OpenVPN you must generate the OpenVPN config files appending `+pmp` to your OpenVPN username, and you must choose servers which support this feature (e.g. at the time of writing, the Romania servers do). The assigned port is then printed to the terminal where vopono was launched - this should then be set in any applications that require it.


\*\*\*\* Cloudflare Warp uses its own protocol. Set both the provider and
Expand Down
2 changes: 2 additions & 0 deletions USERGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ $ vopono -v exec --provider custom --custom testwg-UK-17.conf --protocol wiregua

Port forwarding can be enabled with the `--protonvpn-port-forwarding` argument, but requires using a server that supports port forwarding.

`natpmpc` must be installed e.g. via the `libnatpmp` package on Arch Linux.

Note for OpenVPN you must generate the OpenVPN config files appending `+pmp` to your OpenVPN username (i.e. what will be written to `~/.config/vopono/proton/openvpn/auth.txt`)

Note the usual `-o` / `--open-ports` argument has no effect here as we only know the port number assigned after connecting to ProtonVPN.
Expand Down
2 changes: 1 addition & 1 deletion vopono_core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "vopono_core"
description = "Library code for running VPN connections in network namespaces"
version = "0.1.7"
version = "0.1.8"
edition = "2021"
authors = ["James McMurray <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down
10 changes: 10 additions & 0 deletions vopono_core/src/network/natpmpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ impl Natpmpc {
pub fn new(ns: &NetworkNamespace) -> anyhow::Result<Self> {
let gateway_str = PROTONVPN_GATEWAY.to_string();

if let Err(x) = which::which("natpmpc") {
log::error!(
"natpmpc not found. Is natpmpc installed and on PATH? (e.g. libnatpmp package)"
);
return Err(anyhow::anyhow!(
"natpmpc not found. Is natpmpc installed and on PATH?: {:?}",
x
));
}

// Check output for readnatpmpresponseorretry returned 0 (OK)
// If receive readnatpmpresponseorretry returned -7
// Then prompt user to choose different gateway
Expand Down

0 comments on commit 688cbe3

Please sign in to comment.