97. RFC Index

Pepsi aims to be a standards-compliant MTA and a standards-compliant end-to-end crypto gateway. This chapter maps every RFC that Pepsi implements, or deliberately does not yet implement, to where in the system it is realised, so a reviewer can jump from a standard to its code and configuration.

The summary table lists every applicable RFC at a glance; the per-RFC notes below give the detail. RFCs that are planned but not yet implemented are collected under Applicable RFCs not yet implemented.

Not everything indexed here is an RFC. The OpenPGP Web Key Directory is an Internet-Draft; Autocrypt and the VKS key-server protocol are de-facto standards; NTLM is a Microsoft Open Specification; XOAUTH2 has no specification body at all; SRS and Maildir are published schemes that were never put through the IETF; FIPS 186-4 is a NIST publication. Each is what the deployed world actually speaks. They are listed after the RFCs, italicised, with their status named.

Implementing a standard is not the same as interoperating with the clients that claim to implement it. Client interoperability records which of these have been measured against real software, which are one-off observations, and which have never been run at all.

“Implemented in” names the module or program where the standard is realised, not every caller. Where a standard is only partly implemented — BINARYMIME of RFC 3030 — the cell says so. Standards Pepsi deliberately does not implement are under Applicable RFCs not yet implemented with the reason.

97.1. Summary table

RFC

Title (subject)

Implemented in

RFC 1035

Domain names — implementation and specification (DNS)

All DNS lookups; domain/label syntax in pepsi-common::domain

RFC 1870

SMTP service extension for message size declaration (SIZE)

Advertised and enforced by pepsi-ingress; the outbound client honours the next hop’s announced limit, pepsi-common::smtp::client

RFC 1918

Address allocation for private internets

Together with RFC 6598 and RFC 2544, the address ranges an outbound fetch refuses so a key-discovery URL cannot reach inside the deployment (pepsi-keydisc’s SSRF guard)

RFC 1951

DEFLATE compressed data format

The bound on decompressing OpenPGP data (pepsi-crypto::pgp): the plaintext recovered from one message is capped and refused past the cap rather than truncated, and fetched or harvested key material that contains a compressed packet at all is refused rather than expanded

RFC 1153

Digest message format

The plain (non-MIME) digest form, pepsi-list::digest::build

RFC 1847

Security multiparts for MIME (multipart/signed, multipart/encrypted)

The two containers RFC 3156 and RFC 8551 build on, built and parsed by pepsi-crypto::mime; pepsi-common::mime detects a multipart/signed entity so that no conversion breaks it

RFC 2033

Local Mail Transfer Protocol (LMTP)

Local delivery to an MDA (Dovecot), pepsi-stage-relay-to-lmtp

RFC 2034

SMTP service extension for returning enhanced error codes

ENHANCEDSTATUSCODES, advertised by pepsi-ingress; every reply carries an RFC 3463 code

RFC 2045

MIME Part One: format of message bodies (transfer-encodings)

8-bit→7-bit body downgrade, pepsi-common::mime; the one reading of ambiguous transfer encodings at ingress (§6.4, §6.7, §6.8), pepsi-common::mime_anomaly

RFC 2046

MIME Part Two: media types (multipart and boundary syntax)

MIME tree parsing and boundary validation, pepsi-common::mime and pepsi-crypto::mime; empty, encoded-word and unclosed boundaries and a delimiter after the close delimiter settled at ingress (MIME_ANOMALIES)

RFC 2047

MIME Part Three: message header extensions (encoded-words)

UTF-8 header downgrade, pepsi-common::mime

RFC 2104

HMAC: keyed-hashing for message authentication

The SRS envelope-sender MAC (pepsi-common::srs), the Pepsi-Origin proof-of-origin header, and the key-encryption-key derivation in pepsi-common::keystore::wrap (an HKDF-Extract-shaped construction with a fixed label)

RFC 2195

IMAP/POP AUTHorize extension for simple challenge/response (CRAM-MD5)

Outbound SMTP AUTH to a smarthost, pepsi-common::smtp::sasl

RFC 2231

MIME parameter value and encoded word extensions

