Updated knockd enablement.

This commit is contained in:
2020-01-26 07:19:38 +13:00
parent 447fbd715b
commit 72d640c2ff

View File

@ -50,8 +50,8 @@ echo "PS1='\[\033[02;31m\]\u@\H:\[\033[01;34m\]\w\$\[\033[00m\] '" >> /rootfs/ho
# Post install firewall configuration # Post install firewall configuration
#================================================================ #================================================================
echo "Switch to legacy iptables for k3s support" echo "Switch to legacy iptables for k3s support"
#iptables -F iptables -F
#update-alternatives --set iptables /usr/sbin/iptables-legacy update-alternatives --set iptables /usr/sbin/iptables-legacy
echo "Allowing local traffic in iptables" echo "Allowing local traffic in iptables"
iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -i lo -j ACCEPT
@ -67,6 +67,9 @@ systemctl start iptables-persistent
echo "Ensure iptables-persistent is enabled" echo "Ensure iptables-persistent is enabled"
systemctl enable iptables-persistent systemctl enable iptables-persistent
echo "Ensure firewall rules are saved"
dpkg-reconfigure -y iptables-persistent
#================================================================ #================================================================
@ -91,7 +94,12 @@ EOF
echo "Enabling port knocking..." echo "Enabling port knocking..."
sed -i "s/START_KNOCKD=0/START_KNOCKD=1/" /rootfs/etc/default/knockd sed -i "s/START_KNOCKD=0/START_KNOCKD=1/" /rootfs/etc/default/knockd
systemctl enable knockd cat << EOF >> /rootfs/lib/systemd/system/knockd.service
[Install]
WantedBy=multi-user.target
Alias=knockd.service
EOF
systemctl enable knockd.service
echo "Restarting knock service..." echo "Restarting knock service..."
systemctl restart knockd systemctl restart knockd