Skip to content

Commit 542f934

Browse files
juronjatremor021
andauthored
Alpine-Wireguard: Fix for sysctl and ip_forward (#3744)
* moved ip forwarding to wireguard install and removed silent before echo command, testing if this was a bug * Adding $STD before echo command * Update install/alpine-wireguard-install.sh Co-authored-by: Slaviša Arežina <[email protected]> --------- Co-authored-by: Slaviša Arežina <[email protected]>
1 parent 9ef7ad5 commit 542f934

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

install/alpine-wireguard-install.sh

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ update_os
1515

1616
msg_info "Installing Dependencies"
1717
$STD apk add \
18-
newt \
19-
curl \
20-
openssh \
21-
nano \
22-
mc \
23-
gpg \
24-
iptables \
25-
openrc
18+
newt \
19+
curl \
20+
openssh \
21+
nano \
22+
mc \
23+
gpg \
24+
iptables \
25+
openrc
2626
msg_ok "Installed Dependencies"
2727

2828
msg_info "Installing WireGuard"
2929
$STD apk add --no-cache wireguard-tools
3030
if [[ ! -L /etc/init.d/wg-quick.wg0 ]]; then
31-
ln -s /etc/init.d/wg-quick /etc/init.d/wg-quick.wg0
31+
ln -s /etc/init.d/wg-quick /etc/init.d/wg-quick.wg0
3232
fi
3333

3434
private_key=$(wg genkey)
@@ -41,32 +41,33 @@ PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACC
4141
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;
4242
ListenPort = 51820
4343
EOF
44+
echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf
45+
$STD rc-update add sysctl
46+
$STD sysctl -p /etc/sysctl.conf
4447
msg_ok "Installed WireGuard"
4548

4649
read -rp "Do you want to install WGDashboard? (y/N): " INSTALL_WGD
4750
if [[ "$INSTALL_WGD" =~ ^[Yy]$ ]]; then
48-
msg_info "Installing additional dependencies for WGDashboard"
49-
$STD apk add --no-cache \
50-
python3 \
51-
py3-pip \
52-
git \
53-
sudo \
54-
musl-dev \
55-
linux-headers \
56-
gcc \
57-
python3-dev
58-
msg_ok "Installed additional dependencies for WGDashboard"
59-
msg_info "Installing WGDashboard"
60-
git clone -q https://github.com/donaldzou/WGDashboard.git /etc/wgdashboard
61-
cd /etc/wgdashboard/src || exit
62-
chmod u+x wgd.sh
63-
$STD ./wgd.sh install
64-
$STD echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf
65-
sysctl -p /etc/sysctl.conf
66-
msg_ok "Installed WGDashboard"
51+
msg_info "Installing additional dependencies for WGDashboard"
52+
$STD apk add --no-cache \
53+
python3 \
54+
py3-pip \
55+
git \
56+
sudo \
57+
musl-dev \
58+
linux-headers \
59+
gcc \
60+
python3-dev
61+
msg_ok "Installed additional dependencies for WGDashboard"
62+
msg_info "Installing WGDashboard"
63+
git clone -q https://github.com/donaldzou/WGDashboard.git /etc/wgdashboard
64+
cd /etc/wgdashboard/src || exit
65+
chmod u+x wgd.sh
66+
$STD ./wgd.sh install
67+
msg_ok "Installed WGDashboard"
6768

68-
msg_info "Creating Service for WGDashboard"
69-
cat <<EOF >/etc/init.d/wg-dashboard
69+
msg_info "Creating Service for WGDashboard"
70+
cat <<EOF >/etc/init.d/wg-dashboard
7071
#!/sbin/openrc-run
7172
7273
description="WireGuard Dashboard Service"
@@ -89,10 +90,10 @@ stop() {
8990
eend $?
9091
}
9192
EOF
92-
chmod +x /etc/init.d/wg-dashboard
93-
$STD rc-update add wg-dashboard default
94-
$STD rc-service wg-dashboard start
95-
msg_ok "Created Service for WGDashboard"
93+
chmod +x /etc/init.d/wg-dashboard
94+
$STD rc-update add wg-dashboard default
95+
$STD rc-service wg-dashboard start
96+
msg_ok "Created Service for WGDashboard"
9697

9798
fi
9899

0 commit comments

Comments
 (0)