Read (continuations, extended values and charsets, §3–§4.1) by pepsi_common::mime::param, which filename filtering uses; emitted by the UTF-8 header downgrade in pepsi-common::mime, which rewrites a non-ASCII Content-Type/Content-Disposition parameter of any MIME part as name*=UTF-8''… (with *0*/*1* continuations for a long one) towards a hop without SMTPUTF8. The §5 encoded-word extension (language tags) is not emitted

RFC 2392

Content-ID and Message-ID uniform resource locators

The cid: reference from the payment-request auto-reply’s HTML to its inline QR-code image, pepsi-stage-anti-spam

RFC 2831

Using digest authentication as a SASL mechanism (DIGEST-MD5)

Outbound SMTP AUTH (deprecated; see RFC 6331), pepsi-common::smtp::sasl

RFC 2920

SMTP service extension for command pipelining

PIPELINING, advertised by pepsi-ingress; the outbound client writes the envelope and DATA in one go

RFC 2986

PKCS #10: certification request syntax

Certificate-signing requests for externally-issued S/MIME certificates, pepsi-crypto::keygen

RFC 3030

SMTP service extensions for large and binary messages (CHUNKING/BDAT)

pepsi-ingress (BINARYMIME not advertised)

RFC 3156

MIME security with OpenPGP (PGP/MIME)

multipart/encrypted and multipart/signed containers built and parsed by pepsi-crypto::mime; micalg from pepsi-crypto::pgp

RFC 3207

SMTP service extension for secure SMTP over TLS (STARTTLS)

pepsi-ingress listeners; outbound SMTP client

RFC 3339

Date and time on the Internet: timestamps

Report generation timestamps, pepsi-common::tlsrpt

RFC 3370

Cryptographic Message Syntax (CMS) algorithms

S/MIME digest and signature algorithm identifiers, pepsi-crypto::smime

RFC 3394

Advanced Encryption Standard (AES) key wrap algorithm

Wrapping the content-encryption key in an ECDH KeyAgreeRecipientInfo, pepsi-crypto::smime

RFC 2369

The use of URLs as meta-syntax for core mail list commands

The List-Help/List-Subscribe/List-Unsubscribe/List-Post/ List-Owner/List-Archive headers, pepsi-stage-list-post’s rfc-2369 handler

RFC 2919

List-Id: a structured field and namespace for the identification of mailing lists

Written as <listname.mailhost> by pepsi-stage-list-post’s rfc-2369 handler; read by pepsi-common::whitelist for the list-id whitelist rows of pepsi-stage-check-whitelist

RFC 3461

SMTP service extension for Delivery Status Notifications (DSN)

pepsi-common::dsn; ingress, relay stages, bounce stage

RFC 3463

Enhanced mail system status codes

DSN status codes, pepsi-stage-bounce

RFC 3464

An extensible message format for Delivery Status Notifications

multipart/report generation, pepsi-stage-bounce; and reading one, the single standard format among pepsi-stage-list-bounce’s seventeen bounce detectors

RFC 3492

Punycode

IDNA label encoding for internationalized domains, pepsi-common::domain and pepsi-common::dns

RFC 3565

Use of AES encryption in CMS

AES-256-CBC EnvelopedData, the downgrade container when a recipient cannot read AEAD (pepsi-crypto::smime)

RFC 3676

The text/plain format=flowed media type

Body-text extraction and the -- signature cut, pepsi-common::mime_text

RFC 3834

Recommendations for automatic responses to electronic mail

The shared “must not answer this automatically” rule set, pepsi-common::autoreply; Auto-Submitted on the automatic replies Pepsi originates, among them pepsi-stage-vacation’s, pepsi-stage-secretary’s, pepsi-stage-anti-spam’s and pepsi-stage-edit-settings’s

RFC 3848

ESMTP and LMTP transmission types (with clause)

Received: header (SMTP/ESMTP/ESMTPS/ESMTPA/ ESMTPSA), ingress

RFC 3864

Registration procedures for message header fields

The procedure Pepsi’s two private header fields (SMTP Protocol Extensions) are not registered under; both are unregistered by design

RFC 4013

SASLprep: stringprep profile for user names and passwords

SCRAM username/password preparation, pepsi-common::smtp::sasl

RFC 4021

Registration of mail and MIME header fields (here: Expires:)

The reply that carries a new TOTP second-factor secret is marked to expire at the end of its confirmation window, pepsi-stage-encrypt

RFC 4055

Additional algorithms and identifiers for RSA in PKIX

RSAES-OAEP and RSASSA-PSS parameter encoding, pepsi-crypto::smime

RFC 4121

The Kerberos 5 GSS-API mechanism, v2

Outbound smarthost AUTH = gssapi (via system Kerberos), pepsi-common::smtp::gssapi

RFC 4155

The application/mbox media type

mbox mailbox reading for whitelist import, pepsi-helper-mailbox-scan; archive import and export, pepsi-archive

RFC 4226

HOTP: an HMAC-based one-time password algorithm

The code computation under the TOTP second factor (RFC 6238), pepsi-common::keystore::otp

RFC 4422

Simple Authentication and Security Layer (SASL) — EXTERNAL mechanism

Outbound SMTP AUTH EXTERNAL via TLS client certificate (smarthost)

RFC 4511

LDAP: the protocol

LDAP key discovery, pepsi-keydisc’s ldap module (behind the ldap cargo feature, off by default)

RFC 4514

LDAP: string representation of distinguished names

Certificate subject/issuer DN rendering, pepsi-crypto::smime

RFC 4515

LDAP: string representation of search filters

Filter escaping for the LDAP discovery query — the injection guard, pepsi-keydisc

RFC 4616

The PLAIN SASL mechanism

Inbound (ingress) and outbound (smarthost) AUTH PLAIN

RFC 4648

The Base16, Base32, and Base64 data encodings

SRS hash encoding (pepsi-common::srs); key material

RFC 4752

The Kerberos V5 (GSSAPI) SASL mechanism

Outbound smarthost AUTH = gssapi, pepsi-common::smtp::gssapi

RFC 4954

SMTP service extension for authentication (AUTH)

Inbound AUTH PLAIN/LOGIN (ingress, TLS-only) and the full outbound smarthost SASL suite

RFC 5083

CMS AuthEnvelopedData content type

The default S/MIME encryption container (AES-256-GCM), pepsi-crypto::smime

RFC 5084

Using AES-CCM and AES-GCM in CMS

AES-256-GCM AuthEnvelopedData, the default S/MIME container, pepsi-crypto::smime

RFC 5064

The Archived-At message header field

The per-message archive URL a list post carries, added by pepsi-stage-list-post from the hash in pepsi-list::hash; served by pepsi-httpd

RFC 5228

Sieve: an email filtering language

Run by the MDA (Dovecot) on LMTP delivery; Pepsi implements no Sieve itself

RFC 5280

Internet X.509 PKI certificate and CRL profile

Certificate parsing, extension handling and path validation — name and policy constraints included, conformance-tested against NIST PKITS — pepsi-crypto::trust; issuance in pepsi-crypto::keygen; caIssuers (§4.2.2.1) followed by pepsi-keydisc when CA_ISSUERS_FETCH is on

RFC 5321

Simple Mail Transfer Protocol

Core of ingress and both relay stages; envelope handling, MX, null sender

RFC 5322

Internet Message Format

Header/body model (pepsi-common::message); parsing and signing

RFC 5480

Elliptic curve cryptography subject public key information

EC public-key encoding in certificates, pepsi-crypto::smime

RFC 5652

Cryptographic Message Syntax (CMS)

SignedData/EnvelopedData/certs-only built and opened by pepsi-crypto::smime (the cms crate supplies the types only)

RFC 5753

Use of ECC algorithms in CMS

ECDH key-agreement RecipientInfo (P-256/P-384 + X9.63 KDF + AES-KW), pepsi-crypto::smime

RFC 5758

Additional algorithms and identifiers for DSA and ECDSA in PKIX

ecdsa-with-SHA256/-SHA384 signature identifiers, pepsi-crypto::smime

RFC 5802

Salted Challenge Response Authentication Mechanism (SCRAM)

Outbound SCRAM-SHA-1/-SHA-256 (±``-PLUS``), pepsi-common::smtp::sasl

RFC 5890

Internationalized Domain Names for Applications (IDNA2008): definitions

Domain handling throughout, via the idna crate; see also RFC 3492

RFC 5915

Elliptic curve private key structure

EC private-key encoding, pepsi-crypto::keygen

RFC 5929

Channel bindings for TLS (tls-server-end-point)

SCRAM -PLUS channel binding, pepsi-common::smtp::sasl

RFC 5937

Using trust anchor constraints during certification path processing

An anchor’s nameConstraints, policy extensions and pathLenConstraint bind every chain through it, pepsi-crypto::trust

RFC 5958

Asymmetric key packages (PKCS #8)

Private-key encoding at rest, pepsi-crypto::keygen and pepsi-common::keys

RFC 6066

TLS extensions: server_name and status_request (OCSP stapling)

SNI on every TLS client and listener; a stapled OCSP response is read from the handshake, pepsi-common::smtp::ocsp

RFC 6125

Service identity in TLS (certificate name checking)

MTA-STS certificate validation, pepsi-stage-relay-to-internet

RFC 6152

SMTP service extension for 8-bit MIME transport (8BITMIME)

Advertised by ingress; per-hop re-advertise/downgrade in the relay stages

RFC 6238

TOTP: time-based one-time password algorithm

The optional per-address second factor for self-service key management and the optional second factor of a console account’s password sign-in (SHA-1, six digits, 30 s steps, one step of skew, replay and lockout enforced in SQL), pepsi-common::keystore::otp

RFC 6265

HTTP state management mechanism (cookies)

The administrative session cookie and the secure-link portal cookie, both __Host- prefixed; pepsi-httpd

RFC 6211

CMS algorithm identifier protection attribute

CMSAlgorithmProtection emitted in every S/MIME signature Pepsi makes and, when a received signature carries it, compared with the SignerInfo’s digest and signature algorithms, pepsi-crypto::smime

RFC 6331

Moving DIGEST-MD5 to Historic

The reason DIGEST-MD5 is deprecated and excluded from AUTH = auto

RFC 6376

DomainKeys Identified Mail (DKIM) signatures

Verification (ingress) and signing (pepsi-stage-dkim-sign)

RFC 6409

Message submission for mail

Submission listeners (SUBMISSION = yes): mandatory AUTH, Date:/Message-ID: fixups, Sender: fixup and submission-identity enforcement

RFC 6531

SMTP extension for internationalized email (SMTPUTF8)

Advertised by ingress; per-hop re-advertise/downgrade in the relay stages

RFC 6598

IANA-reserved IPv4 prefix for shared address space

Part of the outbound-fetch address guard; see RFC 1918

RFC 6648

Deprecating the X- prefix in application protocols

Why Pepsi-Origin: and Taler: carry no X- prefix, while the verdict headers pepsi-stage-decrypt strips deliberately do (X-Pepsi-* is a namespace to be removed, not a field to be adopted)

RFC 6698

DNS-based authentication of named entities (DANE): TLSA

TLSA record types and matching, pepsi-common::smtp::dane; the SMTP profile is RFC 7672

RFC 6749

The OAuth 2.0 authorization framework

Smarthost token acquisition and refresh, pepsi-helper-token-refresh

RFC 6750

The OAuth 2.0 authorization framework: bearer token usage

The Authorization: Bearer form of the administrative API’s tokens, The administrative API — the wire form only; Pepsi mints them locally and runs no authorization server

RFC 6761

Special-use domain names

.invalid: an identity ending in it is the unedited sample configuration, refused by pepsi-setup; localhost: accepted as loopback by pepsi-httpd

RFC 6797

HTTP Strict Transport Security (HSTS)

Strict-Transport-Security: max-age=31536000 on responses sent over pepsi-httpd’s own TLS listeners (never over plain HTTP or a UNIX socket); pepsi-setup check verifies the header on every HTTPS name served, a front server’s included

RFC 6840

Clarifications and implementation notes for DNSSEC

The AD bit read from the validating resolver’s response — Pepsi trusts a validating resolver rather than validating itself; pepsi-common::dns

RFC 6891

Extension mechanisms for DNS (EDNS(0))

UDP payload size on outgoing queries, pepsi-common::dns

RFC 6960

Online Certificate Status Protocol (OCSP) — stapled responses only

Evaluated on every outbound TLS session from what the server stapled, pepsi-common::smtp::ocsp; a verified revoked fails a validating session; no responder is ever queried

RFC 7208

Sender Policy Framework (SPF) for authorizing use of domains

Inbound SPF verification (ingress, via the vendored mail_auth, patched for the §4.6.4 void-lookup limit); the §12 grammar and §4.6.4 limits of the served domains’ own records, pepsi-setup

RFC 7235

HTTP/1.1: authentication

The Authorization: Bearer scheme on /api/v1, pepsi-httpd

RFC 7293

The Require-Recipient-Valid-Since header field and SMTP service extension (RRVS)

pepsi-common::rrvs and pepsi-common::assignment (the login assignment record); ingress refuses at RCPT, local delivery and .forward bounce, the relay stages propagate or downgrade

RFC 7372

Email authentication status codes

550 5.7.25 for a client whose reverse DNS fails under [pepsi-ingress] IPREV_ACTION = reject, ingress

RFC 7489

Domain-based Message Authentication, Reporting, and Conformance (DMARC)

Inbound DMARC evaluation and optional enforcement (ingress), once per author domain of a multi-mailbox From: (§6.6.1), pepsi-common::auth; aggregate reports about the served domains read (§7.2), pepsi-stage-dmarc-report; the §7.1 authorisation of the served domains’ report destinations checked, pepsi-setup

RFC 7505

A “Null MX” no-service resource record

MX classification, pepsi-stage-relay-to-internet

RFC 7595

Guidelines and registration procedures for URI schemes

The procedure the taler:// scheme is not registered under; noted so its status is not mistaken for IANA-registered

RFC 7628

A set of SASL mechanisms for OAuth (OAUTHBEARER)

Outbound smarthost AUTH = oauth (OAUTHBEARER, de-facto XOAUTH2)

RFC 7671

The DANE protocol: updates and operational guidance

Digest algorithm agility (§9) in the TLSA matching, pepsi-common::smtp::dane

RFC 7672

SMTP security via opportunistic DANE TLS (TLSA)

DANE = off|warn|strict on both relay stages; pepsi-common::smtp::dane

RFC 7677

SCRAM-SHA-256 and SCRAM-SHA-256-PLUS SASL mechanisms

Outbound SCRAM-SHA-256 (±``-PLUS``), pepsi-common::smtp::sasl

RFC 7748

Elliptic curves for security (X25519)

Curve25519 key agreement in OpenPGP and TLS

RFC 7858

Specification for DNS over Transport Layer Security (TLS)

tls://ADDRESS#NAME entries of DNS_SERVERS, pepsi-common::dns (own queries) and the hickory resolver

RFC 7929

DNS-based authentication of named entities (DANE) bindings for OpenPGP

OPENPGPKEY records printed by pepsi-keys dns; AD-gated lookups by pepsi-keydisc@dane (pepsi-keydisc)

RFC 8017

PKCS #1 v2.2: RSA cryptography specification

RSA signature and key-transport primitives for DKIM, ARC and S/MIME (on AWS-LC)

RFC 8018

PKCS #5: password-based cryptography (PBKDF2)

SCRAM-SHA-* salted password derivation, pepsi-common::smtp::sasl

RFC 8162

Using secure DNS to associate certificates with domain names for S/MIME

SMIMEA records printed by pepsi-keys dns; AD-gated lookups by pepsi-keydisc@dane (pepsi-keydisc)

RFC 8187

Indicating character encoding and language for HTTP header field parameters (obsoletes RFC 5987)

The filename* parameter of the Content-Disposition on a secure-link attachment download, pepsi-httpd

RFC 8301

Cryptographic algorithm and key usage update to DKIM

rsa-sha1 DKIM signatures and ARC seals are a permerror (§3.1, patched into the vendored mail_auth); DKIM RSA keys are 2048, 3072 or 4096 bits ([pepsi-dkim] RSA_BITS) and pepsi-setup warns about a reported one below 2048 bits (§3.2), pepsi-dkim

RFC 8314

Cleartext considered obsolete: use of TLS for submission and access

Implicit-TLS submission listener (MODE = tls), ingress; negotiated TLS version/cipher recorded in the Received: trace header (§4.3); a client certificate requested only over TLS 1.3, since TLS 1.2 sends it in the clear

RFC 8446

The Transport Layer Security (TLS) protocol version 1.3

Every TLS listener and client, over rustls — inbound STARTTLS/implicit TLS, outbound relay, LMTP, HTTP and LDAP

RFC 8058

Signalling one-click functionality for list e-mail headers

List-Unsubscribe-Post and the keyed one-click URI, pepsi-stage-list-deliver and pepsi-httpd

RFC 8484

DNS queries over HTTPS (DoH)

https://ADDRESS/PATH#NAME entries of DNS_SERVERS, POST over HTTP/2, pepsi-common::dns and the hickory resolver

RFC 8460

SMTP TLS Reporting (TLSRPT)

Outbound TLS-session recording (relay stages) + daily reports (pepsi-tlsrpt)

RFC 8461

SMTP MTA Strict Transport Security (MTA-STS)

Policy enforcement, with fetched policies cached in the pepsi.mta_sts_policy table (pepsi-stage-relay-to-internet); publishing (pepsi-setup prints the records, pepsi-httpd serves the policy file)

RFC 8463

A new cryptographic signature method for DKIM (Ed25519)

Ed25519 DKIM keys/signatures, pepsi-common::keys

RFC 8550

S/MIME 4.0 certificate handling

Path building, emailProtection EKU and rfc822Name binding (pepsi-crypto::trust); certificate issuance (pepsi-crypto::keygen, pepsi-keys::ca)

RFC 8551

S/MIME 4.0 message specification

application/pkcs7-mime / -signature and the smime-type parameter, pepsi-crypto::mime + pepsi-crypto::smime

RFC 8601

Message header field for indicating message authentication status

Authentication-Results (incl. iprev), pepsi-common::auth

RFC 8617

The Authenticated Received Chain (ARC) protocol

ARC verify/sign/seal, pepsi-stage-arc

RFC 8657

CAA record extensions for account URI and ACME method binding

accounturi in the suggested CAA record; accounturi and validationmethods judged by pepsi-setup check (pepsi-setup/src/caa_check.rs)

RFC 8659

DNS Certification Authority Authorization (CAA)

Suggested (never published) by pepsi-setup run; the relevant set looked up and reported by pepsi-setup check

RFC 8689

SMTP Require TLS option (REQUIRETLS, TLS-Required)

Advertised and tagged by pepsi-ingress; enforced by both relay stages; bounces headers-only, pepsi-stage-bounce

RFC 8905

The payto URI scheme

Wire-transfer targets in the wallet self-service reply, pepsi-stage-auto-pay

RFC 8914

Extended DNS Errors

Read from public resolvers’ replies so pepsi-setup’s outside DNS checks can say why a name failed to resolve, pepsi-common::dns; a DNSSEC failure code (6–12) marks a broken chain of trust in pepsi-setup’s TLSA/MX checks and pepsi-status’s “Own DNSSEC” section

RFC 8959

The secret-token URI scheme

The merchant access token’s form, pepsi-common::config

RFC 9051

Internet Message Access Protocol (IMAP) version 4rev2

Read-only mailbox scanning for whitelist import (EXAMINE + BODY.PEEK[HEADER], so nothing is marked \Seen), pepsi-helper-mailbox-scan

RFC 9106

Argon2 memory-hard function for password hashing and PoW

The secure-link content key derived from the recipient’s PIN (pepsi-secure-link::crypto) and the hashing of stored passwords — administrator accounts, mailing-list accounts and moderator passwords — in pepsi-common::password

RFC 9110

HTTP semantics

Request/response handling in pepsi-httpd

RFC 9112

HTTP/1.1

The wire protocol served by pepsi-httpd, over hyper

RFC 9580

OpenPGP (the crypto refresh; successor to RFC 4880)

pepsi-crypto::pgp over sequoia-openpgp; explicit SEIPDv2/v1 container negotiation; Intended Recipient Fingerprint; Padmé-sized padding packet in SEIPDv2; a verified cleartext-signed block whose armor headers or HTML surface show unsigned text is reported partial

RFC 9598

Internationalized email addresses in X.509 certificates

SmtpUTF8Mailbox read from the SAN and bound to From: as §5 says (pepsi-crypto::smime, trust::bind_certificate); held to rfc822Name name constraints by domain as §6 says (trust::constraints); emitted for an identity with a non-ASCII local part (pepsi-crypto::keygen)

RFC 9325

Recommendations for secure use of TLS and DTLS

ALPN: a ClientHello offering only HTTP protocols is refused on the SMTP listeners (ingress, MailAcceptor) and pepsi-httpd accepts http/1.1 only; neither selects smtp or refuses other offers, see Web clients at the SMTP port

RFC 9709

Encryption key derivation in CMS using HKDF with SHA-256

pepsi-crypto::smime: id-alg-cek-hkdf-sha256 honoured on every inbound EnvelopedData/AuthEnvelopedData that names it, emitted to a correspondent whose signed SMIMECapabilities name it (pepsi-stage-encrypt), advertised in Pepsi’s own signatures

RFC 9787

Guidance on end-to-end e-mail security

Errant cryptographic layers (§6.2.2) isolated before decryption, pepsi_crypto::mime::isolate (pepsi-stage-decrypt); header protection on the way out (PROTECT_HEADERS, off by default), in the protected-headers="v1" form rather than RFC 9788’s

RFC 9989

Domain-based Message Authentication, Reporting, and Conformance (DMARCbis)

The DNS tree walk (policy discovery and the organizational domain for relaxed alignment) behind ingress’s DMARC evaluation, performed by the vendored mail_auth

Autocrypt Level 1

The Autocrypt: key-advertisement header (a de-facto standard, not an RFC)

Harvested from inbound mail by pepsi-stage-autocrypt-learn (through pepsi-keydisc’s harvest module), ranked above only gossip; emitted on outbound mail by pepsi-stage-encrypt’s autocrypt module, under [stage-encrypt] AUTOCRYPT. §5.3 key gossip is emitted by the same stage’s gossip module under [stage-encrypt] AUTOCRYPT_GOSSIP (default off) and read by pepsi-stage-autocrypt-learn under LEARN_GOSSIP (default on), onto a trust rung of its own

FIPS 186-4

Digital Signature Standard (a NIST publication)

The bits2int truncation rule of ECDSA verification, pepsi-crypto::smime

draft-ietf-mailmaint-autoconfig

Mail account autoconfiguration (an Internet-Draft of the IETF mailmaint working group, intended for Informational status)

The config-v1.1.xml document served by pepsi-httpd on autoconfig.<domain> and under /.well-known/autoconfig/, built from [pepsi-autoconfig] and the submission listener

MS-NLMP

The NT LAN Manager authentication protocol (a Microsoft Open Specification, not an RFC)

Outbound smarthost AUTH NTLM, pepsi-common::smtp::sasl. NTLMv2 only — NTLMv1 is cryptographically broken — with channel binding, and never offered outside TLS

Maildir

D. J. Bernstein’s mailbox format (a specification, not an RFC — tmp/new/cur with the rename-into-new delivery rule)

pepsi-stage-relay-to-maildir via the setuid helper; Maildir++ recursion when scanning for whitelist import

SRS

The Sender Rewriting Scheme (a published scheme with no RFC; the SRS0/SRS1 envelope-address format)

pepsi-common::srs, pepsi-stage-srs, and the reverse decode at ingress. The MAC is RFC 2104 HMAC

VKS (keys.openpgp.org)

The verifying key server’s /vks/v1 HTTP protocol (a de-facto standard, not an RFC — it is not HKP)

Lookup by pepsi-keydisc@vks; upload and address verification by pepsi-keys, whose confirmation mail pepsi-stage-vks-confirm answers

XOAUTH2

Google’s and Microsoft’s pre-standard SASL bearer-token mechanism (no specification body; superseded by RFC 7628 OAUTHBEARER, which the same servers also accept)

Outbound smarthost AUTH, pepsi-common::smtp::sasl. Offered because some tenants still refuse OAUTHBEARER

draft-koch-openpgp-webkey-service

OpenPGP Web Key Directory (an Internet-Draft, not an RFC)

Client side: pepsi-keydisc@wkd-advanced / @wkd-direct. Serving side: the four endpoints of pepsi-httpd, answered from the stored pepsi_common::keystore::wkd_local_part_hash

draft-josefsson-email-received-privacy

Improving privacy for the e-mail Received header (an expired Internet-Draft, not an RFC)

The from clause is left out of the trace header ingress writes on a listener with RECEIVED_PRIVACY (on by default for SUBMISSION listeners); User-Agent and X-Mailer are removed with it

97.2. Per-RFC notes

97.2.1. RFC 1035 — Domain Names (DNS)

All DNS resolution (MX, A/AAAA, TXT for SPF/DKIM/DMARC/MTA-STS, and reverse PTR) follows RFC 1035. Domain-name and label syntax limits are enforced in pepsi-common::domain. DNS is used by ingress (authentication), the ARC stage (re-verification) and pepsi-stage-relay-to-internet (MX discovery and address caching in the pepsi.dns_address table).

97.2.2. RFC 2045 / RFC 2047 — MIME bodies and header encoded-words

When a next hop does not advertise 8BITMIME (RFC 6152), pepsi-common::mime walks the MIME tree and re-encodes each 8-bit leaf part with a 7-bit content-transfer-encoding (RFC 2045: quoted-printable for text/*, base64 otherwise). When a hop does not advertise SMTPUTF8 (RFC 6531), UTF-8 header fields are rewritten as RFC 2047 encoded-words — only where §5 permits one (an unstructured field body, a display-name phrase, the inside of a comment), so a quoted-string becomes one encoded-word without its quotes. A non-ASCII MIME parameter takes the RFC 2231 extended form instead, in every part’s header block, and a non-ASCII boundary= is replaced by a fresh ASCII one throughout its multipart. See pepsi-stage-relay-to-internet.

Ambiguous MIME is settled at ingress ([pepsi-ingress] MIME_ANOMALIES), before anything after ingress parses the message. The shapes where these RFCs leave the reading to the parser are either refused at DATA (an empty boundary=, a NUL in a MIME header, conflicting duplicate Content-Type/Content-Transfer-Encoding fields, an encoded-word boundary) or rewritten once to the reading that the RFCs mandate: an unrecognised encoding makes the entity application/octet-stream (RFC 2045 §6.4), whitespace after a quoted-printable soft break is deleted (§6.7), characters outside the base64 alphabet are ignored (§6.8), a multipart without a close delimiter is closed (RFC 2046 §5.1.1), an epilogue holding another delimiter of the same boundary is dropped (§5.1.1: the epilogue is ignored), and an identical duplicate field is dropped. See pepsi-ingress and Ambiguous MIME is settled at the boundary.

97.2.3. RFC 3030 — CHUNKING / BDAT

Ingress advertises CHUNKING and accepts message bodies framed with BDAT chunks (in addition to DATA). The BODY=BINARYMIME body value of the same RFC is not advertised or accepted. See pepsi-ingress.

97.2.4. RFC 3207 — STARTTLS

Ingress listeners in starttls mode advertise the STARTTLS verb and upgrade a cleartext session in place. The outbound SMTP client uses STARTTLS opportunistically (or as required by MTA-STS). Implicit TLS is governed by RFC 8314 instead.

97.2.5. RFC 3461 / RFC 3463 / RFC 3464 — Delivery Status Notifications

Ingress advertises the DSN extension and validates/stores RET/ENVID/NOTIFY/ORCPT under state.dsn (pepsi-common::dsn). The relay stages propagate the parameters to a next hop that also advertises DSN (RFC 3461 §5–6). pepsi-stage-bounce emits the notification as an RFC 3464 multipart/report with RFC 3463 enhanced status codes, honouring NOTIFY (failure by default; success/delay only on explicit request). For a recipient that an alias or ~/.forward expansion produced, the report names the address the sender used and gives a generic diagnostic, one of the confidentiality measures RFC 3464 §4.2 suggests for forwarding addresses (Forwarding addresses in delivery reports). See Supported Features and pepsi-stage-bounce.

97.2.6. RFC 3834 — Automatic responses

The auto-replies that Pepsi originates set Auto-Submitted per RFC 3834 and are sent with the null sender. Among them are pepsi-stage-vacation’s out-of-office notice, pepsi-stage-secretary’s challenge, the pepsi-stage-anti-spam payment-request message and the pepsi-stage-edit-settings confirmation/error replies. A message that is itself an automatic response (null sender / Auto-Submitted) is never gated, bounced or auto-replied to, so the stages cannot form a reply loop.

The suppression rules are shared, in pepsi-common::autoreply, rather than re-derived per stage: they are not re-derivable from first principles, and getting them wrong is how an auto-responder builds a mail loop. suppress_reason refuses to answer a null sender, an Auto-Submitted other than no, a Precedence: bulk|list|junk, an X-Auto-Response-Suppress naming All, OOF or AutoReply, any List-* field, a service sender (including a VERP <list>-bounces+…), a multipart/report, self-mail and a message already marked state.spam. The vacation stage adds RFC 3834 §3’s “is the responder actually addressed?” test behind REQUIRE_ADDRESSED_TO, and its own per-correspondent rate limit (SUPPRESS_DAYS, Sieve’s vacation :days). See pepsi-stage-vacation and pepsi-stage-anti-spam.

97.2.7. RFC 3848 — ESMTP transmission types

The Received: trace header that ingress prepends records the transport in the with clause as SMTP, ESMTP, ESMTPS, ESMTPA or ESMTPSA, per RFC 3848. The A is added whenever the session carries an authenticated identity: with TLS that is ESMTPSA (SMTP AUTH), and without it ESMTPA, which is what the cleartext UNIX submission socket produces for locally submitted mail.

97.2.8. RFC 4648 — Base16/Base32/Base64

SRS addresses encode their truncated HMAC in base32 (RFC 4648) so the token is case-insensitive and address-safe; key material uses base64. See pepsi-stage-srs.

97.2.9. RFC 4954 — SMTP AUTH

Both directions are supported. Inbound: ingress implements the AUTH verb with the PLAIN (RFC 4616) and LOGIN mechanisms (SASL PLAIN initial-response and the prompted LOGIN exchange). It is advertised and accepted only on an encrypted session (implicit TLS or after STARTTLS); an AUTH attempt in cleartext is refused with 504 5.5.4 (RFC 4954 §4; §1 deprecates the older 538). Credentials are verified against a configured SASL backend (Dovecot’s auth-client socket, SASL_TYPE/SASL_PATH); a successful AUTH marks the session locally originated, lets it relay to any domain, and stamps ESMTPSA in the Received: with clause.

Outbound: the SMTP client authenticates to a smarthost via the AUTH option of an […-mta-*] section. The full mechanism suite (all in pepsi-common::smtp::sasl, hand-rolled on the RustCrypto primitives already in-tree — no SASL/SCRAM crate) is:

  • plain — PLAIN (RFC 4616) and login — LOGIN (cleartext password inside the TLS tunnel).

  • cram-md5 — CRAM-MD5 (RFC 2195), HMAC-MD5 challenge-response.

  • scram-sha-1 / scram-sha-256 and their -plus variants — SCRAM (RFC 5802) and SCRAM-SHA-256 (RFC 7677); the -PLUS forms add tls-server-end-point channel binding (RFC 5929). The server signature is verified for mutual authentication; usernames/passwords are SASLprep’d (RFC 4013).

  • digest-md5 — DIGEST-MD5 (RFC 2831), deprecated (RFC 6331 moved it to Historic): supported for legacy smarthosts but excluded from auto and warned about both at pepsi-setup validation and at runtime.

  • oauth — OAUTHBEARER (RFC 7628), falling back to the de-facto XOAUTH2; the bearer token is read from TOKEN_FILE (see pepsi-helper-token-refresh).

  • external — SASL EXTERNAL (RFC 4422), authenticated by the configured TLS client certificate rather than a password.

  • ntlm — the de-facto Microsoft NTLM mechanism (no RFC; NTLMv2 only). Run only under TLS, so it always carries Extended Protection for Authentication: the tls-server-end-point (RFC 5929) channel-binding and smtp/<host> SPN AV pairs plus the MIC. Weak and without server authentication — flagged by pepsi-setup.

  • gssapi — SASL GSSAPI / Kerberos (RFC 4752, over the RFC 4121 Kerberos 5 GSS mechanism), via the system Kerberos library (pepsi-common::smtp::gssapi). The ticket comes from a credential cache kept fresh out of band; the SASL security layer is negotiated to no security layer (TLS already protects the session).

  • auto — negotiate the strongest mechanism the smarthost’s EHLO offers (SCRAM-SHA-256-PLUS > SCRAM-SHA-256 > SCRAM-SHA-1-PLUS > SCRAM-SHA-1 > CRAM-MD5 > LOGIN > PLAIN; DIGEST-MD5, NTLM and GSSAPI are never auto-selected).

As inbound, the outbound client refuses to send credentials over an unencrypted connection. A 5xx rejection of a password mechanism is treated as a permanent failure (bounce). See pepsi-ingress and pepsi-stage-relay-to-smarthost.

GSSAPI/Kerberos is the one mechanism that is not hand-rolled: it links the system Kerberos GSS implementation (MIT krb5 / Heimdal). The Debian package therefore build-depends on libkrb5-dev and depends on libgssapi-krb5-2.

97.2.10. RFC 2369 / RFC 5064 / RFC 1153 / RFC 8058 — mailing lists

The four standards the mailing-list subsystem implements that nothing else in Pepsi needs. Together they are what makes a list post recognisable as a list post to a mail client that has never heard of Pepsi.

RFC 2369 is the List-* header family. The rfc-2369 handler in pepsi-stage-list-post writes List-Id (whose format is RFC 2919’s <listname.mailhost>), List-Help, List-Subscribe, List-Unsubscribe, List-Post and List-Owner from the list’s own addresses, and List-Archive when the list is archived. These are also what the shared RFC 3834 rule set keys on when it refuses to auto-respond: any List-* header suppresses a vacation notice, which is how an out-of-office reply is kept off a mailing list.

RFC 5064 is Archived-At, the per-message archive URL. Pepsi derives it from the message’s Message-ID-Hash, so the URL in a delivered copy and the URL that the archive serves are the same string computed twice rather than a stored pair that can disagree. See Archives.

RFC 1153 is the plain digest format: one message per separator run, a table of contents, and the volume/issue numbering a subscriber’s mail client has been folding for thirty years. Pepsi builds both it and the MIME multipart/digest alternative, per subscriber’s delivery_mode; see Mailing lists.

RFC 8058 is one-click unsubscribe, and it is the one place where Pepsi exceeds upstream: pepsi-stage-list-deliver adds List-Unsubscribe-Post: List-Unsubscribe=One-Click alongside a keyed https: URI that pepsi-httpd honours with a single POST — no confirmation step, no session, and no policy that can override it, because a mailbox provider’s unsubscribe button is a one-shot request that gets no second chance to interact with a human. The POST must carry the body List-Unsubscribe=One-Click (§3.2); anything else is answered 400. The token is a keyed hash over the list, the address and a rotatable serial rather than a stored row; see Mailing lists. As §4 asks, the default DKIM SIGNED_HEADERS of pepsi-stage-dkim-sign cover and over-sign both List-Unsubscribe and List-Unsubscribe-Post.

97.2.11. RFC 2033 / RFC 5228 — LMTP local delivery and Sieve

pepsi-stage-relay-to-lmtp delivers a message to a local Mail Delivery Agent — typically Dovecot — over LMTP (RFC 2033): it offers every recipient in a single LMTP transaction (LHLO, optional STARTTLS and SASL, multi-reply DATA) and routes each recipient onward by the MDA’s per-recipient reply (delivered, or classified by its RFC 3463 status). The MDA, not Pepsi, runs each recipient’s Sieve (RFC 5228) filter as it files the mail; Pepsi implements no Sieve itself. The shared LMTP client is pepsi-common::smtp::deliver_lmtp. Because the MDA drops privilege, this stage needs no setuid/setgid helper (unlike pepsi-stage-relay-to-maildir). See Supported Features and pepsi-stage-relay-to-lmtp.

97.2.12. RFC 5321 — SMTP

RFC 5321 is the backbone: the ingress command grammar and replies; the envelope (MAIL FROM/RCPT TO, the null sender <>); the domainless <Postmaster> mailbox (§4.5.1); the Received: trace header (§4.4); implicit MX via address records (§5.1); and the “never bounce a bounce” rule (§6.1). It governs ingress and both relay stages. On a submission listener the trace header’s from clause is omitted by default (RECEIVED_PRIVACY), the convention of draft-josefsson-email-received-privacy below; the by clause that §6.3 loop detection and MAX_SELF_HOPS rely on is always written.

97.2.13. RFC 5322 — Internet Message Format

Messages are stored split into a header block and a body at the first blank line (pepsi-common::message); header selection for signing and the parsed From:/Subject: follow RFC 5322. DKIM/ARC h= selection is bottom-up so a prepended header never disturbs an existing signature.

97.2.14. RFC 3156 / RFC 9580 — OpenPGP and PGP/MIME

RFC 9580 is the 2024 OpenPGP specification (the “crypto refresh”, succeeding RFC 4880); RFC 3156 is how an OpenPGP message is carried in MIME. Pepsi implements both over the sequoia-openpgp library, in pepsi-crypto::pgp (cryptography) and pepsi-crypto::mime (containers).

The MIME half (RFC 3156). Encryption emits multipart/encrypted; protocol="application/pgp-encrypted" with the Version: 1 control part and an application/octet-stream ciphertext part (§4). Detached signing emits multipart/signed; protocol="application/pgp-signature" with the micalg parameter computed from the hash actually used (§5) — pgp-sha256 for the default. Both forms are recognised on the way in, as is non-MIME inline armor, which [pepsi] CRYPTO_INLINE_PGP may refuse. As §5 requires of the signed entity, an 8-bit body is converted to quoted-printable or base64 before it is signed (the conversion pepsi-stage-dkim-sign applies, and the same for an S/MIME signature), so a next hop without 8BITMIME does not invalidate the signature; a message another signature already covers is signed as it stands.

The container question (RFC 9580). The choice between the RFC 9580 SEIPDv2 container (AEAD) and the RFC 4880 SEIPDv1 container (an MDC) is made explicitly from the recipient keys’ declared capabilities rather than left to the library, so a downgrade is a decision that gets recorded rather than a silent one; [pepsi] CRYPTO_ALLOW_DOWNGRADE governs whether it is permitted at all. Reading a SEIPDv1+MDC message is never gated — most of the installed base still produces them — but the pre-MDC SED packet is refused outright.

Intended recipients (RFC 9580 section 5.2.3.36). A signature made inside the ciphertext carries an Intended Recipient Fingerprint subpacket for each certificate the message is encrypted to; on the way in, such a signature that does not name the certificate which opened the message is invalid (wrong-recipient), so a signed message re-encrypted to a third party is not passed off as signed for them. See Who a signed and encrypted message was for.

Padding (RFC 9580 section 5.14). Section 10.3 leaves padding to the sender; pepsi-stage-encrypt pads every message it encrypts to a Padmé length (PADDING, default on). In a SEIPDv2 container this is the Padding packet (type 21), written inside the encryption after the signature, so it is neither visible nor signed. RFC 4880 has no packet a reader skips, so a SEIPDv1 message, and an S/MIME one alike, carries the filler as a Pepsi-Padding: header field on the encrypted MIME entity instead. Reading a padding packet is the library’s (sequoia accepts it anywhere RFC 9580 allows). See The length of an encrypted message.

See Key management, pepsi-stage-encrypt and pepsi-stage-decrypt; Client interoperability records what has been measured against gpg.

97.2.15. RFC 9787 — errant layers and header protection

RFC 9787 is guidance for end-to-end e-mail security rather than a format, and two of its points are implemented. Errant cryptographic layers (§6.2.2): before anything is decrypted, a message to a local recipient that carries ciphertext beside other content keeps only its first encrypted unit, and one without ciphertext keeps only its signed units (pepsi_crypto::mime::isolate, under [stage-decrypt] ISOLATE_ENCRYPTED and ISOLATE_SIGNED, both on by default). So a decrypted layer is never spliced together with content that a stranger put beside it. An attached message that carries ciphertext beside other parts is reduced the same way inside the attachment, since a client decrypts it on its own. Header protection is applied on the way out (PROTECT_HEADERS, off by default on both the encrypt stage and the re-encrypt stage): the RFC 5322 fields are copied into the protected part and the outer Subject is replaced, in the protected-headers="v1" form that Thunderbird implements, not RFC 9788’s. On the way in, the protected copies a signature covers are compared with the outer fields: a different From: or reply-steering field (Reply-To:, Mail-Reply-To:, Mail-Followup-To:) withholds valid, To: is reported, and a changed Subject: is replaced by the signed one on a valid signature (Protected headers against the outer ones); no other protected copy is promoted. Remote references in decrypted HTML are left to the client’s remote-content blocking (Remote content), or removed with all markup under DECRYPTED_MARKUP = text. The RFC’s point about a proxy that reports cryptographic status in an added header field is met on both sides: every inbound X-Pepsi-* field is removed before X-Pepsi-Crypto is written, and the Outlook add-in and the Thunderbird extension show that field outside the message area (Mail client extensions). See pepsi-stage-decrypt and pepsi-stage-encrypt.

97.2.16. RFC 5280 — X.509 certificates and path validation

Every S/MIME decision rests on this one. pepsi-crypto::trust parses certificates, applies the extensions that matter for mail and builds a path to a configured anchor. These extensions are basicConstraints, including the pathLenConstraint that bounds how many intermediates a CA authorised below itself; keyUsage; the emailProtection extended key usage of §4.2.1.12; and the rfc822Name subject alternative name that binds a certificate to an address. That name must be a bare local@domain as §4.2.1.6 requires: a value such as a@x.example <b@y.example> binds the certificate to nobody. CRYPTO_MIN_RSA_BITS applies to every RSA certificate on that path except a configured anchor, and an RSA key above 4096 bits is not accepted at all. Over that path it then runs the stateful half of §6.1: nameConstraints (§4.2.1.10), policyConstraints (§4.2.1.11) and inhibitAnyPolicy (§4.2.1.14), together with the certificatePolicies / policyMappings tree they act on. The NIST PKITS suite (sections 4.6 and 4.8–4.13) is checked in and passes, including every non-default input setting it lists.

Five boundaries:

  • The trust store is searched before the message’s own certificates. A CMS SignerIdentifier names a certificate by issuer and serial number, so a message can carry a forged certificate bearing a pinned one’s issuer and serial with a different key. A verifier that looked at the message first would accept it.

  • Missing intermediates come from ``caIssuers``, and are never anchors. Under [pepsi-keydiscovery] CA_ISSUERS_FETCH (off by default), pepsi-keydisc follows the http:///https:// caIssuers URIs of the Authority Information Access extension (§4.2.2.1) of cached peer certificates – never ldap://, at most three levels up – and accepts a DER certificate or a certs-only bundle, keeping its CA certificates. The verifier searches them after the message’s own certificates and only for an issuer, so they can complete a path to a configured anchor and nothing else. A certificate outside its validity period is no key for encryption: the encrypt stage sets it aside, and the CMS builder refuses it.

  • Revocation is checked against fetched CRLs, and soft-fails. pepsi-keydisc fetches the CRLs (§5) that cached S/MIME peer certificates name in cRLDistributionPoints (http:///https:// only), and the decrypt stage hands the current ones to the verifier. A CRL counts only if the issuer’s key signed it, the issuer may sign CRLs, the list is current and its scope (issuingDistributionPoint, delta, indirect) covers the certificate. No OCSP responder is consulted (a stapled response reaches only TLS sessions, not S/MIME; see RFC 6960 below). With no usable list the Revocation value is NotChecked, which is reported honestly rather than rendered as “not revoked”.

  • A CA’s constraints bind every certificate below it — the anchor’s included. Permitted subtrees are intersected and excluded ones united down the chain, for the subject DN, every subject alternative name, and every emailAddress attribute of the subject DN (always, not only when there is no SAN as §4.2.1.10 requires, because Pepsi binds a message to that attribute when the SAN names no mailbox). An anchor’s own nameConstraints and policy extensions are applied as RFC 5937 prescribes, so anchoring a name-constrained partner CA directly keeps its bound. A violation is policy-rejected. Pepsi imposes no certificate policy of its own (user-initial-policy-set is any-policy), so the policy tree decides anything only where a CA demands an explicit policy.

  • A critical extension Pepsi cannot process is a refusal. A certificate carrying a critical extension Pepsi does not recognise — or one whose value it cannot decode — is refused outright (policy-rejected). For name constraints that covers a subtree with a minimum or maximum, an x400Address, and an empty extension; a subtree of a form Pepsi does not match (otherName, ediPartyName, registeredID) is refused only when a certificate below it carries a name of that form, as §4.2.1.10 allows. A malformed nameConstraints, policyConstraints or inhibitAnyPolicy is refused even when not critical: the issuer wrote a restriction, and one that cannot be read cannot be dropped. Any other unrecognised non-critical extension is ignored, as it must be: real certificates are full of them.

A certificate that chains to no configured anchor is untrusted, not invalid (Verdict::Untrusted): most of the world’s signed mail chains to a CA nobody handed us an anchor for, and reporting that as a failure would make the indicator useless.

97.2.17. RFC 5652 / 5083 / 5753 / 8550 / 8551 / 9709 — CMS and S/MIME

S/MIME is Pepsi’s second end-to-end protocol, and its standards divide the work cleanly.

RFC 5652 (CMS) is the container syntax. pepsi-crypto::smime builds and opens SignedData (detached and opaque), EnvelopedData, and the certs-only form used to publish a certificate. The cms crate supplies the ASN.1 type definitions only; the builders and openers are Pepsi’s own, so that what is emitted and what is accepted are decided here rather than inherited.

RFC 6211 (algorithm identifier protection) closes a gap that RFC 5652 leaves in SignedData: a SignerInfo’s digest and signature algorithm identifiers lie outside the signature. Every signature pepsi-crypto::smime makes (sign, sign_opaque, sign_for) carries the CMSAlgorithmProtection signed attribute with exactly the identifiers the SignerInfo declares. When a received signature carries it, the identifiers must be the same – DER-equal, absent and NULL parameters counting as one – or the signature is bad-signature; the attribute twice, without signatureAlgorithm or with a macAlgorithm is malformed. A signature without it is accepted, since most clients do not emit it.

RFC 5083 (``AuthEnvelopedData``) is the authenticated-encryption container, and it is what Pepsi emits by default (AES-256-GCM). The RFC 5652 EnvelopedData with AES-CBC remains as the downgrade path for a recipient that cannot do better — again gated by [pepsi] CRYPTO_ALLOW_DOWNGRADE. Neither pads beyond the cipher block, so the encrypted entity carries a Pepsi-Padding: filler header field that rounds its length to a Padmé size ([stage-encrypt] PADDING, default on). Since an X.509 certificate states no cipher capability, “cannot do better” is the recipient’s per-peer capability record, learnt from the RFC 8551 §2.5.2 SMIMECapabilities attribute of its signed mail or configured (The per-peer S/MIME capability record); a recipient with no record gets AEAD. Which clients can actually read AuthEnvelopedData is the largest open interoperability question in the tree; see The AuthEnvelopedData question.

RFC 9709 (CEK derivation with HKDF) closes a gap that RFC 5652 leaves open: the content-encryption algorithm identifier is not authenticated, and AES-256-GCM and AES-256-CBC take the same 32-octet key, so the RecipientInfo of a captured AuthEnvelopedData can be re-submitted under a synthetic EnvelopedData that opens with the same key. Under id-alg-cek-hkdf-sha256 the delivered key is the HKDF-SHA256 input keying material (salt "The Cryptographic Message Syntax") and the DER of the real algorithm identifier, nonce or IV included, is the info, so another algorithm yields another key. pepsi-crypto::smime opens such a container whenever its content-encryption algorithm names the identifier, emits it only to recipients whose own signed SMIMECapabilities name it (a learnt capability record, never a configured one: a client that does not know the identifier cannot read the message at all), and advertises it, with AES-256-GCM and AES-256-CBC, in every signature it makes; the derivation is checked against the RFC’s Appendix B test vectors. Mail to a correspondent who does not announce it is sent without, and [stage-decrypt] OPEN_ENVELOPED_DATA = no is the inbound answer for that mail: no EnvelopedData is opened at all.

RFC 5753 covers the elliptic-curve RecipientInfo: ECDH key agreement over P-256/P-384 with the X9.63 KDF and AES key wrap, alongside the RSA forms (RSAES-OAEP-SHA-256, and PKCS#1 v1.5 for a recipient that needs it).

RFC 8550 (certificate handling) is pepsi-crypto::trust: path building to a configured anchor, validity dates, basicConstraints, keyUsage against the operation being performed, the id-kp-emailProtection extended key usage, and the rfc822Name subject-alternative-name that binds a certificate to the From: address. Revocation is tri-state — “not checked” is never rendered as “not revoked” — and the module opens no sockets: there is no OCSP, and the CRLs it checks are the ones pepsi-keydisc fetched into its cache.

RFC 9598 (internationalized addresses in certificates) adds the SmtpUTF8Mailbox otherName to that binding: certificate_facts reads it beside the rfc822Name entries, and bind_certificate compares it as §5 prescribes — the local part octet for octet, never case-folded or normalised, the domain as lower-case A-labels, so either spelling of an IDN binds. A certificate naming a mailbox only there is therefore bound, not NoIdentity. Because it binds, it is also held to the chain’s nameConstraints as §6 prescribes: checked against the rfc822Name subtrees by its domain alone (lower-case A-labels, octet for octet; a bare host exactly, a leading-dot domain as a suffix). A subtree naming one mailbox admits no SmtpUTF8Mailbox (its ASCII local part never equals a non-ASCII one) and, as an excluded subtree, excludes its domain; a value without a comparison form is refused under any rfc822Name constraint. pepsi-crypto::keygen emits the form for an identity whose local part is not ASCII (an rfc822Name cannot hold one) and an rfc822Name otherwise, an internationalised domain as A-labels in both. A certificate that names no mailbox in any form is capped at valid-untrusted by pepsi-stage-decrypt unless its anchor is opted in.

RFC 8551 (message specification) is the MIME surface: application/pkcs7-mime with the smime-type parameter (signed-data/enveloped-data/authEnveloped-data/certs-only) and application/pkcs7-signature inside multipart/signed, with the conventional smime.p7m/smime.p7s/smime.p7c file names. The legacy application/x-pkcs7-* spellings are recognised on input (by the classifier the decrypt stage uses, and by key harvesting) but never emitted. A correspondent’s certificate is learnt from their mail only when it verified a SignerInfo over the message; the rest of a SignedData’s certificate set is never stored.

Certificates for this deployment’s own users are issued by pepsi-crypto::keygen through the local CA in pepsi-keys. See Key management; Client interoperability records what has been measured against OpenSSL.

97.2.18. RFC 6066 / RFC 6960 — TLS extensions and stapled OCSP

Every TLS client sends server_name and every listener reads it (RFC 6066 §3; pepsi-httpd refuses an unknown name, see Strict SNI on the HTTPS listeners in Security model). The status_request extension (§8) is what makes RFC 6960 usable here: Pepsi never queries an OCSP responder, because the query would tell the CA which certificate this host is talking to and when, and would make every delivery wait on a third party — the same reason S/MIME revocation uses fetched CRLs. A response the server stapled carries neither cost, so pepsi-common::smtp::ocsp reads it on every outbound session: the signature must verify under the issuer’s key or under a responder certificate the issuer signed with id-kp-OCSPSigning (§4.2.2.2), the CertID must name the certificate, and the answer must be within its thisUpdate/nextUpdate window (§4.2.2.1). A verified revoked fails the session wherever the certificate is validated at all (TLS_VERIFY, MTA-STS, the DANE warn fallback, a DANE-TA match, key discovery’s TLS_CA_BUNDLE, the HTTPS requests of pepsi_common::http_client), and is only logged on an accept-any session; a DANE-EE match asks no OCSP, as RFC 7672 section 3.1.1 intends. Everything else — no staple, unknown, an unverifiable or stale answer — is logged and the session proceeds: that soft failure skips no fetch and resolves no uncertainty in the peer’s favour that a fetched status would have, since an attacker who can strip a staple leaves the certificate exactly as unchecked as every other peer’s. The reasoning is in Revocation of TLS peers: stapled OCSP only.

97.2.19. RFC 6125 — TLS service identity

When MTA-STS requires authenticated TLS, the recipient MX certificate is checked to validate for the expected host name per RFC 6125. See pepsi-stage-relay-to-internet.

97.2.20. RFC 6152 — 8BITMIME

Ingress advertises 8BITMIME and records the BODY= value under state.origin. Each relay stage re-advertises BODY=8BITMIME to a hop that supports it and otherwise downgrades the body (RFC 2045), then re-scans the result: §3 forbids attempting to transfer 8-bit content “under any circumstances”, so a body the downgrade could not convert is a permanent failure rather than something sent anyway. See Supported Features.

97.2.21. RFC 6376 / RFC 8463 — DKIM (RSA and Ed25519)

Ingress verifies inbound DKIM signatures; pepsi-stage-dkim-sign signs outbound mail. On verification, an rsa-sha1 signature is a permerror (RFC 8301 §3.1, in ARC chains too), and a signature under a key record published with t=y counts as no signature (neutral, §3.6.1) for DMARC, state.auth.dkim and a whitelist row’s dkim_required alike; state.auth.dkim also honours the From: domain’s adkim=s. Each domain has both an RSA-2048 key (RFC 6376) and an Ed25519 key (RFC 8463), provisioned by pepsi-setup; both signatures are added unless [pepsi] DKIM_ALGORITHMS names only one. The l= body-length tag is never emitted: strict verifiers reject such a signature outright, and RFC 6376 §8.2 warns against it. Every signature carries an x= expiration (§3.5) seven days after signing (SIGNATURE_EXPIRATION_DAYS, 0 for none), which bounds the replay of a signed message (RFC 4686 §4.1.4, The lifetime of our DKIM signatures). As section 5.3 recommends, an 8-bit body is converted to quoted-printable or base64 before it is signed, so a next hop without 8BITMIME does not invalidate the signature (unless another signature already covers the 8-bit bytes, which the conversion would break). See pepsi-stage-dkim-sign.

97.2.22. RFC 6409 — Message submission

A listener marked SUBMISSION = yes acts as a Message Submission Agent. It requires AUTH as RFC 6409 expects (an unauthenticated MAIL FROM is refused with 530; see RFC 4954 — SMTP AUTH) and applies the submission fixups to every accepted message: a missing Date: is added (§8.2) and a missing Message-ID: is generated (§8.3). Submission-identity enforcement (§6) and the Sender: fixup (§8.1) are driven by the USERNAME_MAP mapping of the authenticated SASL user to its allowed addresses: an envelope MAIL FROM or a From: the user is not permitted to use is refused with 550, and an allowed From: that differs from the user’s canonical identity gets a Sender: header naming that identity. See pepsi-ingress.

97.2.23. RFC 6531 — SMTPUTF8

Ingress advertises SMTPUTF8 and accepts UTF-8 in headers and the envelope. Each relay stage re-advertises it to a supporting hop and otherwise downgrades UTF-8 headers (RFC 2047); a non-ASCII address that cannot be represented to a non-SMTPUTF8 hop is a permanent failure (bounce). See Supported Features.

97.2.24. RFC 7208 — SPF

Ingress verifies SPF on the MAIL FROM identity using the connecting client’s IP (via the vendored mail_auth library) and records the verdict in Authentication-Results and under state.auth.spf. The vendored copy is patched to enforce §4.6.4’s void-lookup limit: more than two mechanism lookups answered with NXDOMAIN or no records make the result permerror. Its ptr mechanism (§5.5) counts a name only when it is the target or a subdomain of it and resolves back to the client’s address, considers the first ten names of the PTR answer, and treats a failed lookup as no match; the address lookups of those names do not count against the ten-term limit, and a name is compared without case or trailing root label, as a live resolver returns it (also a vendored patch, with tests for the policy shapes Arouna et al. found receivers evaluating inconsistently). pepsi-setup checks every term of each served domain’s own SPF record against the §12 grammar (an unknown mechanism or malformed term is a permerror at every receiver), counts its DNS lookups through all its includes and warns above the RFC 7208 limits. Because SPF is evaluated for the exact MAIL FROM name, it also suggests, commented out and never as an applied record, a wildcard *.<domain>. TXT "v=spf1 -all" for the subdomains nobody sends as, and pepsi-setup check lists the subdomains the configuration names (the EHLO host, mta-sts., autoconfig.) that exist without an SPF record of their own, since a wildcard does not answer for them.

97.2.25. RFC 7293 — Require-Recipient-Valid-Since

Ingress advertises RRVS and validates the RRVS=date-time[;C|R] RCPT TO parameter (pepsi-common::rrvs), storing it verbatim per recipient in state.dsn.rcpt. The ownership datum RFC 7293 needs is pepsi.login_assignment (pepsi-common::assignment): when each passwd login was first seen with its current uid, built from sightings at local delivery and re-checked by pepsi-setup run and pepsi-queue gc. A login seen under another uid, or back after it vanished, is a new assignment, and the previous owner’s settings, own whitelists, quota and auto-reply logs are dropped then (key material is reported, not deleted). Only a recorded reassignment after the requested date fails the test: a login with one owner as far as Pepsi knows passes for any date (§9, §13.2), and RFC 2142 role addresses are exempt (§5.1). Ingress refuses with 550 5.7.17 at RCPT; pepsi-stage-relay-to-maildir and pepsi-stage-dot-forward check both the parameter and the header field (§5.2, matched to the envelope recipient) and bounce with 5.7.17; the delivered copy has the header field removed. The relay stages and the LMTP client pass the parameter to a hop that advertises RRVS, and otherwise fail the recipient with 5.7.19 (no-support action R) or downgrade it to the header field (C, single-recipient transactions only, §6.1 and §7). Alias targets and forwarded addresses do not inherit a request (§8.2). Not implemented: the Authentication-Results rrvs method (§11) and converting a received header field back into the parameter at a hop that supports it (§6.1, a SHOULD that would rewrite signed headers). See pepsi-ingress and pepsi-setup.

97.2.26. RFC 7489 — DMARC

Ingress evaluates DMARC and records the verdict. With DMARC_ENFORCE set (the wizard’s default for a new installation), a definite DMARC failure under a quarantine/reject policy on an unauthenticated session is rejected at SMTP time (550) unless a validating ARC chain sealed last by a domain in ARC_TRUSTED_SEALERS vouches for the message (RFC 8617 §7.2; recorded as state.auth.arc_override); otherwise the failing verdict is recorded and the mail is accepted (fail-open).

A From: naming mailboxes in several domains is checked against each domain’s policy, as §6.6.1 has it, and fails if any of them fails; up to ten author domains are evaluated (pepsi-common::auth). Under DMARC_ENFORCE, unauthenticated mail DMARC cannot be applied to is refused rather than let through: a message with no From: author domain (550 5.6.0) and one naming more than ten (550 5.7.1).

Two rules for an ambiguous policy are patches to the vendored mail_auth library. Several TXT records at one _dmarc name that start with v=DMARC1 are all discarded (section 6.6.3 step 5; RFC 9989 section 4.10 steps 2 and 6), whether or not each parses, instead of the first that parses being used; under RFC 9989 the walk then continues at the parent labels. And a record that names one tag twice is invalid (section 6.4 adopts the DKIM tag-list syntax, and RFC 6376 section 3.2 invalidates a tag-list with a duplicate tag), so its verdict is permerror rather than the last copy’s policy. Only the tags DMARC defines are checked for repetition, since unknown tags are ignored. A malformed value of another tag does not discard the record: an invalid p, sp or np reads as p=none when rua names at least one valid URI and as no policy otherwise (RFC 9989 §4.10.1), and an invalid adkim, aspf, fo, rua or ruf falls back to its default (§4.8).

As a sender, pepsi-setup suggests v=DMARC1; p=reject; adkim=s for a served domain without a record (§6.3: strict DKIM alignment, since every signature Pepsi makes has d= equal to the From: domain), with aspf=s as a printed recommendation rather than part of the record. For a valid record that leaves the subdomains a weaker policy than reject – p other than reject without an sp, or an explicit weaker sp or np (the RFC 9989 tag for names that do not exist) – it recommends adding sp=reject; np=reject. Where a stage runs pepsi-stage-dmarc-report, the suggestion adds rua=mailto:dmarc-reports@<domain> (§6.4; the address is at the domain itself, so no §7.1 authorisation record is needed), and the check notes a live record whose rua= leaves it out. For every rua=/ruf= mailto: destination of a live record, pepsi-setup check looks up the §7.1 authorisation record (<domain>._report._dmarc.<destination>) when the destination lies outside the domain’s organisation, and reports a destination with no MX and no address record.

The aggregate reports (§7.2) that arrive there are read from their gzip, zip or plain XML attachment (§7.2.1.1, Appendix C) into pepsi.dmarc_report, with decompression capped and no declared XML entity expanded. Only a report whose mail passed DMARC or SPF counts towards pepsi-setup check’s verdict (every source of WINDOW_DAYS aligned, so p=reject is safe; or the sources it refuses), since §12.5 leaves reports unauthenticated. Pepsi sends no aggregate or failure reports of its own about the mail it receives (§7.2, §7.3); failure reports (ruf=) arriving at the address are not read.

The organizational domain that relaxed alignment compares against is found by the RFC 9989 (DMARCbis) tree walk, which mail_auth performs internally; see below.

97.2.27. RFC 9989 — DMARCbis

The vendored mail_auth library implements DMARCbis’s DNS tree walk (§4.10): the policy record is looked up at the From: domain and then up its parent labels, and the organizational domain that relaxed alignment compares against is determined the same way rather than from a public-suffix list. Ingress’s DMARC_ENFORCE and the recorded verdict build on the aligned SPF and DKIM results it produces.

97.2.28. RFC 7505 — Null MX

pepsi-stage-relay-to-internet classifies a 0 . exchange as a permanent failure (an immediate bounce, never a retry).

97.2.29. RFC 7672 — DANE / TLSA for SMTP

Both relay stages support opportunistic DANE through a DANE = off|warn|strict option (default strict; warn is an explicit opt-out). It looks up the next hop’s TLSA records, per MX for pepsi-stage-relay-to-internet and per […-mta-*] section for pepsi-stage-relay-to-smarthost, and matches them against the presented certificate chain. The verifier and TLSA types live in pepsi-common::smtp::dane; the AD-bit-aware TLSA/MX lookups in pepsi-common::dns (Pepsi trusts a validating resolver and reads the response AD bit rather than validating DNSSEC itself). DANE takes precedence over MTA-STS and TLS_VERIFY; a usable-record mismatch defers in strict, while in warn it is logged and the hop falls back to the check it would have without DANE — the smarthost’s TLS_VERIFY (PKIX by default), an unauthenticated certificate towards an MX. Neither mode lets a hop with a secure TLSA RRset fall back to cleartext: per section 2.2 such a connection must use TLS, so STARTTLS is mandatory towards that MX whether or not any record is usable, and a hop that does not offer it defers the message. pepsi-setup run and check compare the published TLSA records with the certificate each listener serves and warn when none matches, or when the records or the MX records they depend on are not DNSSEC-validated. Digest algorithm agility (RFC 7671 §9) is applied: where one (usage, selector) pair is published with both SHA-256 and SHA-512 records, only the SHA-512 ones are matched, so a domain can retire the weaker digest by publishing the stronger one beside it.

97.2.30. RFC 7858 / RFC 8484 — DNS over TLS and DNS over HTTPS

A DNS_SERVERS list (a section’s, or [pepsi] DNS_SERVERS for every consumer without one) may name a resolver reached over TLS, tls://ADDRESS[:PORT]#NAME (port 853, the RFC 7858 framing: the 2-octet length prefix of DNS over TCP), or over HTTPS, https://ADDRESS[:PORT][/PATH]#NAME (port 443, path /dns-query: an RFC 8484 POST of application/dns-message over HTTP/2). The resolver is named by address, so no bootstrap lookup is needed, and its certificate must be valid for NAME and chain to the system roots, with no opportunistic mode and no fallback to plain DNS. A list never mixes plain and encrypted entries. Pepsi’s own AD-bit-aware queries (pepsi-common::dns) and the hickory resolver of the other lookups use the same list. The DNS id of a DoH query is random rather than the 0 RFC 8484 section 4.1 recommends for HTTP caching: the reply is checked against it like any other.

97.2.31. RFC 7929 / RFC 8162 — OPENPGPKEY and SMIMEA key records

Pepsi implements both halves: publishing our own addresses’ key records, and looking a correspondent’s up.

Publishing. pepsi-keys dns <address> prints the DNS records that publish an address’s stored public key material: an OPENPGPKEY record (RFC 7929) carrying an OpenPGP transferable public key, and an SMIMEA record (RFC 8162) carrying an S/MIME certificate in the TLSA (usage, selector, matching-type) shape — 3 0 0 (domain-issued certificate, full certificate, exact match), the form a self-signed or directly pinned certificate takes. Only published, active identities are emitted. pepsi-setup run prints the same records for every published identity alongside the DKIM, SPF and MTA-STS ones, and pepsi-setup check, pepsi-status and pepsi-keys identity list --served query the published records back and report one carrying a key the store does not publish for the address (Checking what is actually served) – all of them, validated or not, since a stale or foreign record is worth knowing about either way.

Looking up. The pepsi-keydisc@dane discovery instance queries the same two record types for a correspondent’s address, OPENPGPKEY first and SMIMEA if the domain publishes no OpenPGP record. It ranks second on the trust ladder — below only material an operator entered by hand — because DNSSEC is the one source with cryptographic provenance.

Both directions use the same hashed owner name — the hex of the first 28 octets of the SHA-256 of the local part, followed by ._openpgpkey. or ._smimecert.. The hash is not a privacy measure (both RFCs say so): an NSEC-signed zone can be walked and NSEC3 names dictionary-attacked, so the published addresses can be recovered. That hash is case-sensitive (RFC 7929 §3), unlike the Web Key Directory hash below.

Both standards presuppose a DNSSEC-signed zone, and Pepsi treats that as binding in both directions. pepsi-keys dns says so in its own output, and a lookup is AD-gated: an answer the resolver did not validate is refused outright rather than accepted at a lower rank, because an unsigned key record is a key from whoever can answer for the zone. Pepsi trusts a validating resolver rather than validating DNSSEC itself, so a deployment without one gets no DANE results at all — pepsi-setup probes for this and reports it. See pepsi-keys, pepsi-keydisc and Key management.

97.2.32. OpenPGP Web Key Directory (draft-koch-openpgp-webkey-service)

The Web Key Directory is the HTTPS half of the same job: a correspondent’s key is fetched from the address’s own domain under a hash of its local part. Pepsi computes that hash in pepsi_common::keystore::wkd_local_part_hash — z-base-32 of the SHA-1 of the lower-cased local part — and stores it on each identity, indexed, so a request is answered with one lookup instead of by hashing every candidate row. (The SHA-1 there is a naming function the specification fixes, not a security one, so it is deliberately not gated by CRYPTO_ALLOW_WEAK_DIGESTS.)

The client side is implemented: pepsi-keydisc@wkd-advanced queries openpgpkey.<domain> and pepsi-keydisc@wkd-direct the domain itself. They are separate ranks and therefore separate concurrent lookups rather than a fallback chain, since running direct only “if advanced fails” would accept the weaker answer whenever the stronger one was merely slow. The fetch is hardened beyond the draft’s own requirements: HTTPS only with certificate validation and no insecure mode, at most one HTTPS-to-HTTPS redirect to the same host, refusal to connect to loopback/private/link-local addresses, a body cap enforced while streaming, a deadline on every step, and IDNA A-label conversion. A returned key whose User ID does not name the queried address is discarded — without that, a domain could answer every request with one key of its choosing — and the policy file’s mailbox-only and dane-only directives are honoured.

The serving side is implemented too, by pepsi-httpd: the direct and advanced forms of both the key and the policy path, answered by an indexed (domain, local-part hash) lookup over identities this deployment holds and has marked published. The response is the binary transferable key with Access-Control-Allow-Origin: *; the policy file is a zero-length 200, which has to exist because GnuPG reads its absence as “no Web Key Directory here”; an unknown hash is an empty-bodied 404. The ?l= parameter is read and ignored — honouring it would turn the endpoint into a lookup by caller-supplied address rather than by a hash the caller had to know. A revoked identity is served too when its public half carries the revocation certificate the revoking command signed while the private half still existed (RFC 9580 key revocation signature), after the address’s usable keys, so a client that refreshes the key from the directory learns it is dead (Revocation publishes what it can).

Two properties of the serving side are deliberate. It never serves a cached correspondent key, only our own identities: publishing material we did not verify, under our own domain name, is what a key server does and we are not one. And it applies no rate limiting, because a Web Key Directory is a public oracle by construction — see Key management. The served-key self-check (Checking what is actually served) fetches back what the two methods actually answer from the outside, since the apex is often served by another web server, and compares it with the key store.

The specification is an Internet-Draft rather than an RFC.

97.2.33. Received header privacy (draft-josefsson-email-received-privacy)

RFC 5321 §4.4 has every SMTP server record the client it took a message from, and RFC 5321 §7.6 names the privacy cost without offering a way out: on the submission hop the clause writes the user’s IP address, reverse name and machine name into every message they send, to every recipient and every list archive. Josefsson and Nordberg’s draft is the one written convention for leaving it out: the from clause is not added by servers concerned with their clients’ privacy, and everything else — the by clause loop detection (§6.3) reads, the with keyword, the date — stays.

Ingress follows it on every listener with RECEIVED_PRIVACY, on by default for a SUBMISSION listener and the local submission socket, writing Received: by <HOSTNAME> (pepsi-ingress) with ESMTPSA … with no from clause at all (received_header in pepsi-ingress/src/smtp/session.rs), which RFC 5322 §3.6.7’s received-token grammar admits. It goes one step further than the draft and removes the client’s User-Agent and X-Mailer fields on the same listener, since a header naming the mail client, its version and the operating system undoes much of what the omitted clause kept. MAX_SELF_HOPS counts the by clause and is unaffected; an MX listener keeps the full clause, which abuse handling at the next hop needs, and the ingress journal records the client either way.

The draft is expired and was never adopted by a working group; the behaviour it describes is what large providers do on submission.

97.2.34. Autocrypt — the Autocrypt: header

Autocrypt is not an RFC but a de-facto standard, and it is how most PGP-using mail clients advertise a key today. Pepsi harvests the header — together with application/pgp-keys parts and the signer certificates inside an S/MIME SignedData — from mail that has already arrived.

Harvesting is deliberately not a discovery service: it costs no network I/O because the material is already in front of it, so it runs inline rather than as a pepsi-keydisc instance, and inbound is rejected in [pepsi-keydiscovery] SOURCES. It does write through the same path, so a harvested key also releases any message parked waiting on that address.

A harvested key is trusted on first use and sits near the bottom of the trust ladder; only a key introduced by a third party’s Autocrypt-Gossip: field ranks lower (see below). The server-side conflict rule stops it displacing anything better attested. The distinction is a real setting: MIN_TRUST = harvested means rank 7 exactly, so it keeps opportunistic encryption while excluding third-party introductions. A harvested key is nevertheless usable by default, because the alternative to encrypting to a TOFU key is sending cleartext. See Key management.

Pepsi writes the header as well. Unless [stage-encrypt] AUTOCRYPT is turned off, pepsi-stage-encrypt advertises the From: author’s own OpenPGP key on every locally submitted message — including plain cleartext mail, which is the case that matters, since a correspondent has to learn the key before there is anything to encrypt with. What is advertised is the minimal five-packet transferable public key of Level 1 §2.1.1, only for an identity that still holds its private material, and never on a message that already carries an Autocrypt: field from the sender’s own client. Because the stage runs immediately before DKIM signing, the header is covered by our own signature.

prefer-encrypt=mutual is claimed only when the effective ENCRYPT policy is required. Level 1 §2.4 has a correspondent’s client encrypt by default only when both ends say mutual, so claiming it under an opportunistic policy — one whose ON_NO_KEY = cleartext says unencrypted mail is acceptable — would announce a preference the deployment does not enforce.

Level 1 §5.3 key gossip is implemented too, under [stage-encrypt] AUTOCRYPT_GOSSIP. It is the mechanism by which one message advertises the keys of the other recipients, so that two correspondents who have never written to each other can nevertheless answer encrypted. It is off by default: unlike the Autocrypt: header, which publishes a key its owner asked this deployment to hold, gossip redistributes third parties’ cached key material to correspondents who did not ask for it, and that is an operator’s decision to take deliberately.

Two properties make the feature safe to turn on. The fields are carried inside the ciphertext and only there, because an outer one would publish the recipient set of an encrypted message to every relay on the path. So there is no gossip on cleartext, on signed-only mail, or in an S/MIME container, which Autocrypt does not define. And the addresses gossiped are read from the message’s To: and Cc: fields alone: the envelope recipient list, which carries the Bcc recipients, is consulted only to remove an address from the set. A blind recipient can therefore never appear in any copy, which is exactly the rule Level 1 §5.3 also imposes on a receiver.

The receiving half is implemented as well, in pepsi-stage-autocrypt-learn under LEARN_GOSSIP (default on) — a stage of its own so that it runs after the spam checks, which §5.3 also asks for and which pepsi-stage-decrypt, first on the inbound path by design, cannot do. §5.3 requires a gossiped key to be kept in a peer state separate from one learnt from an Autocrypt: header, so that a third party’s introduction can never displace what an address’s owner said about themselves; Pepsi realises that as a rung of its own at the bottom of the discovery trust ladder (gossip, rank 9, below harvested), which the database’s conflict rule already knows how to enforce. A field counts only when it really was inside the ciphertext — an outer one could have been written by anything on the path — only when its addr is in the message’s own To:/Cc:/Reply-To:, never for the sender’s own address, and never for an address this host serves. It never carries prefer-encrypt, and a signature checked against a gossiped key comes back valid-untrusted, so an introduction opens no gate. §5.3’s peer-state promotion is implemented too: when the address’s owner later sends the same key in their own Autocrypt: header (or attaches it), the row moves off the gossip rung, takes the owner’s effective date, and the change is recorded as a key.peer.promote event — not as a key change, since the key did not change.

Within the Autocrypt tier, a different key from the owner replaces the stored one when its message is newer, so a correspondent who reinstalls their client can replace their own key; such a rotation is never silent (a key.peer.rotate event, and a notice to the local recipients under RESPONSE_STAGE), and ACCEPT_ROTATION = expired restricts it to addresses whose stored keys are all dead. See pepsi-stage-autocrypt-learn.

97.2.35. VKS — the verifying key server protocol

keys.openpgp.org and its work-alikes speak a small HTTP protocol under /vks/v1, and it is deliberately not HKP: a key is only served for an address once the address holder has answered a confirmation mail, which is what makes the answer worth more than “somebody uploaded this”.

Pepsi speaks both halves. pepsi-keydisc@vks looks a correspondent up by address, discarding a key whose User ID does not name the address queried and skipping a revoked one; it ranks below DANE, both Web Key Directory methods and LDAP, because the confirmation proves control of the mailbox and nothing more. pepsi-keys uploads our own identities and requests verification — off by default ([pepsi-keys] VKS_PUBLISH), because publishing a user’s address to a third party is an operator’s decision and, unlike the Web Key Directory, it cannot be undone. The server’s confirmation mail then has to be answered, which is the whole job of pepsi-stage-vks-confirm — a stage that follows a link only after seven independent checks, including that the envelope sender’s host is exactly the configured key server, that every link in the body points there too, and that the mail names the fingerprint of the key Pepsi uploaded. A key that was uploaded and is later revoked has its revocation certificate uploaded by the same retry job, without a new confirmation round: the server publishes a revocation for the key whatever its addresses’ verification state.

97.2.36. RFC 8446 — TLS 1.3

Every TLS-protected connection in Pepsi — inbound STARTTLS and implicit-TLS listeners, the outbound relay client, LMTP, the HTTP server and the LDAP discovery client — runs over rustls, which speaks TLS 1.3 and 1.2 and nothing older. There is no configuration knob to re-enable SSLv3 or TLS 1.0/1.1, because rustls does not implement them.

What varies between those connections is not the protocol but what authentication is required of the peer, and that is where the mail-specific standards take over: RFC 6125 for identity matching, RFC 7672 for DANE, RFC 8461 for MTA-STS, and the TLS_VERIFY option for the case where an operator knowingly relaxes it. Opportunistic STARTTLS to an arbitrary MX authenticates nothing by design. That is RFC 3207’s model, not a weakness here, and it is why DANE and MTA-STS exist and why the outcome of every attempt is recorded for RFC 8460 reporting.

97.2.37. RFC 8314 — Implicit TLS

A listener with MODE = tls performs the TLS handshake before the SMTP greeting (implicit TLS, e.g. the submissions port 465), as recommended by RFC 8314.

Following RFC 8314 §4.3, ingress also records the negotiated TLS version and cipher in the Received: trace header that it prepends, as a (version=… cipher=…) comment after the ESMTPS keyword, since the bare ESMTPS transmission type does not convey which parameters were used.

A listener that authenticates TLS client certificates requests one only from a client that negotiates TLS 1.3, which encrypts it; TLS 1.2 would send the certificate, and the user it names, in the clear (TLS_AUTH_CLIENT_TLS12 restores the request for devices that speak nothing newer).

97.2.38. RFC 8460 — SMTP TLS Reporting (TLSRPT)

When [pepsi-tlsrpt] SEND_REPORTS is on, the relay stages record the outcome of each outbound TLS session in the pepsi.tls_session aggregate-counter table. pepsi-tlsrpt(1), run daily from cron, groups a day’s rows into one RFC 8460 JSON report per policy domain, gzips it, looks up the domain’s _smtp._tls rua and ships it by mailto: (injected back into the pipeline so it is signed and relayed) or HTTPS POST, to at most the first five rua targets. The advertising half is pepsi-setup printing our own _smtp._tls TXT record from [pepsi-tlsrpt] RUA. A session whose certificate matched none of the next hop’s TLSA records is recorded as tlsa-invalid (section 4.3.2.1), both when DANE = strict refused it and when DANE = warn let it through on the fallback check. An advertised MTA-STS policy that cannot be fetched with nothing cached is recorded as sts-policy-fetch-error, or sts-webpki-invalid for a certificate failure (section 4.3.2.2), with no receiving-mta-hostname in the report, since no MX was reached. The shared types, failure classifier and report builders live in pepsi-common::tlsrpt. See pepsi-tlsrpt.

97.2.39. RFC 8461 — MTA-STS

pepsi-stage-relay-to-internet discovers and enforces recipient-domain MTA-STS policies: an enforce policy restricts delivery to the listed MX hosts over authenticated STARTTLS, while a testing policy is validated as enforce would be and only logged, never allowed to affect delivery (§8.4). A fetched policy is kept for its max_age (capped at one week) in the pepsi.mta_sts_policy table, with an in-memory first level in front of it, so it stays enforced across messages, worker recycling and restarts: §5.1 relies on a sender remembering a policy, because an attacker who strips the _mta-sts TXT record or blocks the fetch defeats a sender that has to fetch afresh. A cached policy is re-fetched when the advertised id changes and kept if the new one cannot be fetched; with no cached policy, a failed fetch fails open (§5). A cached policy is fetched again once half of its lifetime has gone, on use and, independently of mail flow (§10.2), by the hourly pepsi-queue gc, so a domain that keeps publishing a policy is never back at a first contact however rarely it is mailed; a policy whose refreshes keep failing lapses at its max_age, and pepsi-queue gc prunes it.

For our own domains, pepsi-setup prints the _mta-sts TXT record to publish, and pepsi-httpd serves the policy file at https://mta-sts.<domain>/.well-known/mta-sts.txt. See pepsi-setup.

97.2.40. RFC 8601 — Authentication-Results

Ingress prepends a standalone Authentication-Results header carrying the SPF, DKIM, DMARC and iprev (FCrDNS) verdicts, with the ingress hostname as the authserv-id. The ARC stage reproduces the same assessment in its AAR.

[pepsi-ingress] IPREV_ACTION = reject turns a definite iprev fail into a refusal at RCPT with the RFC 7372 code 550 5.7.25, for an unauthenticated session on a non-submission listener (<postmaster> excepted); temperror and permerror never refuse. The default records only.

97.2.41. RFC 8617 — ARC

pepsi-stage-arc verifies any inbound ARC chain and seals the message as our ADMD by prepending an AAR/AMS/AS set, signed with the single ARC_ALGORITHM. This lets the final receiver trust the boundary verdict even after Pepsi’s forwarding breaks SPF/DKIM alignment. The ARC-Message-Signature’s RFC 6376 parameters — canonicalization (c=), covered headers (h=) and an x= expiration (none by default) — are configurable on the stage (as they are on pepsi-stage-dkim-sign); the l= body-length tag is never emitted, since it would make the chain unvalidatable.

97.2.42. RFC 8659 / RFC 8657 — CAA

Pepsi obtains its certificates from Let’s Encrypt over HTTP-01, so a hijack of the route or the DNS during a validation yields a trusted certificate for the MX and the openpgpkey host. pepsi-setup run prints a CAA record naming letsencrypt.org with the RFC 8657 accounturi of this host’s certbot account, commented out and never applied, since a CAA record restricts every certificate of the domain. pepsi-setup check finds the relevant record set as a CA does (RFC 8659 §3: the name’s own set, else the nearest ancestor’s up to the top-level domain) for each served domain and certificate host, and reports none (no issue property), without accounturi, or not DNSSEC-validated (the public resolvers return the set without the AD bit, so a spoofed answer can remove it). A set under which no Let’s Encrypt account can obtain a certificate by HTTP-01 — another CA only, another accounturi, a validationmethods parameter (RFC 8657 §4) without http-01, or an unknown property flagged critical (RFC 8659 §4.1) — is reported as an error, because certbot’s next renewal fails. issuewild is not consulted, since Pepsi obtains no wildcard certificate. See pepsi-setup(1) (check) and CA domain validation subverted via BGP and DNS attacks.

97.2.43. RFC 8689 — Require TLS

Both halves. pepsi-ingress advertises REQUIRETLS only on a TLS-protected session (§2) and tags a message that arrives with the MAIL FROM parameter state.tls_required = "required", or "no" when it carries a lone TLS-Required: No header field instead (§4.1); on a cleartext session the parameter is refused with 530 5.7.10. For a "required" message pepsi-stage-relay-to-internet follows §4.2.1: MX host names validated by DNSSEC or an MTA-STS policy, STARTTLS mandatory, the certificate authenticated by DANE (RFC 7672) or PKIX (RFC 6125), the extension advertised by the hop after the upgrade, the parameter passed on; each MX host is tried, and when none qualifies the message is bounced with 5.7.30 or 5.7.10 (RFC 5248). pepsi-stage-relay-to-smarthost applies the same to its configured hop (TLS_VERIFY = no overridden, MODE = plain refused). A "no" message is delivered per §4.2.2, the recipient domain’s DANE and MTA-STS policy advisory. Bounces follow §5: pepsi-stage-bounce returns headers only and tags the DSN, which the relay stages return over validated TLS and with the parameter where the return path advertises it, but do not discard for a hop that lacks the extension. Mediators that re-originate a message — a mailing-list digest, an auto-reply — start a new message without the tag (§6 asks for this “to the extent feasible”); a list’s per-member copies and alias expansions are splits of the tagged row and keep it. See Require TLS for one message (RFC 8689).

97.2.44. RFC 9051 / RFC 4155 — reading a mailbox (IMAP and mbox)

Pepsi serves neither protocol: it is not a mail store. It reads mailboxes in two places: pepsi-helper-mailbox-scan, which seeds a whitelist from the mail a user has already sent (see pepsi-whitelist), and pepsi-archive, which imports and exports a list archive as mbox. The rest of this section is about the former.

The IMAP client is read-only in the strict sense — it issues EXAMINE rather than SELECT and fetches BODY.PEEK[HEADER], so no message is marked \Seen and no mailbox state changes. Only header blocks are read; every reader stops at the blank line, so message bodies never enter the process. The same helper reads local mbox (RFC 4155) and Maildir, and can consume a doveadm -f json stream.

LMTP (RFC 2033) is the delivery counterpart and has no fetch verb at all, which is why a mailbox on an LMTP-only MDA cannot be scanned; IMAP is the network option.

97.2.45. RFC 9106 — Argon2

Argon2id appears twice, for two different threats.

In the secure-link portal (The secure-link fallback portal) it derives the key that encrypts a stored message from the recipient’s PIN plus a per-message salt and a server-side pepper held outside the database. The cost parameters are chosen so that a PIN short enough to read over the telephone is still expensive to grind, and the pepper is what makes a stolen database insufficient on its own — which is why disclosing it is treated as seriously as disclosing the messages.

Everywhere else it hashes stored passwords — the administrative accounts, the mailing-list accounts and list moderator passwords — with one set of parameters, in pepsi-common::password. Both uses cost 19 MiB per derivation, which is why both paths are rate-limited: an unauthenticated attacker who could retry freely would consume memory as fast as they consume guesses.

97.2.46. RFC 6238 / RFC 4226 — TOTP second factor

An address may enrol a time-based one-time password (RFC 6238, over the RFC 4226 HOTP computation) as a second factor for self-service key management: once enrolled, the e-mail key commands other than status, an unprivileged pepsi-keys and the console under an own: principal all need a current code. The parameters are RFC 6238’s defaults — HMAC-SHA-1, six digits, 30 s steps — because they are the only combination every authenticator app implements, and one step of clock skew is accepted either side. The secret is wrapped under the key store’s key-encryption key and readable by the pepsi-crypto role alone; the otp_attempt SQL function refuses a code for a step at or before the last accepted one (replay) and locks the enrolment after ten consecutive failures. See pepsi-common::keystore::otp and pepsi-keys.

A console account may enrol the same second factor (pepsi-keys otp enroll --console LOGIN, kept under the subject console <login>): its password sign-ins then need a current code as well, which the setup applier checks, since the web tier cannot open the secret.

Enrolment by e-mail is confirmed before it counts: otp enroll keeps the new secret pending, and only otp confirm with a code from it, within [stage-encrypt] OTP_CONFIRM_WINDOW, makes it the enrolment, with that code’s step as the replay floor. The reply that carries the secret is marked with the Expires: header field of RFC 4021 §2.1.48 at the end of that window, which clients that honour it use to hide or expire the message, and is encrypted to the user’s own keys when they have any.

97.3. Applicable RFCs not yet implemented

These standards are in scope for an MTA or a crypto gateway but are not implemented, some of them by decision. Several are partial in a specific way: a status object exists and is reported, which is easy to mistake for the check having been performed.

RFC

Title

Status in Pepsi

RFC 3030

BINARYMIME body value

CHUNKING/BDAT is supported, but BODY=BINARYMIME is not advertised or accepted.

RFC 6960

OCSP queries (as opposed to stapled responses)

Not implemented, by decision. No OCSP responder is queried, because a query would tell the CA which certificate was used and when. S/MIME revocation is checked against the CRLs (RFC 5280 §5) that pepsi-keydisc fetches from the certificates’ distribution points instead, and soft-fails: where no usable CRL is at hand a revoked S/MIME certificate still validates, and the Revocation status reads NotChecked so a report says “we did not check” rather than imply “not revoked”. A response a TLS server staples is evaluated (RFC 6960 above).

RFC 2634

Enhanced Security Services for S/MIME (triple wrapping)

Not emitted, by decision: Pepsi signs then encrypts (the signature inside the ciphertext), never sign-encrypt-sign. An arriving triple-wrapped message is opened (RFC 8551 §3.7), and its inner signature is the one that counts. Signed receipts and security labels are absent.

RFC 3161

Time-Stamp Protocol (TSP)

Not implemented. The S/MIME signingTime attribute is the signer’s own claim, so it is reported but never used as the instant a certificate is validated at (RFC 5750 §5): the chain is judged at the time Pepsi processes the message, so a backdated claim cannot revive an expired certificate. A deployment needing “signed when it says it was” needs a timestamp token, which Pepsi neither produces nor requires.

RFC 6541

DKIM Authorized Third-Party Signatures (ATPS)

Not implemented. The vendored mail-auth parses the atps= and atpsh= tags of a DKIM-Signature field but, patched for Pepsi, performs no ATPS lookup: the tags are ignored and the signature’s result is its own, so a missing or unreachable ATPS record cannot turn a valid signature into an error. No policy consults ATPS.

RFC 6651

Extensions to DKIM for failure reporting

Not implemented. The r= tag is parsed; no failure report is ever generated or sent.

RFC 5321

ETRN / on-demand queue starting

Not implemented and not planned. Pepsi’s queue is a database table drained by the dispatcher; there is no per-domain queue to release.