DevOps Corner Indonesia - OpenFortiVPN Client Container Image
ENV VPN_HOST host
ENV VPN_PORT port
ENV VPN_ADDR host:port
ENV VPN_USER user@domain
ENV VPN_PASS secret
ENV VPN_TRUST_CERT 1234567890987654321
ENV VPN_TIMEOUT 10
# Create a docker network, to be able to control addresses
docker network create --subnet=172.20.0.0/16 openfortivpn
# Start the priviledged docker container with a static ip
docker run -it --rm \
--privileged \
--net openfortivpn --ip 172.20.0.2 \
-e VPN_HOST=host \
-e VPN_PORT=port \
-e VPN_ADDR=host:port \
-e VPN_USER=user@domain \
-e VPN_PASS=secret \
-e VPN_TRUST_CERT=1234567890987654321
devopscorner/openfortivpn
# Add route for you remote subnet (ex. 10.201.0.0/16)
ip route add 10.201.0.0/16 via 172.20.0.2
# Access remote host from the subnet
ssh 10.201.8.1
# Create a docker-machine and configure shell to use it
docker-machine create openfortivpn --driver virtualbox
eval $(docker-machine env openfortivpn)
# Start the priviledged docker container on its host network
docker run -it --rm \
--privileged --net host \
-e VPN_HOST=host \
-e VPN_PORT=port \
-e VPN_ADDR=host:port \
-e VPN_USER=user@domain \
-e VPN_PASS=secret \
-e VPN_TRUST_CERT=1234567890987654321
devopscorner/openfortivpn
# Add route for you remote subnet (ex. 10.201.0.0/16)
sudo route add -net 10.201.0.0/16 $(docker-machine ip openfortivpn)
# Access remote host from the subnet
ssh 10.201.8.1
If you don't want to use a docker network, you can find out the container ip once it is started with:
# Find out the container IP
docker inspect --format '{{ .NetworkSettings.IPAddress }}' <container>