Skip to content

Commit 4a49c15

Browse files
committed
Added outside interface option to wizards
Added option to choose outside interface, so firewall can be configured properly. Solved #2
1 parent 99e2213 commit 4a49c15

File tree

12 files changed

+49
-31
lines changed

12 files changed

+49
-31
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
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
37
### 1.0.3 - New examples, fixes, more docs
48

59
- Updated instructions

README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,8 @@ services:
6060
- net.ipv6.conf.all.disable_ipv6=0
6161
- net.ipv6.conf.default.forwarding=1
6262
- net.ipv6.conf.all.forwarding=1
63-
networks:
64-
mynetwork:
65-
ipv4_address: 10.0.0.5
66-
ipv6_address: 2001:1111::5
67-
68-
networks:
69-
mynetwork:
70-
driver: host
71-
enable_ipv6: true
63+
network_mode: host
64+
7265
```
7366

7467
## Parameters
@@ -114,13 +107,15 @@ If you are new to containers please see rather [Detailed first setup guide](docs
114107

115108
``` bash
116109
ovpn_enconf basic_nat
110+
#Out interface [eth0]: <interface connected to the Internet>
117111
#Protocol udp, tcp, udp6, tcp6 [udp]:
118112
#VPN network [10.0.0.0]:
119113
#Port [1194]:
120114
#Public IP or domain of server: <YOUR PUBLIC IP>
121115
#DNS1 [8.8.8.8]:
122116
#DNS2 [8.8.4.4]:
123117
```
118+
124119
4. Enable **port forwarding** on your router so OpenVPN server will be accessible from the internet.
125120
5. Add clients
126121

docs/SetupGuide.md

Lines changed: 1 addition & 0 deletions
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]:

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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 6 additions & 0 deletions
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

Lines changed: 2 additions & 2 deletions
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

0 commit comments

Comments
 (0)