Bug 253049 - security/cyrus-sasl2-saslauthd: allow runing as unprivileged user [patch]
Summary: security/cyrus-sasl2-saslauthd: allow runing as unprivileged user [patch]
Status: Closed Works As Intended
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Hajimu UMEMOTO
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-27 16:28 UTC by ml
Modified: 2021-01-28 11:32 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (ume)


Attachments
SVN patch (521 bytes, text/plain)
2021-01-27 16:28 UTC, ml
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ml 2021-01-27 16:28:30 UTC
Created attachment 221966 [details]
SVN patch

Quoting saslauthd manual, "When running against a protected authentication database (e.g. the shadow mechanism), it must be run as the superuser. Otherwise it is recommended to run daemon unprivileged as saslauth:saslauth".

However, the port RC script does not allow this and always starts the daemon as root.

The attached patch allows running as a different user, by setting "saslauthd_user" in /etc/rc.conf (or equivalent).

Notice:
_ to comply with POLA, the default user is still root, so everything works as before unless config is explicitly changed;
_ the port creates /var/run/saslauthd owned by cyrus:mail, so the only sensible choice is "saslauthd_user=cyrus", unless those permissions are changed.
Comment 1 dewayne 2021-01-27 23:58:36 UTC
Good catch.  Reflecting upon the problem, its as though we need a new default user to "manage" the authentication stream.  Perhaps 
auth:*:6:10:Authentication pseudo-user:/var/empty:/usr/sbin/nologin
because its also ldap, pam, heimdal, samba...  :)
Comment 2 Hajimu UMEMOTO freebsd_committer freebsd_triage 2021-01-28 11:32:17 UTC
Thanks for your report.
However, it is intentional, and you do not need your patch to change user.
You can change user by just putting `saslauthd_user=XXX' into /etc/rc.conf.