FS#62491 - [matterbridge] Config in /etc/ with cleartext passwords is readable by any user

Attached to Project: Community Packages
Opened by Dmitry V. Luciv (dluciv) - Saturday, 27 April 2019, 16:12 GMT
Last edited by Justin Kromlinger (hashworks) - Sunday, 05 December 2021, 15:39 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Caleb Maclennan (alerque)
Bruno Pagani (ArchangeGabriel)
Justin Kromlinger (hashworks)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

Config in /etc/ with cleartext passwords is readable by all users logged in. I suggest making matterbridge (the both user and group) an owner of it and making it not readable by others.

Additional info:
* package version(s) 1.14.4-1, but this likely does not matter
This task depends upon

Closed by  Justin Kromlinger (hashworks)
Sunday, 05 December 2021, 15:39 GMT
Reason for closing:  Fixed
Comment by Bruno Pagani (ArchangeGabriel) - Monday, 06 May 2019, 14:32 GMT
Thing is, there is no persistent matterbridge user nor group, so matterbridge is effectively run without privileges (and thus has even less rights than any logged in user). So we either need to find out how DynamicUser can have a private configuration file or move from a DynamicUser to a static one. I have no time to look at it right know, but if you find out a solution for the first possibility please let me know and I’ll implement it.
Comment by Bruno Pagani (ArchangeGabriel) - Tuesday, 16 July 2019, 09:16 GMT
Apparently `ConfigurationDirectory=matterbridge` combined with DynamicUser will make the temporary user own the file under `/etc/matterbridge/`, but this remains to be tested. I don’t have a running matterbridge at hand currently, so I’ll need someone else to test.

Could you do the following?
0. Stop the running matterbridge if any.
1. Edit the systemd matterbridge.service file on your system, replacing `ExecStart=/usr/bin/matterbridge -conf /etc/matterbridge.toml` by `ExecStart=/usr/bin/matterbridge -conf /etc/matterbridge/matterbridge.toml` and adding `ConfigurationDirectory=matterbridge`.
2. Move `/etc/matterbridge.toml` to `/etc/matterbridge/matterbridge.toml`, make sure the folder is root:root 755 or 700, and the config file within root:root 600.
3. Start matterbridge and verify if it was able to read its configuration file.
Comment by Bruno Pagani (ArchangeGabriel) - Thursday, 09 April 2020, 22:11 GMT
Actually the documentation says `Except in case of ConfigurationDirectory`, so this won’t work.

However another idea could be to copy the configuration file to a temporary place only accessible to this user, and change the permissions. Something like StateDirectory could be used for this. I’ll try to work something out.
Comment by Justin Kromlinger (hashworks) - Sunday, 05 December 2021, 15:39 GMT
Solved in 1.23.2-3 with a dynamic StateDirectory as Gabriel suggested.

Loading...