Docker IPsec VPN on CentOS 8
- 2Gb swap
- fail2ban
- ssh on custom port
- firewall
- disable selinux
- python3
- install docker & docker-compose
- create user www, add auth keys, group docker
- prepare docker ipsec vpn
If you have already installed docker, you can go to the VPN Server starting section and start VPN-server immediately.
- Generate ssh-key if necessary
Example:
ssh-keygen -t ed25519 -C "your_email@example.com"
- Install ansible
Example:
brew install ansible
- Configure Ansible
vim ~/.ansible.cfg
[defaults]
inventory = ~/.ansible_hosts
- Add server credentials to ~/.ansible_hosts
Example:
[vpn]
vpn1 ansible_user=root ansible_host=127.0.0.1
- Init config and edit if necessary
make init
edit main.yml
- Install additional Ansible roles from Ansible Galaxy
make install
- Copy your ~/.ssh/id_rsa.pub to files/authorized_keys
cat ~/.ssh/id_rsa.pub > ./files/authorized_keys
- Run playbook
make s
or without strict host checking
make ns
- Add server credentials to ~/.ssh/config
Example:
#vpn
Host vpn1
User www
Port 2222
Hostname 127.0.0.1
-
Connect to server via ssh
ssh vpn
and go to docker-ipsec-vpn dircd docker-ipsec-vpn
-
Init env-file
./init.sh
-
Start VPN Server
./start.sh
-
Wait about 1 minute
-
Copy config from container
./copy_config.sh
(for Mac and iOS)
Please look at README on hwdsl2/docker-ipsec-vpn-server repository for another config options.
scp vpn:./docker-ipsec-vpn/vpnclient.mobileconfig .