superdanio/expressvpn

By superdanio

Updated over 1 year ago

Dockerized version of ExpressVPN exposing API and a minimalistic UI to interact with it.

Image
Networking
Security
1

8.0K

superdanio/expressvpn repository overview

ExpressVPN in a container

https://github.com/superdanio/expressvpn

Prerequisites

  1. Get your activation code from ExpressVPN web site.

API

MethodEndpointDescription
GET/api/preferencesReturns the preferences currently in use
GET/api/serversReturns the list of servers you can connect to
GET/api/statusReturns the current status of the connection
GET/api/test?url=<string>Redirects to the given url. Useful for testing connectivity
GET_/api/versionReturns the expressvpn client version
POST/api/connect/<string:server>Connects to the given server or to 'smart' if blank
POST/api/disconnectDisconnects from current server
POST/api/preferences/<string:name>/<string:value>Sets the given preference
POST/api/refreshRefreshes the current VPN cluster

UI

A very minimalistic UI is exposed on the main port. Nothing fancy, just plain html and javascript to keep it simple.

Docker

docker run -it --privileged --cap-add=NET_ADMIN --device=/dev/net/tun -p 25000:5000 -e ACTIVATION_CODE=<YOUR_CODE> -e CONNECT_AT_STARTUP=true expressvpn:local

Docker Compose

services:

  expressvpn:
    container_name: expressvpn
    image: superdanio/expressvpn
    environment:
      - ACTIVATION_CODE={% your-activation-code %}
      - SERVER={% LOCATION/ALIAS/COUNTRY %} # optional
      - PREFERRED_PROTOCOL={% protocol %} # optional
      - LIGHTWAY_CIPHER={% lightway-cipher %} # optional
      - CONNECT_AT_STARTUP={% true | false %}
      - HEALTHCHECK_TARGET={% url %} # optional
    cap_add:
      - NET_ADMIN
    devices: 
      - /dev/net/tun
    stdin_open: true
    tty: true
    privileged: true
    restart: unless-stopped
    volumes:
      - /tmp/vpn:/vpn_shared
    ports:
      - "5000:5000" # exposing API port
      # ports of other containers that use the vpn (to access them locally)
  
  curl:
    image: alpine/curl
    container_name: curl
    command: sleep infinity
    network_mode: service:expressvpn
    depends_on:
      expressvpn:
        condition: service_healthy
    volumes:
      - /tmp/vpn/resolv.conf:/etc/resolv.conf

You can test it by executing:

docker compose exec -it curl curl ifconfig.me

Configuration Reference

ACTIVATION_CODE

A mandatory string containing your ExpressVPN activation code.

ACTIVATION_CODE=ABCD1EFGH2IJKL3MNOP4QRS

SERVER

An optional string containing the ExpressVPN server LOCATION/ALIAS/COUNTRY. Connect to smart location if it is not set.

SERVER=smart

PREFERRED_PROTOCOL

An optional string containing the ExpressVPN protocol. Can be auto, udp, tcp ,lightway_udp, lightway_tcp. Use auto if it is not set.

PREFERRED_PROTOCOL=lightway_udp

LIGHTWAY_CIPHER

An optional string containing the ExpressVPN lightway cipher. Can be auto, aes, chacha20. Use auto if it is not set.

LIGHTWAY_CIPHER=chacha20

CONNECT_AT_STARTUP

An optional string (representing a boolean) to determine whether it should connect to a server at startup.

HEALTHCHECK_TARGET

An optional string representing the url to hit for healthcheck. Default: http://ifconfig.me If the schema is not provided, the url will be resolved as internal to the api: i.e. status => http://localhost:5000/api/status

Tag summary

Content type

Image

Digest

sha256:32d012abc

Size

82.2 MB

Last updated

over 1 year ago

docker pull superdanio/expressvpn