Skip to content
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

Detect and block Cron and CLI running as Root user #17066

Merged
merged 2 commits into from
May 21, 2024

Conversation

cconard96
Copy link
Contributor

@cconard96 cconard96 commented May 4, 2024

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -

A source of far too many forum posts, issue reports, etc where people end up with broken GLPI file permissions.
The most common case is when an administrator sets up a cron job for the GLPI automatic actions and simply adds the entry to the system's crontab rather than the web server user's crontab (or specifying the web server user in the system crontab entry).

This PR attempts to detect when the cron script and the GLPI CLI are run as root. If the root user is detected, execution will stop before any file ownership can be ruined.

This uses the posix extension which is included with PHP and enabled by default (except on Windows where it doesn't apply at all).

@cedric-anne
Copy link
Member

To be discussed in our weekly meeting, see #6444

bin/console Outdated Show resolved Hide resolved
bin/console Outdated Show resolved Hide resolved
@cedric-anne cedric-anne requested a review from orthagh May 21, 2024 11:27
@cedric-anne cedric-anne added this to the 11.0.0 milestone May 21, 2024
@cedric-anne cedric-anne merged commit 54f50d3 into glpi-project:main May 21, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants