dnf-automatic notification transition for security-only alerts on Rocky Linux 9
0 reputation · 25 Jul 2020, 10:41 UTC
0 reputation · 25 Jul 2020, 10:41 UTC
Implementing a low-noise alerting system on Rocky Linux 9 requires a specific configuration of dnf-automatic to ensure that only critical security patches trigger notifications, rather than every available package update.
The goal is to utilize the upgrade_type = security setting within /etc/dnf/automatic.conf while maintaining apply_updates = no to prevent unattended system changes. This setup relies on the email emitter to surface pending updates to administrators.
However, the email emitter depends on a functioning local Mail Transfer Agent (MTA). If the local MTA is misconfigured or absent, dnf-automatic may fail to deliver alerts silently without generating a visible system error.
34775 reputation · 25 Jul 2020, 15:05 UTC
To confirm that the email emitter in dnf-automatic is working and to avoid silent failures when the local MTA is unavailable, follow these steps:
mailto setting in /etc/dnf/automatic.conf points to an executable that behaves like sendmail -t (e.g., /usr/sbin/sendmail).echo -e "Subject: dnf-automatic test\n\nThis is a test message." | /usr/sbin/sendmail -t
Then check the mail log for a successful entry:
grep "status=sent" /var/log/maillog
or view the queue with mailq; an empty queue after a short wait indicates the message was accepted and delivered locally.journalctl -u dnf-automatic.timer --since "10 minutes ago" | grep -i email
A non‑zero exit from the sendmail command will appear as an error here.The email emitter relies on a local MTA to accept mail from the sendmail command. If the MTA is missing or misconfigured, the command may fail silently unless its exit status is logged by dnf-automatic or the system mail log.
upgrade_type = security and apply_updates = no, only security errata trigger the email emitter.relayhost = [] and mydestination = $myhostname, localhost.localdomain, localhost) will accept locally generated mail and store it in the system mail spool, making delivery observable via mailq or /var/log/maillog.dnf-automatic logs an error to the journal; otherwise, no error is visible.mailto setting to a wrapper script that logs the message, for example:
# /usr/local/bin/dnf-automatic-mail-logger
#!/bin/sh
logger -t dnf-automatic "$(cat)"
Make it executable and set mailto = /usr/local/bin/dnf-automatic-mail-logger in /etc/dnf/automatic.conf. This ensures notifications are always visible in the system journal.mailq or the log file for pending messages and alerts if the queue grows unexpectedly.The steps assume you have root access to modify /etc/dnf/automatic.conf and to install or configure a local MTA. If the system is intentionally kept without any MTA, the wrapper‑script approach is the only reliable way to avoid silent drops.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.