From: Lukas Wagner <l.wagner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v3 many 0/5] notifications: feed system mails into proxmox_notify
Date: Fri, 10 Nov 2023 15:57:48 +0100 [thread overview]
Message-ID: <20231110145753.809938-1-l.wagner@proxmox.com> (raw)
The aim of this patch series is to adapt `proxmox-mail-forward`
so that it forwards emails that were sent to the local root user
through the `proxmox_notify` crate.
A short summary of the status quo:
Any mail that is sent to the local `root` user is forwarded by
postfix to the `proxmox-mail-forward` binary, which receives the
mail via STDIN. `proxmox-mail-forward` looks up the email address
configured for the `root@pam` user in /etc/{proxmox-backup,pve}/user.cfg
and then forwards the mail to this address by calling `sendmail`
This patch series modifies `proxmox-mail-forward` in the following way:
`proxmox-mail-forward` instantiates the configuration for `proxmox_notify`
by reading `/etc/{proxmox-backup,pve}/notifications.cfg.
The forwarding behavior is the following:
- PVE installed: Use PVE's notifications.cfg
- PBS installed: Use PBS's notifications.cfg if present. If not,
use an empty configuration and add a default sendmail target and
a matcher - this is needed because notifications are not yet
integrated in PBS. In that way, the forwarding behavior is still
the same as before on PBS (forward to root@pam via sendmail).
- PVE/PBS co-installed: Use PVE's config *and* PBS's config.
If PBS's notifications.cfg does not exist,
a default sendmail target will *not* be added, to avoid
forwarding the same mail twice.
For co-installations we assume for now that PVE has a sensible
matcher/target config for forwarded mails.
Required patches:
- series: 'overhaul notification system, use matchers instead of filters' [2]
- pve-docs: 'notifications: update docs to for matcher-based notifications' [3]
- Also, these two patches for 'proxmox' from the SMTP target series [4] are needed:
- 'sys: email: add `forward`'
- 'notify: add mechanisms for email message forwarding'
Changelog:
- v1 -> v2:
- Rebased
- Apply the same fix for the PVE context as in [1]
- v2 -> v3:
- Rebased on top of matcher-based notification system:
This simplifies proxmox-mail-forward by a great deal, since
notification routing is moved into the matcher. This means
proxmox-mail-forward does not need to read /etc/pve/datacenter.cfg
any more to determine the target for the notification.
[1] https://lists.proxmox.com/pipermail/pve-devel/2023-October/059294.html
[2] https://lists.proxmox.com/pipermail/pve-devel/2023-November/059818.html
[3] https://lists.proxmox.com/pipermail/pve-devel/2023-November/059872.html
[4] https://lists.proxmox.com/pipermail/pve-devel/2023-November/059894.html
[5] https://lists.proxmox.com/pipermail/pve-devel/2023-November/059899.html
[6] https://lists.proxmox.com/pipermail/pve-devel/2023-November/059900.html
proxmox:
Lukas Wagner (1):
notify: add PVE/PBS context
proxmox-notify/Cargo.toml | 3 +-
proxmox-notify/src/context.rs | 21 -----
proxmox-notify/src/context/common.rs | 27 ++++++
proxmox-notify/src/context/mod.rs | 36 ++++++++
proxmox-notify/src/context/pbs.rs | 130 +++++++++++++++++++++++++++
proxmox-notify/src/context/pve.rs | 82 +++++++++++++++++
6 files changed, 277 insertions(+), 22 deletions(-)
delete mode 100644 proxmox-notify/src/context.rs
create mode 100644 proxmox-notify/src/context/common.rs
create mode 100644 proxmox-notify/src/context/mod.rs
create mode 100644 proxmox-notify/src/context/pbs.rs
create mode 100644 proxmox-notify/src/context/pve.rs
proxmox-perl-rs:
Lukas Wagner (1):
pve-rs: notify: remove notify_context for PVE
pve-rs/Cargo.toml | 2 +-
pve-rs/src/lib.rs | 7 ++-
pve-rs/src/notify_context.rs | 117 -----------------------------------
3 files changed, 5 insertions(+), 121 deletions(-)
delete mode 100644 pve-rs/src/notify_context.rs
proxmox-mail-forward:
Lukas Wagner (2):
feed forwarded mails into proxmox_notify
update d/control
Cargo.toml | 6 +-
debian/control | 6 +-
src/main.rs | 255 +++++++++++++++++++++++--------------------------
3 files changed, 125 insertions(+), 142 deletions(-)
pve-docs:
Lukas Wagner (1):
notifications: add documentation for system mail forwarding
notifications.adoc | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Summary over all repositories:
13 files changed, 423 insertions(+), 285 deletions(-)
--
murpp v0.4.0
next reply other threads:[~2023-11-10 14:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 14:57 Lukas Wagner [this message]
2023-11-10 14:57 ` [pve-devel] [PATCH v3 proxmox 1/5] notify: add PVE/PBS context Lukas Wagner
2023-11-10 14:57 ` [pve-devel] [PATCH v3 proxmox-perl-rs 2/5] pve-rs: notify: remove notify_context for PVE Lukas Wagner
2023-11-10 14:57 ` [pve-devel] [PATCH v3 proxmox-mail-forward 3/5] feed forwarded mails into proxmox_notify Lukas Wagner
2023-11-10 14:57 ` [pve-devel] [PATCH v3 proxmox-mail-forward 4/5] update d/control Lukas Wagner
2023-11-10 14:57 ` [pve-devel] [PATCH v3 pve-docs 5/5] notifications: add documentation for system mail forwarding Lukas Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231110145753.809938-1-l.wagner@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox