nginx-ultimate-bad-bot-blocker
nginx-ultimate-bad-bot-blocker copied to clipboard
[BUG] The "-f" flag does not work with "mail"
Describe the bug
The "-f" flag (Mailgun / Mail From Address) does not work
To Reproduce
Run: $ update-ngxblocker -f FROM_ADDRESS -e TO_ADDRESS [...] mail: conflicting options
And the email is not sent.
Expected behavior
The email should be sent with the specified "from" address
Server (please complete the following information):
-
Operating System:
-
[X ] Ubuntu
-
Specify Exact Version of OS: Ubuntu 22.04.2 LTS
Post output of uname -a here Linux XXXXX 5.15.0-72-generic #79-Ubuntu SMP Wed Apr 19 08:22:18 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Additional information
The problem is the that "-f" flag (at least on Ubuntu) calls the "mail" command with the "-f FROM_ADDRESS" option (function send_email), but the "-f" flag for the mail command is to specify a mailbox file. I was able to workaround this issue by using the "-a" (add header) specifying the from address as per the following diff:
275c275
< cat $EMAIL_REPORT | $mail_path -f "$MG_FROM" -s "Nginx Bad Bot Blocker Updated" $EMAIL
---
> cat $EMAIL_REPORT | $mail_path -a "From: $MG_FROM" -s "Nginx Bad Bot Blocker Updated" $EMAIL
for me in rocky linux it is mail -r
so there is a little mess in this area i guess :)