[pve-devel] [PATCH v3 many 0/5] notifications: feed system mails into proxmox_notify

Lukas Wagner l.wagner at proxmox.com
Fri Nov 10 15:57:48 CET 2023


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 at 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 at 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






More information about the pve-devel mailing list