alpine: add ssh iptable rules

This commit is contained in:
2025-11-01 20:15:38 +01:00
parent c4ce343e69
commit 49fd25152d
2 changed files with 2 additions and 6 deletions

View File

@@ -6,4 +6,6 @@
-A INPUT -i lo -j ACCEPT -A INPUT -i lo -j ACCEPT
# Ping # Ping
-A INPUT -p icmp -j ACCEPT -A INPUT -p icmp -j ACCEPT
# SSH
-A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT
COMMIT COMMIT

View File

@@ -67,12 +67,6 @@ IP6TablesInstall() {
SSHEnableRootLogin() { SSHEnableRootLogin() {
sed -i "/PermitRootLogin prohibit-password/c\PermitRootLogin yes #prohibit-password" /etc/ssh/sshd_config sed -i "/PermitRootLogin prohibit-password/c\PermitRootLogin yes #prohibit-password" /etc/ssh/sshd_config
service sshd restart service sshd restart
if [ -f "/etc/iptables/rules-save" ]; then
sed -i '/^-A INPUT -i lo -j ACCEPT.*/a -A INPUT -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT' /etc/iptables/rules-save
sed -i '/^-A INPUT -i lo -j ACCEPT.*/a # SSH' /etc/iptables/rules-save
iptables-restore /etc/iptables/rules-save
fi
} }
SNMPDInstall() { SNMPDInstall() {
cummunityname=public cummunityname=public