Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendmail integration not sending mails when using relay #852

Open
onli opened this issue Mar 8, 2024 · 1 comment
Open

sendmail integration not sending mails when using relay #852

onli opened this issue Mar 8, 2024 · 1 comment

Comments

@onli
Copy link
Member

onli commented Mar 8, 2024

On a linux system, I have a working sendmail system. It relays messages via sendgrid, and this works:

echo "This is a test email" | sendmail -f broker@my.hostname my@email.address

This works under root, and it works under broker. The mail arrives in my inbox.

Now I enable portier to use sendmail, by uncomenting this line in the config.toml:

sendmail_command = "/usr/sbin/sendmail"

The results vary depending under which user the broker now runs. Under broker and dynamic user, I get this:

Mar 08 00:56:13 user portier-broker[2733945]: ERROR  Could not send mail: internal client error: Program mode requires special privileges, e.g., root or TrustedUser.
Mar 08 00:56:13 user portier-broker[2733945]: ERROR  [REF:yjfzmr] Failed to send mail

(note though that the same user was able send mails on the terminal.)

Under root I get this:

Mar 08 00:58:26 user portier-broker[2734685]: ERROR  Could not send mail: internal client error:
Mar 08 00:58:26 user portier-broker[2734685]: ERROR  [REF:g6c76b] Failed to send mail

Might this be a systemd issue? I used the provided systemd service file.

@onli
Copy link
Member Author

onli commented Mar 8, 2024

Might this be a systemd issue? I used the provided systemd service file.

Yes, it's a systemd issue. When removing these restrictions, portier works now with sendmail:

TemporaryFileSystem=/run
RemoveIPC=yes
CapabilityBoundingSet=
PrivateTmp=yes
PrivateDevices=yes
PrivateUsers=yes
ProtectSystem=strict
ProtectHome=yes
ProtectKernelTunables=yes
ProtectKernelModules=yes
ProtectControlGroups=yes
RestrictAddressFamilies=AF_INET AF_INET6
LockPersonality=yes
NoNewPrivileges=yes
MemoryDenyWriteExecute=yes
RestrictRealtime=yes
RestrictNamespaces=yes
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM

We should pinpoint and document which restriction exactly blocks sendmail from working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant