Restart rsyslog when modify auth.log

This commit is contained in:
q3aql 2024-04-05 14:11:53 +02:00
parent 80a0e9ee73
commit e0fd5d8194

View File

@ -18,7 +18,7 @@ fi
# Check dependencies
path_check="/usr/bin /bin /usr/local/bin /sbin ${HOME}/.local/bin"
dependencies="iptables cat grep sort sed rm echo"
dependencies="iptables cat grep sort sed rm echo systemctl"
dependencies_found=""
dependencies_not_found=""
for checkPath in ${path_check} ; do
@ -90,6 +90,7 @@ while [ ${blockauth} -eq 0 ] ; do
echo "blockauth: allowing access for ${user}" >> ${filelog}
sed -i "s/Failed password for ${user} from/blockauth\[allowed\]\: invalid pass for ${user} from/g" /var/log/auth.log
sed -i "s/Failed password for invalid user ${user} from/blockauth\[allowed\]\: invalid pass for ${user} from/g" /var/log/auth.log
systemctl restart rsyslog &> /dev/null
done
touch ${blocklist}
cat ${blocklist} > ${blocklist}.temp