VPN Routing¶
Docker containers do not inherit the host machine's VPN connection. The vpn-start.sh script solves this by establishing a VPN tunnel that Docker traffic can route through.
The Problem¶
Host VPN Does Not Route Docker Traffic
When you connect to a VPN on your host machine (e.g., via OpenVPN GUI or WireGuard app), only host-level network traffic is routed through the tunnel. Docker containers use their own network namespace and bridge (docker0), which bypasses the host VPN entirely.
This means pentest tools running inside the pentest-tools container will connect directly to the internet, not through your VPN -- even if the host shows an active VPN connection.
vpn-start.sh¶
The vpn-start.sh script manages VPN connections that Docker containers can route through.
Usage¶
# Start OpenVPN with a named profile
./vpn-start.sh --vpn office
# Start WireGuard with a named profile
./vpn-start.sh --vpn home --wg
# Stop all VPN connections
./vpn-start.sh --stop
Flags¶
| Flag | Description |
|---|---|
--vpn <name> |
Profile name (matches filename in vpn/profiles/) |
--wg |
Use WireGuard instead of OpenVPN |
--stop |
Stop all active VPN connections |
VPN Profiles¶
Location¶
VPN configuration files are stored in:
This directory is gitignored to prevent accidental credential exposure.
OpenVPN¶
Place .ovpn files in vpn/profiles/:
The profile name used with --vpn matches the filename without the extension:
WireGuard¶
Place .conf files in vpn/profiles/:
Use the --wg flag to select WireGuard:
Credential Files¶
If an .ovpn profile requires username/password authentication, create a corresponding auth file:
The auth file contains two lines:
Example¶
For vpn/profiles/office.ovpn:
Contents:
Security
Auth files are gitignored along with the rest of vpn/profiles/. Never commit VPN credentials.
Setup Guide¶
For full setup instructions, see README.md Step 7. The general process:
- Place your VPN config file in
vpn/profiles/ - If the config needs credentials, create the
-auth.txtfile - Run
./vpn-start.sh --vpn <name>(add--wgfor WireGuard) -
Verify connectivity from inside Docker:
-
Compare the IP with your VPN's expected exit IP
Stopping VPN¶
This terminates all active VPN connections managed by the script.
Troubleshooting¶
| Issue | Solution |
|---|---|
| Docker traffic bypasses VPN | Ensure you used vpn-start.sh, not the host VPN client |
| Connection timeout | Check that the .ovpn/.conf file is valid and the VPN server is reachable |
| Auth failure | Verify the -auth.txt file exists and contains correct credentials |
| DNS resolution fails inside container | The VPN may push DNS settings that Docker does not pick up -- check resolv.conf inside the container |
| WireGuard not found | Ensure WireGuard tools are installed on the host (wg-quick) |