OTRLabs / clandestine-platform

Collaboration Platform for orgs who care about privacy
Apache License 2.0
1 stars 0 forks source link

Add OpenVPN VPN Chaining for networking egress using containers #9

Open cammclain opened 3 months ago

cammclain commented 3 months ago

Eventually, i intend to be adding the capability to chain multiple OpenVPN configurations together to enhance networking egress. This will provide an additional layer of obfuscation and security by routing traffic through multiple VPN providers sequentially.

Implementation Details

To achieve VPN chaining, we will use Docker containers to manage the OpenVPN connections. Each container will connect to a different VPN provider, and traffic will be routed through these containers in sequence.

Example Implementation

Prerequisites

Step-by-Step Guide

  1. Create Dockerfiles for Each VPN

    • Dockerfile for NordVPN Container

      FROM alpine:latest
      RUN apk add --no-cache openvpn
      COPY nordvpn.ovpn /etc/openvpn/config.ovpn
      CMD ["openvpn", "--config", "/etc/openvpn/config.ovpn"]
    • Dockerfile for Mullvad VPN Container

      FROM alpine:latest
      RUN apk add --no-cache openvpn
      COPY mullvadvpn.ovpn /etc/openvpn/config.ovpn
      CMD ["openvpn", "--config", "/etc/openvpn/config.ovpn"]
  2. Build and Run the Containers

    • Build and Run NordVPN Container

      docker build -t nordvpn-container -<<EOF
      FROM alpine:latest
      RUN apk add --no-cache openvpn
      COPY nordvpn.ovpn /etc/openvpn/config.ovpn
      CMD ["openvpn", "--config", "/etc/openvpn/config.ovpn"]
      EOF
      
      docker run --cap-add=NET_ADMIN --device /dev/net/tun --name nordvpn -d nordvpn-container
    • Build and Run Mullvad VPN Container

      docker build -t mullvadvpn-container -<<EOF
      FROM alpine:latest
      RUN apk add --no-cache openvpn
      COPY mullvadvpn.ovpn /etc/openvpn/config.ovpn
      CMD ["openvpn", "--config", "/etc/openvpn/config.ovpn"]
      EOF
      
      docker run --cap-add=NET_ADMIN --device /dev/net/tun --net=container:nordvpn --name mullvadvpn -d mullvadvpn-container

Verification

To verify the VPN chaining setup, perform the following steps:

  1. Check NordVPN Container Logs

    docker logs nordvpn

    Ensure that the NordVPN connection is established successfully.

  2. Check Mullvad VPN Container Logs

    docker logs mullvadvpn

    Ensure that the Mullvad VPN connection is established successfully.

  3. Verify Routing

    Use a network utility like curl or wget from the Mullvad VPN container to confirm that traffic is routed through both VPNs:

    docker exec -it mullvadvpn curl ifconfig.me

    The IP address returned should correspond to Mullvad VPN, indicating that traffic is being routed through both VPN providers.

Conclusion

By implementing VPN chaining using Docker containers, we enhance the privacy and security of our network traffic. This setup routes traffic through two VPN providers, providing an additional layer of obfuscation to the traffic's origin.

References