Bug 1188065
| Summary: | No possibility to run saslauthd as non-root (ie as saslauth user) | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Milan Kerslager <milan.kerslager> | |
| Component: | cyrus-sasl | Assignee: | Jakub Jelen <jjelen> | |
| Status: | CLOSED ERRATA | QA Contact: | Stanislav Zidek <szidek> | |
| Severity: | unspecified | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 7.0 | CC: | jjelen, ksrot, pkis, plautrba, systemd-maint | |
| Target Milestone: | rc | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | cyrus-sasl-2.1.26-18.el7 | Doc Type: | Bug Fix | |
| Doc Text: |
Cause:
Runtime directory for saslauthd was unconditionally owned by root.
Consequence:
If customer wanted to run authentication daemon as non-root user, it was not possible without complicated workarounds
Fix:
Create directory in runtime by systemd based on actual settings of Service Unit file.
Result:
The saslauthd daemon is able to run with non-root user.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 1189203 (view as bug list) | Environment: | ||
| Last Closed: | 2015-11-19 09:15:28 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1110700, 1191021 | |||
|
Description
Milan Kerslager
2015-02-01 23:01:11 UTC
Thank you for your report, Milan.
DEAMONOPTS is not used anymore since we use systemd units instead of SysV initscripts. The systemd way is to use User= and Group= options in an unit file as you can see in the following example:
# mkdir /etc/systemd/system/saslauthd.service.d
# cat > /etc/systemd/system/saslauthd.service.d/user.conf <<EOF
[Service]
User=saslauth
Group=saslauth
EOF
# systemctl daemon-reload
# systemctl start saslauthd
# systemctl status saslauthd -l
saslauthd.service - SASL authentication daemon.
Loaded: loaded (/usr/lib/systemd/system/saslauthd.service; disabled)
Drop-In: /etc/systemd/system/saslauthd.service.d
└─user.conf
Active: active (running) since Wed 2015-02-04 17:23:16 CET; 8s ago
Process: 10103 ExecStart=/usr/sbin/saslauthd -m $SOCKETDIR -a $MECH $FLAGS (code=exited, status=0/SUCCESS)
Main PID: 10104 (saslauthd)
With regards to the /run/saslauth, it's really a bug and it will be fixed in the next package update. In the mean time, you can use the following workaround:
# cat > /etc/tmpfiles.d/saslauthd.conf <<EOF
d /run/saslauthd 0755 saslauth saslauth -
EOF
# systemd-tmpfiles --create /etc/tmpfiles.d/saslauthd.conf
# ls -ld /run/saslauthd/
drwxr-xr-x. 2 saslauth saslauth 80 Feb 4 17:38 /run/saslauthd/
Directory /run/saslauthd/ is created with correct group by installation and update. However, if the directory is not there, it is created by saslauthd during its start - but with incorrect group (root).
# service saslauthd stop; service saslauthd stop; rm -rf /run/saslauthd/; ls -ld /run/sasl*
Redirecting to /bin/systemctl stop saslauthd.service
Redirecting to /bin/systemctl stop saslauthd.service
ls: cannot access /run/sasl*: No such file or directory
# service saslauthd start; ls -ld /run/sasl*
Redirecting to /bin/systemctl start saslauthd.service
drwxr-xr-x. 2 root root 100 Jul 10 05:20 /run/saslauthd
# rpm -qa cyrus-sasl\*
cyrus-sasl-lib-2.1.26-18.el7.x86_64
cyrus-sasl-plain-2.1.26-18.el7.x86_64
cyrus-sasl-2.1.26-18.el7.x86_64
Hmm. Awesome tmpfiles.d. There is hardcoded creation of such directory in saslauthd daemon, but it doesn't work if we want specific mode and owners without many awful hacks (changing umask, group) and again superuser privileges. The ideal way would be if tmpfiles and systemd would take care of this directory. RuntimeDirectory= option would be best option, but it is not available in RHEL7 version of systemd. Looks like we are not the only having this problem: https://bugs.freedesktop.org/show_bug.cgi?id=69097 Possibility is to use this line in service file. Is it recommended? ExecStartPre=/usr/bin/systemd-tmpfiles --create saslauthd.conf Maybe systemd maintainers will have some opinion about this issue and how to solve it when we don't have init scripts anymore? Fortunately it is just a corner case and misconfigured system at this point so I would be quite ok to ignore it, but when Stanislav started picking into it I would like to hear some voice from systemd. We are rebasing systemd to newer version in RHEL-7.2 so you'll be able to use RuntimeDirectory option. Great. So I will remove tmpfiles, make the errata dependent on current systemd update and I will use of RuntimeDirectory which is ideal for our use case. Just briefly tested and works fine for me. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHBA-2015-2127.html |