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
SELinux issue related to temporary csv-files and mysqld #20032
Comments
Hi @hkotkanen, thanks for reaching out on this one. You are correct, the temporary .csv files are being created for LOAD DATA INFILE. Other than creating a new SELinux policy to allow the mysql process to access these files, the only other option I can see would be to disable use of LOAD DATA INFILE by adding I'll categorize this issue as a documentation update and assign it for prioritization. We should at least note in the installation guide that SELinux in enforcing mode will need policy changes in order for Matomo to work. A separate guide covering all SELinux changes required for Matomo installation would be even better. 🙂 |
Thanks for responding! I can try to contribute: here are the SELinux operations I needed to get Matomo running under Enforcing mode (CentOS 7.9). This is only for normal operation - automatic updates will not work (probably best to e.g.
Then the custom policy module contents in file
Steps needed to compile and install the new policy (creates intermediate files):
I thought I had looked everywhere but wouldn't you know it, only after writing all this I came across this old issue where @pizzarabe already gave pretty much identical instructions! Well, maybe it'll now end up in an installation guide that's a bit more easy to find. |
Thanks for sharing @hkotkanen, that'll be really helpful when writing the guide :+1: It's also good to have confirmation that the required SELinux operations haven't changed much since the 2015 issue :slightly_smiling_face: |
I’m running Matomo on a CentOS 7.9 machine and would like to keep SELinux in Enforcing mode. I’ve configured other required policies like allowing httpd to send mail, connect to the db and write to some directories. However, I still have one issue:
The problem are these temporary .csv files the Matomo is creating in
matomo/tmp/assets/
directory (the path in the messages below is different for legacy reasons), which the database then wants to read. Below is an example snippet from the audit log, but there are other types of files as well causing the same kinds of messages, like matomo_archive_blobs and matomo_archive_invalidations.I’m guessing this has to do with the LOAD DATA INFILE capability of the database which was marked as optional in the installation guide. I’m also guessing that it’s the Matomo app (i.e.
httpd
) that’s creating these temporary .csv files, which in my understanding means that they are necessarily going to get created with thehttpd_sys_rw_content_t
type, which themysqld_t
domain is not allowed to touch by default.So one (the only?) way of solving this that I can think of would be to compile a new policy where processes marked as
mysqld_t
would be granted thegetattr
,open
, andread
permissions for files of typehttpd_sys_rw_content_t
, but I’d like to know if anyone knows of other, simpler ways to deal with this? Having to compile a new SELinux policy is a bit of a hassle, and also that kind of policy would be quite broad when considering the specificity of the actions being done here.I thought it would be best to submit this is a documentation issue as it could be addressed in the installation guide but feel free to shuffle it around if another category would be more suitable.
The text was updated successfully, but these errors were encountered: