mitchellkrogza / apache-ultimate-bad-bot-blocker

Apache Block Bad Bots, (Referer) Spam Referrer Blocker, Vulnerability Scanners, Malware, Adware, Ransomware, Malicious Sites, Wordpress Theme Detectors and Fail2Ban Jail for Repeat Offenders
Other
826 stars 181 forks source link

[BUG] - Sendmail improperly uses the -t option which cases exit status = 1 #168

Closed ddarbyson closed 2 years ago

ddarbyson commented 2 years ago

Bug Description

update-apacheblocker.sh improperly uses -t option with sendmail, which seems to have inconsistent behavior between implementations. Using -t with exim causes message delivery failure with the following message:

A message that you sent using the -t command line option contained no
addresses that were not also on the command line, and were therefore
suppressed. This left no recipient addresses, and so no delivery could
be attempted.

Exim's -t documentation

-t When Exim is receiving a locally-generated, non-SMTP message on its standard input, the -t option causes the recipients of the message to be obtained from the To:, Cc:, and Bcc: header lines in the message instead of from the command arguments.

To Reproduce

This is performed on a cPanel server.

$ echo -e "Subject: test" | sendmail -t test@example.com`
2021-12-10 08:30:04 1mvfyO-0005st-Qd 1mvfyO-0005st-Qd no recipients found in headers`

$ echo $?
1

When using a program like Cronic which safely quiets down cron emails from update-apacheblocker.sh, the exit status of 1 due to the improper use of sendmail -t option produces an email alert almost everyday due to the frequent updates to apache-ultimate-bad-bot-blocker.

Expected Behaviour

$ echo -e "To: test@example.com\nSubject: test" | sendmail -t`

$ echo $?
0

Screenshots

Screen Shot 2021-12-13 at 3 31 59 PM

Server:

ddarbyson commented 2 years ago

I've fixed the issue and created a pull request here https://github.com/mitchellkrogza/apache-ultimate-bad-bot-blocker/pull/169

ddarbyson commented 2 years ago

Thanks for accepting my pull request!