alpine: add ssh iptable rules
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user