Omit the use of sudo
when running as root.
This commit is contained in:
parent
771531167c
commit
d33c43030d
1 changed files with 6 additions and 1 deletions
|
@ -370,7 +370,12 @@ sudo -k
|
|||
# one of them.
|
||||
while read -r addr ; do
|
||||
echo "Banning ${addr} ..."
|
||||
sudo fail2ban-client set apache-badbots banip "${addr}"
|
||||
if [[ $(id -un) == "root" ]] ; then
|
||||
# Don't use sudo when we're running as root.
|
||||
fail2ban-client set apache-auth banip "${addr}"
|
||||
else
|
||||
sudo fail2ban-client set apache-auth banip "${addr}"
|
||||
fi
|
||||
done < "${banlist}"
|
||||
|
||||
echo -e "${green}All done!${reset}"
|
||||
|
|
Loading…
Reference in a new issue