Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set Logwatch sender address? #2360

Closed
craue opened this issue Jan 6, 2022 · 3 comments · Fixed by #2362
Closed

How to set Logwatch sender address? #2360

craue opened this issue Jan 6, 2022 · 3 comments · Fixed by #2362
Labels
kind/question Someone asked a question - feel free to answer meta/help wanted The OP requests help from others - chime in! :D meta/needs triage This issue / PR needs checks and verification from maintainers priority/low
Milestone

Comments

@craue
Copy link
Contributor

craue commented Jan 6, 2022

Subject

I would like some feedback concerning a use case.

Description

By default, when enabling logwatch and pflogsumm reports, pflogsumm sender address is "mailserver-report@hostname.domainname" and logwatch sender address is "root@hostname.domainname". Now I'd like to change both to be sent from "whatever@domainname" but couldn't find out how.

I tried various environment variables, but none actually changes the sender e-mail address for the logwatch report ...

  • REPORT_SENDER: sets sender for pflogsumm only, not logwatch
  • POSTMASTER_ADDRESS: sets recipient addresses (for pflogsumm and logwatch) only, not sender
  • PFLOGSUMM_SENDER: sets sender for pflogsumm only, as documented (and expected)
  • LOGWATCH_SENDER: undocumented and obviously not working (but I wanted to be sure)

So is there a way to set the sender address for logwatch as well?

@craue craue added kind/question Someone asked a question - feel free to answer meta/help wanted The OP requests help from others - chime in! :D meta/needs triage This issue / PR needs checks and verification from maintainers priority/low labels Jan 6, 2022
@casperklein
Copy link
Member

casperklein commented Jan 6, 2022

You can try putting something like this in your user-patches.sh (not tested):

echo "MailFrom = foo@example.com" >> /etc/logwatch/conf/logfiles/maillog.conf

Edit:

If that doesn't work, here are two more things to try:

sed -i 's|^mailer = "/usr/sbin/sendmail -t"|mailer = "/usr/sbin/sendmail -t -f foo@example.com"|' /usr/share/logwatch/dist.conf/logwatch.conf

or

sed -i 's|^mailer = "/usr/sbin/sendmail -t"|mailer = "/usr/sbin/sendmail -t -f foo@example.com"|' /usr/share/logwatch/default.conf/logwatch.conf

@craue
Copy link
Contributor Author

craue commented Jan 6, 2022

Thank you for the quick response. This led me in the right direction.

echo "MailFrom = foo@example.com" >> /etc/logwatch/conf/logfiles/maillog.conf indeed doesn't make a difference.

Taking a look at /usr/share/logwatch/dist.conf/logwatch.conf revealed the entry MailFrom = root, so I changed this instead and it's working: sed -i 's|^MailFrom = root$|MailFrom = foo@example.com|' /usr/share/logwatch/dist.conf/logwatch.conf

Interestingly, other directives put into /etc/logwatch/conf/logfiles/maillog.conf are ignored as well, like Detail = High. I also needed to add it in /usr/share/logwatch/dist.conf/logwatch.conf.

Having an env var at least for the sender address would be much more convenient, though. 😏

@georglauterbach
Copy link
Member

georglauterbach commented Jan 6, 2022

@craue If you'd like to give it a try, you may refer to #2358 which provides a bit of structure for someone new to the project.

@craue craue mentioned this issue Jan 6, 2022
8 tasks
@craue craue closed this as completed Jan 10, 2022
@georglauterbach georglauterbach linked a pull request Jan 10, 2022 that will close this issue
8 tasks
@georglauterbach georglauterbach added this to the v10.5.0 milestone Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Someone asked a question - feel free to answer meta/help wanted The OP requests help from others - chime in! :D meta/needs triage This issue / PR needs checks and verification from maintainers priority/low
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants