Skip to content

feat(rust-plugins): scaffold notification-email crate, workspace-ify rust-plugins - #6427

Draft
Tpo76 wants to merge 7 commits into
developfrom
claude/email-notification-rust-conversion-no8ahj
Draft

Tpo76 wants to merge 7 commits into
developfrom
claude/email-notification-rust-conversion-no8ahj

Conversation

@Tpo76

@Tpo76 Tpo76 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Converts rust-plugins/ into a Cargo workspace (existing SNMP plugin moved
to snmp/, unchanged) and adds a new notification-email crate: a Rust port
of notification::email::mode::alert (Perl).

Ports the CLI option surface 1:1 (same flag names/defaults) so existing
Centreon Engine notification commands keep working, the four
host/service/BAM/meta-service message builders, the HTML/CSS templates
(via a small TMPL_VAR/TMPL_IF renderer mirroring the subset of
HTML::Template actually used), the generateImage.php graph fetch, and
MIME assembly + SMTP send via lettre. Verified against a stub SMTP
server: subject, plaintext and HTML parts match the Perl plugin's output.

CI/packaging for the new crate is intentionally left for a follow-up so
this change doesn't touch the release pipeline.

…rust-plugins

Converts rust-plugins/ into a Cargo workspace (existing SNMP plugin moved
to snmp/, unchanged) and adds a new notification-email crate: a Rust port
of notification::email::mode::alert (Perl).

Ports the CLI option surface 1:1 (same flag names/defaults) so existing
Centreon Engine notification commands keep working, the four
host/service/BAM/meta-service message builders, the HTML/CSS templates
(via a small TMPL_VAR/TMPL_IF renderer mirroring the subset of
HTML::Template actually used), the generateImage.php graph fetch, and
MIME assembly + SMTP send via lettre. Verified against a stub SMTP
server: subject, plaintext and HTML parts match the Perl plugin's output.

CI/packaging for the new crate is intentionally left for a follow-up so
this change doesn't touch the release pipeline.
Adds .github/workflows/notification-email.yml (build + package jobs,
mirroring generic-plugins.yml's structure) and its nfpm packaging
config, producing centreon-plugin-notification-email-rs rpm/deb
packages - named after the existing "-rs" convention used for other
Rust companions to Perl plugins, so it can coexist with the current
centreon-plugin-Notification-Email package during the transition.

The new crate needs a C toolchain (ring, via lettre's rustls-tls) that
the pure-Rust SNMP plugin never did, so the build job installs
musl-tools and points cc-rs at musl-gcc explicitly. Verified locally:
a full musl-cross release build produces a statically linked binary
(no NEEDED entries, same check the SNMP job runs).

Also scopes generic-plugins.yml's cargo invocations to the snmp/
member directory (cd rust-plugins/snmp instead of rust-plugins/) so
the existing SNMP release pipeline can't be affected by changes to
other workspace members going forward, and narrows its path triggers
off the now-shared rust-plugins/** so the two plugins' CI runs stay
independent. Verified the artifact still lands in the shared
rust-plugins/target/release/ that the rest of the job expects, and
that both crates' tests still pass when run this way from a clean
target dir.

Deliberately not included: a Robot Framework test job (none exist yet
for this plugin) and the Artifactory/Pulp delivery jobs - publishing
this first-pass port to production package repositories on every
push to develop/master is a separate decision for once the port has
been validated further.
Perl's q{...} string literal includes the newline immediately after the
opening brace, so notification::email::templates::{style,host,service,
bam,metaservice} all render with a leading blank line before their
content (before <!doctype html>, and before the <style> block injected
via dynamicCss). The extraction that produced this crate's templates/*
files started copying from the line after `return q{`, silently
dropping that leading newline.

Found by diffing the Rust and Perl plugins' actual SMTP output
byte-for-byte for all four notification types (host/service/BAM/meta-
service), via a stub SMTP server and a stub generateImage.php. Before
this fix, that was the only difference for host/service/meta-service
and the only difference for BAM was none. After it, all four are
identical except for JSON key order in the `?details=` query parameter
of the "More Information" link - which Perl's own hash key randomization
makes non-deterministic anyway, so there's nothing to match there.
@Tpo76
Tpo76 requested review from a team as code owners September 9, 2026 07:06
@Tpo76
Tpo76 requested review from Nivoky, mushroomempires and omercier and removed request for a team September 9, 2026 07:06
Comment thread rust-plugins/notification-email/Cargo.toml
@Tpo76
Tpo76 marked this pull request as draft September 9, 2026 07:08
Aikido flagged CVE-2026-46428: an inverted-boolean bug in lettre's
boring-tls integration silently disabled TLS hostname verification
for versions 0.10.1 to <0.11.22. Fixed upstream in 0.11.22.

This crate was already unaffected in practice - Cargo.lock already
resolved lettre to 0.11.23, and the "rustls-tls" feature is the only
TLS backend enabled here (boring-tls, the only backend the CVE
affects, isn't). But Cargo.toml's open "0.11" range still technically
permitted a vulnerable version, so tightening it to >=0.11.22 makes
that a manifest-level guarantee rather than something that happens to
hold today.
@Tpo76 Tpo76 added the upload-artifacts label Sep 9, 2026 — with Claude
claude and others added 3 commits September 9, 2026 08:17
clippy::collapsible_if - the nested string-match check can only ever
run once the UTF-8 decode succeeds, so it collapses into a single
condition with no behavior change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants