Last active
December 10, 2022 23:21
-
-
Save iahim/b2642d69f36267dd13def87dfaf03d34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### make sure you have port 1194 accessible from the internet. | |
### =================== | |
### SERVER SIDE | |
### =================== | |
### create a folder where you keep the data generated by openvpn | |
mkdir -p openvpn-data/conf | |
### create a docker-compose file: | |
cat docker-compose.yml | |
```yaml | |
version: '2' | |
services: | |
openvpn: | |
cap_add: | |
- NET_ADMIN | |
image: kylemanna/openvpn | |
container_name: openvpn | |
ports: | |
- "1194:1194/udp" | |
restart: always | |
volumes: | |
- ./openvpn-data/conf:/etc/openvpn | |
``` | |
### Run commands | |
docker-compose run --rm openvpn ovpn_genconfig -u udp://my.server.or.ip | |
docker compose run --rm openvpn ovpn_initpki | |
### this is your client settings | |
export CLIENTNAME="clientmike" | |
### docker-compose run --rm openvpn easyrsa build-client-full $CLIENTNAME nopass | |
docker-compose run --rm openvpn easyrsa build-client-full $CLIENTNAME | |
### export your client settings and generate the OVPN file | |
docker compose run --rm openvpn ovpn_getclient $CLIENTNAME > $CLIENTNAME.ovpn | |
### run the container as a daemon | |
docker compose up -d openvpn | |
### =================== | |
### CLIENT SIDE (CLI) | |
### =================== | |
apt install -y openvpn | |
openvpn --config clientmike.ovpn --daemon | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment