Skip to content

Commit a1c8535

Browse files
committed
Fix of issue #5, more explicit iptables rules, release 0.1.5
1 parent 6b2701d commit a1c8535

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=0.1.4
1+
VERSION=0.1.5
22
BUILD=`git rev-parse --short=8 HEAD`
33
.PHONY: all fmt static precommit arm64 amd64 fmt static test release release_dir
44

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ Make sure you have WireGuard and iptables installed
2929
To download using curl run:
3030
```shell
3131
# for x86_64
32-
curl -SL https://github.com/andrianbdn/wg-cmd/releases/download/v0.1.4/wg-cmd-0.1.4-linux-amd64 -o /usr/local/bin/wg-cmd
32+
curl -SL https://github.com/andrianbdn/wg-cmd/releases/download/v0.1.5/wg-cmd-0.1.4-linux-amd64 -o /usr/local/bin/wg-cmd
3333

3434
# for arm64
35-
curl -SL https://github.com/andrianbdn/wg-cmd/releases/download/v0.1.4/wg-cmd-0.1.4-linux-arm64 -o /usr/local/bin/wg-cmd
35+
curl -SL https://github.com/andrianbdn/wg-cmd/releases/download/v0.1.5/wg-cmd-0.1.4-linux-arm64 -o /usr/local/bin/wg-cmd
3636
```
3737

3838
Set proper permissions and run the tool:
@@ -169,6 +169,7 @@ It was tested on:
169169
- Ubuntu 22.04
170170
- Rocky Linux 9
171171
- Debian 11
172+
- Debian 12
172173

173174
# Notes
174175
There is no commercial purpose behind WG Commander.

backend/server.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,34 @@ func NewServerWithBlueprint(b ServerBlueprint) *Server {
8080

8181
if b.Nat4 {
8282
s.PostUp4 = fmt.Sprintf("iptables -A FORWARD -i %s -j ACCEPT; "+
83-
"iptables -t nat -A POSTROUTING -o %s -j MASQUERADE", b.InterfaceName, sysinfo.DefaultIP4Interface())
83+
"iptables -A FORWARD -o %s -j ACCEPT; "+
84+
"iptables -t nat -A POSTROUTING -o %s -j MASQUERADE",
85+
b.InterfaceName,
86+
b.InterfaceName,
87+
sysinfo.DefaultIP4Interface())
8488

8589
s.PostDown4 = fmt.Sprintf("iptables -D FORWARD -i %s -j ACCEPT; "+
86-
"iptables -t nat -D POSTROUTING -o %s -j MASQUERADE", b.InterfaceName, sysinfo.DefaultIP4Interface())
90+
"iptables -D FORWARD -o %s -j ACCEPT; "+
91+
"iptables -t nat -D POSTROUTING -o %s -j MASQUERADE",
92+
b.InterfaceName,
93+
b.InterfaceName,
94+
sysinfo.DefaultIP4Interface())
8795
}
8896

8997
if b.Nat6 {
9098
s.PostUp6 = fmt.Sprintf("ip6tables -A FORWARD -i %s -j ACCEPT; "+
91-
"ip6tables -t nat -A POSTROUTING -o %s -j MASQUERADE", b.InterfaceName, sysinfo.DefaultIP6Interface())
99+
"ip6tables -A FORWARD -o %s -j ACCEPT; "+
100+
"ip6tables -t nat -A POSTROUTING -o %s -j MASQUERADE",
101+
b.InterfaceName,
102+
b.InterfaceName,
103+
sysinfo.DefaultIP6Interface())
104+
92105
s.PostDown6 = fmt.Sprintf("ip6tables -D FORWARD -i %s -j ACCEPT; "+
93-
"ip6tables -t nat -D POSTROUTING -o %s -j MASQUERADE", b.InterfaceName, sysinfo.DefaultIP6Interface())
106+
"ip6tables -D FORWARD -o %s -j ACCEPT; "+
107+
"ip6tables -t nat -D POSTROUTING -o %s -j MASQUERADE",
108+
b.InterfaceName,
109+
b.InterfaceName,
110+
sysinfo.DefaultIP6Interface())
94111
}
95112

96113
if b.Nat4 {

0 commit comments

Comments
 (0)