1
2
mirror of https://github.com/vimagick/dockerfiles synced 2024-06-28 17:51:24 +00:00
dockerfiles/openvpn/README.md

113 lines
2.3 KiB
Markdown
Raw Normal View History

2016-09-02 04:23:56 +00:00
OpenVPN
2015-09-01 01:53:21 +00:00
=======
2016-07-11 05:57:48 +00:00
[OpenVPN][1] is blocked in China. You need to connect vpn via secure tunnel.
2015-09-01 01:53:21 +00:00
2016-09-03 05:54:20 +00:00
Instead of using [fteproxy][2] as bridge, you can also use [stunnel][3] or [kcptun][4].
2015-09-01 01:53:21 +00:00
2016-05-01 01:06:20 +00:00
- server: vpn.easypi.info
- bridge: bridge.easypi.info
2015-09-01 01:53:21 +00:00
- client: localhost
## docker-compose.yml (server)
2016-09-02 04:23:56 +00:00
```yaml
openvpn:
2016-09-19 05:04:07 +00:00
image: kylemanna/openvpn
2016-09-02 04:23:56 +00:00
ports:
- "1194:1194"
volumes:
- ./data:/etc/openvpn
2015-09-01 01:53:21 +00:00
cap_add:
- NET_ADMIN
restart: always
fteproxy:
image: vimagick/fteproxy
ports:
- "4911:4911"
links:
2016-09-02 04:23:56 +00:00
- openvpn
2015-09-01 01:53:21 +00:00
environment:
2016-09-02 04:23:56 +00:00
- MODE=server
- SERVER_IP=0.0.0.0
- SERVER_PORT=4911
- PROXY_IP=openvpn
- PROXY_PORT=1194
- KEY=CB2FBA2BC70490526E749E01BB050F6B555964290DFF58CF24785B4A093F7B18
2015-09-01 01:53:21 +00:00
restart: always
```
## docker-compose.yml (bridge)
2016-09-02 04:23:56 +00:00
```yaml
2015-09-01 01:53:21 +00:00
fteproxy:
image: vimagick/fteproxy
ports:
- "1194:1194"
environment:
2016-09-02 04:23:56 +00:00
- MODE=client
2018-03-15 10:10:45 +00:00
- SERVER_IP=vpn.easypi.pro
2016-09-02 04:23:56 +00:00
- SERVER_PORT=4911
- CLIENT_IP=0.0.0.0
- CLIENT_PORT=1194
- KEY=CB2FBA2BC70490526E749E01BB050F6B555964290DFF58CF24785B4A093F7B18
2015-09-01 01:53:21 +00:00
restart: always
```
2016-09-02 04:23:56 +00:00
## Server Setup
2015-09-01 01:53:21 +00:00
2016-09-02 04:23:56 +00:00
```bash
2015-09-01 01:53:21 +00:00
$ ./setup.sh
2016-09-02 04:23:56 +00:00
1) server ...... (Step 1)
2) client ...... (Step 2)
2015-09-01 03:00:28 +00:00
3) revoke
2016-09-02 04:23:56 +00:00
4) quit ...... (Step 3)
2015-09-01 01:53:21 +00:00
2016-09-02 04:23:56 +00:00
$ docker-compose up -d
2015-09-01 01:53:21 +00:00
```
2018-03-15 10:10:45 +00:00
Some Advanced Config
```bash
$ cat ./data/openvpn.conf
...
### Push Configurations Below
push "route 114.114.114.114 255.255.255.255 net_gateway"
push "route 192.168.0.0 255.255.0.0 net_gateway"
push "route 172.16.0.0 255.240.0.0 net_gateway"
push "route 10.0.0.0 255.0.0.0 net_gateway"
$ docker-compose restart
```
2016-09-02 04:23:56 +00:00
## Bridge Setup
2015-09-01 01:53:21 +00:00
2016-09-02 04:23:56 +00:00
```bash
$ docker-compose up -d
2015-09-01 01:53:21 +00:00
```
2016-09-02 04:23:56 +00:00
## Client Setup
2015-09-01 01:53:21 +00:00
2016-09-02 04:23:56 +00:00
```bash
2015-09-01 01:53:21 +00:00
$ cat /etc/openvpn/client.conf
...
2016-05-01 01:06:20 +00:00
remote bridge.easypi.info 1194 tcp
2017-09-02 05:57:01 +00:00
route 192.168.0.0 255.255.0.0 net_gateway
route 172.16.0.0 255.240.0.0 net_gateway
route 10.0.0.0 255.0.0.0 net_gateway
2015-09-01 01:53:21 +00:00
...
$ systemctl start openvpn@client
$ systemctl enable openvpn@client
```
2016-07-11 05:57:48 +00:00
## References
- <https://community.openvpn.net/openvpn/wiki>
- <https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04>
[1]: https://openvpn.net/index.php/open-source.html
[2]: https://github.com/vimagick/dockerfiles/tree/master/fteproxy
[3]: https://github.com/vimagick/dockerfiles/tree/master/stunnel
2016-09-04 06:18:52 +00:00
[4]: https://github.com/vimagick/dockerfiles/tree/master/kcptun