sshg-fw-firewalld.sh (sshguard-2.4.1) | : | sshg-fw-firewalld.sh (sshguard-2.4.2) | ||
---|---|---|---|---|
#!/bin/sh | #!/bin/sh | |||
# sshg-fw-firewalld | # sshg-fw-firewalld | |||
# This file is part of SSHGuard. | # This file is part of SSHGuard. | |||
FIREW_CMD="firewall-cmd --quiet" | FIREW_CMD="firewall-cmd --quiet" | |||
IPSET_CMD="ipset -quiet" | ||||
fw_init() { | fw_init() { | |||
${FIREW_CMD} --query-rich-rule="rule family=ipv6 source ipset=sshguard6 drop " || { | ${FIREW_CMD} --query-rich-rule="rule family=ipv6 source ipset=sshguard6 drop " || { | |||
${FIREW_CMD} --permanent --new-ipset="sshguard6" --type="hash:net" --optio n="family=inet6" | ${FIREW_CMD} --permanent --new-ipset="sshguard6" --type="hash:net" --optio n="family=inet6" | |||
${FIREW_CMD} --permanent --add-rich-rule="rule family=ipv6 source ipset=ss hguard6 drop" | ${FIREW_CMD} --permanent --add-rich-rule="rule family=ipv6 source ipset=ss hguard6 drop" | |||
} | } | |||
${FIREW_CMD} --query-rich-rule="rule family=ipv4 source ipset=sshguard4 drop " || { | ${FIREW_CMD} --query-rich-rule="rule family=ipv4 source ipset=sshguard4 drop " || { | |||
${FIREW_CMD} --permanent --new-ipset="sshguard4" --type="hash:net" --optio n="family=inet" | ${FIREW_CMD} --permanent --new-ipset="sshguard4" --type="hash:net" --optio n="family=inet" | |||
${FIREW_CMD} --permanent --add-rich-rule="rule family=ipv4 source ipset=ss hguard4 drop" | ${FIREW_CMD} --permanent --add-rich-rule="rule family=ipv4 source ipset=ss hguard4 drop" | |||
} | } | |||
skipping to change at line 29 | skipping to change at line 28 | |||
fw_block() { | fw_block() { | |||
${FIREW_CMD} --ipset="sshguard$2" --add-entry="$1/$3" | ${FIREW_CMD} --ipset="sshguard$2" --add-entry="$1/$3" | |||
} | } | |||
fw_release() { | fw_release() { | |||
${FIREW_CMD} --ipset="sshguard$2" --remove-entry="$1/$3" | ${FIREW_CMD} --ipset="sshguard$2" --remove-entry="$1/$3" | |||
} | } | |||
fw_flush() { | fw_flush() { | |||
${IPSET_CMD} flush sshguard6 | ${FIREW_CMD} --reload | |||
${IPSET_CMD} flush sshguard4 | ||||
} | } | |||
fw_fin() { | fw_fin() { | |||
: | : | |||
} | } | |||
End of changes. 2 change blocks. | ||||
3 lines changed or deleted | 1 lines changed or added |