# Configuring OpenVPN for ExpressVPN in Docker

I found the information for setting up the haugene/transmission-openvpn container using ExpressVPN hard to come by so I'm documenting it all here for future reference.

# Step 1: ExpressVPN data

  • Login in to ExpressVPN and go to "My Account"
  • Under "Set up your devices" select "More..."
  • Select "Manual Configuration"
  • Copy the Username & Password.
  • Create a text file called auth.txt
  • Paste the username in the first line.
  • Paste the password into the second line.

Underneath the Username / Password fields you will see the OpenVPN configuration files grouped by area.

  • Download your preferred location. e.g my_expressvpn_usa_-_new_york_udp.ovpn
  • Open the .ovpn file in a text editor
  • Look for the line that starts auth-user-pass should be about line 26.
  • Append /etc/openvpn/custom/auth.txt so that the line reads auth-user-pass /etc/openvpn/custom/auth.txt

# Step 2: Set up the mount points

Create the following directory structure in your home dir using the auth.txt and .ovpn files from above.

/Docker/transmission-openvpn/ovpn/**YOUR-OPVN-FILE**.ovpn
/Docker/transmission-openvpn/downloads
/Docker/transmission-openvpn/auth.txt

Update the following Docker script to have your correct paths. Ignore OPENVPN_USERNAME and OPENVPN_PASSWORD they are not required. Username and password will come from auth.txt.

**YOUR-ACCOUNT-NAME** is your account name. **YOUR-OPVN-FILE** is the name of your .ovpn file. e.g. my_expressvpn_usa_-_new_york_udp.ovpn

Check the LOCAL_NETWORK matches your local network settings.

docker run  --cap-add=NET_ADMIN --device=/dev/net/tun -d \
            -e LOCAL_NETWORK=192.168.1.0/24 \
            -v /Users/**YOUR-ACCOUNT-NAME**/Docker/transmission-openvpn/ovpn/**YOUR-OPVN-FILE**.ovpn:/etc/openvpn/custom/default.ovpn \
            -v /Users/**YOUR-ACCOUNT-NAME**/Docker/transmission-openvpn/downloads:/data \
            -v /Users/**YOUR-ACCOUNT-NAME**/Docker/transmission-openvpn/auth.txt:/etc/openvpn/custom/auth.txt \
            -e ENABLE_UFW=true \
            -e OPENVPN_PROVIDER=CUSTOM \
            -e OPENVPN_USERNAME=user \
            -e OPENVPN_PASSWORD=pass \
            -e WEBPROXY_ENABLED=false \
            --log-driver json-file \
            --log-opt max-size=10m \
            -p 9091:9091 \
            --name=transmission-openvpn \
            haugene/transmission-openvpn

Run the script and you should have a running container connected to ExpressVPN.

# Testing it's worked

If you access http://localhost:9091 you should have access to the Transmission Torrent Client.

Using Docker desktop, access the command line for the container and type curl ifconfig.io it will give you the external IP of container. This should be different to the one you get if you did this on your local machine.

You can the physical location for the IP by plugging into this URL: https://www.whatismyip.com/XXX.XXX.XXX.XXX/ Make sure it matches what the .ovpn file location you selected from ExpressVPN page.