Skip to content

os-postfix: add submission port (587) support#5398

Open
mbedworth wants to merge 1 commit intoopnsense:masterfrom
mbedworth:postfix-submission-port2
Open

os-postfix: add submission port (587) support#5398
mbedworth wants to merge 1 commit intoopnsense:masterfrom
mbedworth:postfix-submission-port2

Conversation

@mbedworth
Copy link
Copy Markdown
Contributor

The os-postfix plugin currently has the submission service block in master.cf hardcoded as a comment with no way to enable it through the GUI or API. This means anyone who needs port 587 for authenticated relay (monitoring systems, MUAs) must either edit master.cf directly or maintain a workaround outside the plugin — both of which get wiped by postfix/service/reconfigure.

This PR adds proper support through the model and template:

Changes

  • General.xml: add submission_enabled (BooleanField, default off) and submission_sasl_local_domain (TextField, optional). Model version bumped to 1.2.8.
  • master.cf: replace the hardcoded commented submission block with a conditional — when submission_enabled=1 the service is activated; otherwise the original comment is preserved.
  • forms/general.xml: add UI fields for both new settings, placed after the TLS Wrapper Mode checkbox.

Behaviour when enabled

The submission service enforces STARTTLS (smtpd_tls_security_level=encrypt) and requires SASL authentication (smtpd_sasl_auth_enable=yes, smtpd_tls_auth_only=yes). The client, HELO, and sender restriction lists are explicitly cleared so that the upstream smtpd_recipient_restrictions (which may include strict checks appropriate for port 25) do not apply — relay access is controlled solely by smtpd_relay_restrictions=permit_sasl_authenticated,reject. Port-level access control is left to the firewall, as is standard practice for submission services.

submission_sasl_local_domain

This optional field sets smtpd_sasl_local_domain in the submission block. It is only emitted when non-empty. It is needed for Cyrus SASL deployments where authentication credentials are scoped to a realm (e.g. smtp.example.com), so that clients can authenticate as user@smtp.example.com rather than user@hostname.

Testing

Tested on OPNsense 25.1 with os-postfix installed:

  1. Enabled submission port and set SASL local domain via GUI → saved → reconfigure.
  2. Verified master.cf contained the active submission block with correct smtpd_sasl_local_domain.
  3. Verified Postfix listening on port 587 (sockstat).
  4. Successfully relayed mail through port 587 from a remote host using Cyrus SASL credentials.
  5. Disabled submission → reconfigure → port 587 gone, commented block restored.
  6. Settings persist across reboots and reconfigures (stored in config.xml).

Add submission_enabled and submission_sasl_local_domain fields to the
Postfix plugin general settings. When submission_enabled is set the
master.cf template activates the submission service on port 587 with
SASL authentication required, TLS enforced, and permissive
client/helo/sender restrictions (access control is handled by SASL
and should be enforced at the firewall). The optional
submission_sasl_local_domain field sets smtpd_sasl_local_domain for
the submission service, which is required when using Cyrus SASL with
realm-based authentication.

Bump model version to 1.2.8.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant