Hello there,
I've wroting a script "filter_postfix_SASL_fail_dmn.sh" for notifying me if a SALS login failure was found:
For running the script I use in Centos 7.8 a systemd service called "maillogmon.service":
in /var/log/maillog I see cyclic the lines:
What's going wrong and how can I fix it? Basicly the script is working but the cyclic restarting of the service is unnormal I think.
Thanks, Frank
I've wroting a script "filter_postfix_SASL_fail_dmn.sh" for notifying me if a SALS login failure was found:
Bash:
#!/bin/sh
# Postfix SASL fail
tail -fn0 /var/log/maillog | while read line ; do
stamp=`grep "SASL PLAIN authentication failed" /var/log/maillog | tail -n 1 | cut -d ' ' -f 1-3`
ip=`grep "SASL PLAIN authentication failed" /var/log/maillog | tail -n 1 | cut -d '[' -f 3 | cut -d ']' -f 1`
mail -s "Postfix SASL failed" [email protected] <<< "Date: $stamp
IP: $ip
";
done
For running the script I use in Centos 7.8 a systemd service called "maillogmon.service":
Code:
[Unit]
Description=Mail Log Monitor SASL fail logins
After=network.target
[Service]
Type=simple
ExecStart=/bin/bash /usr/local/bin/filter_postfix_SASL_fail_dmn.sh
TimeoutStartSec=0
Restart=always
StartLimitInterval=0
[Install]
WantedBy=default.target
in /var/log/maillog I see cyclic the lines:
Code:
Sep 16 09:00:16 farm11 bash: tail: write error: Broken pipe
Sep 16 09:00:16 farm11 bash: tail: write error
Sep 16 09:00:16 farm11 systemd: maillogmon.service holdoff time over, scheduling restart.
Sep 16 09:00:16 farm11 systemd: Stopped Mail Log Monitor SASL fail logins.
Sep 16 09:00:16 farm11 systemd: Started Mail Log Monitor SASL fail logins.
What's going wrong and how can I fix it? Basicly the script is working but the cyclic restarting of the service is unnormal I think.
Thanks, Frank