Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1410654

Summary: systemd unit file should not specify USER, should let mosquitto drop privileges itself
Product: [Fedora] Fedora Reporter: Brian Boucheron <brian>
Component: mosquittoAssignee: Rich Mattes <richmattes>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: linville, mail, pbrobinson, richmattes
Target Milestone: ---Keywords: Tracking
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mosquitto-1.5-3.fc27 mosquitto-1.5-3.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-09 19:46:05 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: 1269538    

Description Brian Boucheron 2017-01-06 01:52:19 UTC
Description of problem:
Mosquitto can not load SSL certs with root-only permissions if it is started as user "mosquitto". As of v1.4 Mosquitto loads certificates before dropping to the "mosquitto" user (by default, or whatever is specified in the conf). Relevant section of the mosquitto changelog below:

"""
Root privileges are now dropped after starting listeners and loading
certificates/private keys, to allow private keys to have their permissions
restricted to the root user only. Closes bug #452914.
"""

Steps to Reproduce:
1. Install certificates and keys that are restricted to root user (Let's Encrypt, for instance)
2. Update mosquitto.conf to point to said certs
3. Restart mosquitto

Actual results:
mosquitto fails to restart, with 'Error: Unable to load CA certificates. Check cafile "/etc/letsencrypt/live/[...]/chain.pem".'

Expected results:
mosquitto should load the specified certs before dropping to the user specified in mosquitto.conf


Additional info:
Suggest dropping 'USER="mosquitto"' from the unit file and letting mosquitto handle dropping privileges.

This is my first bug report here, sorry if it's not quite right. This is on CentOS 7 with EPEL 7. Thanks!

Comment 1 Fedora End Of Life 2017-02-28 10:53:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle.
Changing version to '26'.

Comment 2 Fedora End Of Life 2018-05-03 08:12:17 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 3 Peter Robinson 2018-05-26 17:24:46 UTC
Confirmed this is still and issue with mosquitto 1.5, and dropping the User=mosquitto fixes the problem of starting when there's a cert configured.

Comment 4 Rich Mattes 2018-05-26 18:42:22 UTC
mosquitto 1.5 includes a systemd service file under service/systemd, and also includes support for systemd notification.  I will remove the systemd unit from the spec and use the one shipped by upstream.

Comment 5 Peter Robinson 2018-05-26 18:54:41 UTC
(In reply to Rich Mattes from comment #4)
> mosquitto 1.5 includes a systemd service file under service/systemd, and
> also includes support for systemd notification.  I will remove the systemd
> unit from the spec and use the one shipped by upstream.

There's some things needed in the service file that aren't included like the network wait:
After=network-online.target
Wants=network-online.target

And also probably the docs line is useful:
Documentation=man:mosquitto.conf(5) man:mosquitto(8)

Comment 6 Rich Mattes 2018-05-26 19:52:34 UTC
That's fair, I will patch those lines in to the upstream unit file and file a PR upstream.

Comment 7 Rich Mattes 2018-05-26 20:47:04 UTC
Built in rawhide, upstream PR is here:
https://github.com/eclipse/mosquitto/pull/835

There's still some pending mosquitto updates in bodhi, should I wait for those to get submitted before creating new updates?

Comment 8 Peter Robinson 2018-05-26 21:07:26 UTC
I think it's fine to update, it'll just obsolete them. Add the BZ and all should be good

Comment 9 Fedora Update System 2018-05-26 21:30:43 UTC
mosquitto-1.5-3.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-cacb23c3bb

Comment 10 Fedora Update System 2018-05-26 21:38:58 UTC
mosquitto-1.5-3.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-160bc5c06d

Comment 11 Fedora Update System 2018-05-26 21:50:23 UTC
mosquitto-1.5-3.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-040d64408b

Comment 12 Fedora Update System 2018-05-27 20:29:27 UTC
mosquitto-1.5-3.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-160bc5c06d

Comment 13 Fedora Update System 2018-05-27 20:44:37 UTC
mosquitto-1.5-3.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-040d64408b

Comment 14 Fedora Update System 2018-05-27 22:13:26 UTC
mosquitto-1.5-3.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-cacb23c3bb

Comment 15 Fedora Update System 2018-06-09 19:46:05 UTC
mosquitto-1.5-3.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2018-06-09 20:39:43 UTC
mosquitto-1.5-3.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.