Skip to content

Commit 05d8cb3

Browse files
committed
Merge branch 'develop'
2 parents 1a4be14 + df6b4cc commit 05d8cb3

File tree

15 files changed

+68
-36
lines changed

15 files changed

+68
-36
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
### 1.0.4 - IPv6 docs, improved wizards
4+
5+
- Added instructions for IPv6 configuration
6+
- Added outside interface option to setup wizards
7+
- Added some links to documentation
8+
39
### 1.0.3 - New examples, fixes, more docs
410

511
- Updated instructions

CONTRIBUTING.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,5 @@ Sections:
9090

9191
- [OpenVPN docs](https://community.openvpn.net/openvpn/wiki/GettingStartedwithOVPN)
9292
- [Setup OpenVPN on alpine linux](https://wiki.alpinelinux.org/wiki/Setting_up_a_OpenVPN_server#Alternative_Certificate_Method)
93-
- [EasyRSA](https://community.openvpn.net/openvpn/wiki/GettingStartedwithOVPN)
93+
- [EasyRSA](https://community.openvpn.net/openvpn/wiki/GettingStartedwithOVPN)
94+
- [EasyRSA doc](https://github.com/OpenVPN/easy-rsa/tree/master/doc)

README.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,12 @@ services:
5656
context: .
5757
cache_from:
5858
- lsiobase/alpine.python3:latest
59-
networks:
60-
mynetwork:
61-
ipv4_address: 10.0.0.5
62-
ipv6_address: 2001:1111::5
63-
64-
networks:
65-
mynetwork:
66-
driver: host
67-
enable_ipv6: true
59+
sysctls: # For IPv6
60+
- net.ipv6.conf.all.disable_ipv6=0
61+
- net.ipv6.conf.default.forwarding=1
62+
- net.ipv6.conf.all.forwarding=1
63+
network_mode: host
64+
6865
```
6966

7067
## Parameters
@@ -75,6 +72,8 @@ networks:
7572
|`-e PGID=1000`|for GroupID - see below for explanation|
7673
|`-v /config`|All the config files including OpenVPNs reside here|
7774

75+
See also: [EasyRSA](https://github.com/OpenVPN/easy-rsa/blob/master/doc/EasyRSA-Advanced.md)
76+
7877
## User / Group Identifiers
7978

8079
When using volumes (`-v` flags) permissions issues can arise between the host OS and the container, we avoid this issue by allowing you to specify the user `PUID` and group `PGID`.
@@ -110,13 +109,15 @@ If you are new to containers please see rather [Detailed first setup guide](docs
110109

111110
``` bash
112111
ovpn_enconf basic_nat
112+
#Out interface [eth0]: <interface connected to the Internet>
113113
#Protocol udp, tcp, udp6, tcp6 [udp]:
114114
#VPN network [10.0.0.0]:
115115
#Port [1194]:
116116
#Public IP or domain of server: <YOUR PUBLIC IP>
117117
#DNS1 [8.8.8.8]:
118118
#DNS2 [8.8.4.4]:
119119
```
120+
120121
4. Enable **port forwarding** on your router so OpenVPN server will be accessible from the internet.
121122
5. Add clients
122123

docker-compose.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# OpenVPN server sample configuration
33
#
44

5-
version: '2.2'
5+
version: '2.2' # Min version 2.1 for IPv6
66
services:
77
ovpn:
88
image: slocomptech/openvpn
@@ -22,7 +22,11 @@ services:
2222
context: .
2323
cache_from:
2424
- lsiobase/alpine.python3:latest
25-
25+
sysctls: # For IPv6
26+
- net.ipv6.conf.all.disable_ipv6=0
27+
- net.ipv6.conf.default.forwarding=1
28+
- net.ipv6.conf.all.forwarding=1
29+
2630
network_mode: "bridge"
2731
#network_mode: "host"
2832

docs/README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ Configs:
7272
<example config name>
7373
```
7474

75-
**Note:** Please read example documentation to understand how to use it.
75+
**Note:** Please read example documentation to understand how to use it.
76+
**Warning:** Some examples automaticaly add firewall rules, so if you are using host networking make sure to check **iptables** for correct configuration.
7677
**Tip:** If you modifed config in a way that others might need same configuration, consider making new example.
7778

7879
#### ovpn_init

docs/SetupGuide.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ This is simple setup guide to help you get started. It uses the simplest configu
9595

9696
``` bash
9797
ovpn_enconf basic_nat
98+
#Out interface [eth0]: <interface connected to the Internet>
9899
#Protocol udp, tcp, udp6, tcp6 [udp]:
99100
#VPN network [10.0.0.0]:
100101
#Port [1194]:
@@ -140,4 +141,4 @@ This is simple setup guide to help you get started. It uses the simplest configu
140141
```
141142

142143
**Note:** PUID, GUID parameters are optional.
143-
**Note:** Container in this example will connect to host network, so there is less network overhead (recommended), this also works if container is in default docker network.
144+
**Note:** Container in this example will connect to host network, so there is less network overhead (recommended), this also works if container is in default docker network. (But be careful if you already have firewall configured, because some rules are added when using most of examples).

root/defaults/example/config/basic_nat/hooks/down/10-network.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
ovpn-iptables -D INPUT -p udp -m udp --dport $PORT -j ACCEPT -m comment --comment "Open OpenVPN port"
99

1010
# Disable LAN protection of VPN
11-
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -d 10.0.0.0/8 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
12-
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -d 192.168.0.0/16 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
13-
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -d 172.16.0.0/12 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
11+
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -d 10.0.0.0/8 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
12+
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -d 192.168.0.0/16 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
13+
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -d 172.16.0.0/12 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
1414

1515
# Disable Routing Internet <--> VPN network
16-
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
17-
ovpn-iptables -D FORWARD -i eth0 -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
16+
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
17+
ovpn-iptables -D FORWARD -i $OUT_INT -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
1818

1919
# Disable NAT for VPN traffic
20-
ovpn-iptables -t nat -D POSTROUTING -s $NETWORK_ADDRESS/24 -o eth0 -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
20+
ovpn-iptables -t nat -D POSTROUTING -s $NETWORK_ADDRESS/24 -o $OUT_INT -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
2121

root/defaults/example/config/basic_nat/hooks/up/10-network.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
ovpn-iptables -A INPUT -p udp -m udp --dport $PORT -j ACCEPT -m comment --comment "Open OpenVPN port"
99

1010
# Protect LANs after VPN
11-
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -d 10.0.0.0/8 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
12-
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -d 192.168.0.0/16 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
13-
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -d 172.16.0.0/12 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
11+
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -d 10.0.0.0/8 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
12+
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -d 192.168.0.0/16 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
13+
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -d 172.16.0.0/12 -j REJECT -m comment --comment "Drop traffic VPN --> LANs"
1414

1515
# Allow Routing Internet <--> VPN network
16-
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
17-
ovpn-iptables -A FORWARD -i eth0 -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
16+
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
17+
ovpn-iptables -A FORWARD -i $OUT_INT -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
1818

1919
# Preform NAT for VPN traffic
20-
ovpn-iptables -t nat -A POSTROUTING -s $NETWORK_ADDRESS/24 -o eth0 -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
20+
ovpn-iptables -t nat -A POSTROUTING -s $NETWORK_ADDRESS/24 -o $OUT_INT -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
2121

root/defaults/example/config/basic_nat/wizard

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ if not os.path.isdir(TEMP_PATH):
2929
print("Specified directory does not exist")
3030
sys.exit(2)
3131

32+
# Select output interface
33+
out_int = input("Out interface [eth0]:")
34+
if len(out_int) == 0:
35+
out_int = "eth0"
36+
3237
# Select protocol
3338
protocol = input("Protocol udp, tcp, udp6, tcp6 [udp]:")
3439
AVAILABLE_PROTOCOLS = ["udp", "tcp", "udp6", "tcp6"]
@@ -65,6 +70,7 @@ if len(dns2) == 0:
6570

6671
# Write to server config
6772
vars = [
73+
("$OUT_INT", out_int),
6874
("$PROTO", protocol),
6975
("$PORT", port),
7076
("$NETWORK_ADDRESS", network),

root/defaults/example/config/basic_nat_wlp/hooks/down/10-network.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
ovpn-iptables -D INPUT -p udp -m udp --dport $PORT -j ACCEPT -m comment --comment "Open OpenVPN port"
99

1010
# Disable Routing Internet <--> VPN network
11-
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12-
ovpn-iptables -D FORWARD -i eth0 -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
11+
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12+
ovpn-iptables -D FORWARD -i $OUT_INT -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
1313

1414
# Disable NAT for VPN traffic
15-
ovpn-iptables -t nat -D POSTROUTING -s $NETWORK_ADDRESS/24 -o eth0 -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
15+
ovpn-iptables -t nat -D POSTROUTING -s $NETWORK_ADDRESS/24 -o $OUT_INT -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
1616

root/defaults/example/config/basic_nat_wlp/hooks/up/10-network.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
ovpn-iptables -A INPUT -p udp -m udp --dport $PORT -j ACCEPT -m comment --comment "Open OpenVPN port"
99

1010
# Allow Routing Internet <--> VPN network
11-
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12-
ovpn-iptables -A FORWARD -i eth0 -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
11+
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12+
ovpn-iptables -A FORWARD -i $OUT_INT -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
1313

1414
# Preform NAT for VPN traffic
15-
ovpn-iptables -t nat -A POSTROUTING -s $NETWORK_ADDRESS/24 -o eth0 -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
15+
ovpn-iptables -t nat -A POSTROUTING -s $NETWORK_ADDRESS/24 -o $OUT_INT -j MASQUERADE -m comment --comment "NAT traffic VPN --> Internet"
1616

root/defaults/example/config/basic_nat_wlp/wizard

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ if not os.path.isdir(TEMP_PATH):
2929
print("Specified directory does not exist")
3030
sys.exit(2)
3131

32+
# Select output interface
33+
out_int = input("Out interface [eth0]:")
34+
if len(out_int) == 0:
35+
out_int = "eth0"
36+
3237
# Select protocol
3338
protocol = input("Protocol udp, tcp, udp6, tcp6 [udp]:")
3439
AVAILABLE_PROTOCOLS = ["udp", "tcp", "udp6", "tcp6"]
@@ -65,6 +70,7 @@ if len(dns2) == 0:
6570

6671
# Write to server config
6772
vars = [
73+
("$OUT_INT", out_int),
6874
("$PROTO", protocol),
6975
("$PORT", port),
7076
("$NETWORK_ADDRESS", network),

root/defaults/example/config/basic_routed/hooks/down/10-network.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
ovpn-iptables -D INPUT -p udp -m udp --dport $PORT -j ACCEPT -m comment --comment "Open OpenVPN port"
99

1010
# Disable Routing Internet <--> VPN network
11-
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12-
ovpn-iptables -D FORWARD -i eth0 -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
11+
ovpn-iptables -D FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12+
ovpn-iptables -D FORWARD -i $OUT_INT -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
1313

root/defaults/example/config/basic_routed/hooks/up/10-network.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
ovpn-iptables -A INPUT -p udp -m udp --dport $PORT -j ACCEPT -m comment --comment "Open OpenVPN port"
99

1010
# Allow Routing Internet <--> VPN network
11-
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o eth0 -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12-
ovpn-iptables -A FORWARD -i eth0 -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
11+
ovpn-iptables -A FORWARD -i tun0 -s $NETWORK_ADDRESS/24 -o $OUT_INT -j ACCEPT -m comment --comment "Allow traffic VPN --> Internet"
12+
ovpn-iptables -A FORWARD -i $OUT_INT -d $NETWORK_ADDRESS/24 -o tun0 -j ACCEPT -m comment --comment "Allow traffic Internet --> VPN"
1313

root/defaults/example/config/basic_routed/wizard

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ if not os.path.isdir(TEMP_PATH):
2929
print("Specified directory does not exist")
3030
sys.exit(2)
3131

32+
# Select output interface
33+
out_int = input("Out interface [eth0]:")
34+
if len(out_int) == 0:
35+
out_int = "eth0"
36+
3237
# Select protocol
3338
protocol = input("Protocol udp, tcp, udp6, tcp6 [udp]:")
3439
AVAILABLE_PROTOCOLS = ["udp", "tcp", "udp6", "tcp6"]
@@ -65,6 +70,7 @@ if len(dns2) == 0:
6570

6671
# Write to server config
6772
vars = [
73+
("$OUT_INT", out_int),
6874
("$PROTO", protocol),
6975
("$PORT", port),
7076
("$NETWORK_ADDRESS", network),

0 commit comments

Comments
 (0)