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

Arbitrary setting of file mode on owncloud.log #32221

Closed
davidjericho opened this issue Aug 2, 2018 · 4 comments · Fixed by #32222
Closed

Arbitrary setting of file mode on owncloud.log #32221

davidjericho opened this issue Aug 2, 2018 · 4 comments · Fixed by #32222

Comments

@davidjericho
Copy link

davidjericho commented Aug 2, 2018

Steps to reproduce

  1. chmod owncloud.log file to a mode other than 0640.
  2. Cause an event, of any kind, that is logged.
  3. See owncloud.log file chmod'ed back to 0640.

Expected behaviour

It isn't ownCloud's job, when logrotation is disabled, to manage the file permissions. I am managing it via logrotate and other methods, as we use filebeats to take the json log and feed it into elasticsearch. I'm not keen to add filebeat to the php user group, as that would mean I'm expanding the footprint of possible users that can write to data in certain scenarios.

I would suggest that the chmod only be performed upon file rotation when managed by ownCloud itself.

Actual behaviour

ownCloud keeps reverting the log file permissions to 0640, as per https://github.com/owncloud/core/blob/master/lib/private/Log/Owncloud.php#L132

Not to mention the ownCloud instance is performing needless busy work on every log event.

Server configuration

Operating system: RHEL 7.5
Web server: Apache 2.4.6
Database: MariaDB 10.0 w/Galera
PHP version: 7.0 from the Remi repo
ownCloud version: 10.0.9
Updated from an older ownCloud or fresh install: Not relevant
Where did you install ownCloud from: Git

@ownclouders
Copy link
Contributor

GitMate.io thinks possibly related issues are #20015 (Owncloud log file), #4366 (owncloud log file permissions), #4503 (owncloud losing files!), #24488 (Owncloud.log goes crazy.), and #7391 (Lost files in owncloud).

@mdusher
Copy link
Contributor

mdusher commented Aug 2, 2018

Since rotating just calls \OCP\Util::writeLog() to handle the file creation on a rotate, it'd probably still have to be done in the actual Owncloud logger.

Maybe only perform the chmod on the creation of the log file, rather than every write? Something like this might work (it's untested as I was just sketching out the idea):
mdusher@7792eaf

@DeepDiver1975
Copy link
Member

Feel free to submit this as pull request. Im Happy to review this. THX

@mdusher
Copy link
Contributor

mdusher commented Aug 2, 2018

@DeepDiver1975 done.

DeepDiver1975 pushed a commit that referenced this issue Oct 17, 2018
…32222)

* Set permissions on log file creation instead of every write.

* Code style fix and removed unnecessary else condition
felixheidecke pushed a commit that referenced this issue Oct 31, 2018
…32222)

* Set permissions on log file creation instead of every write.

* Code style fix and removed unnecessary else condition
phil-davis pushed a commit that referenced this issue Jan 8, 2019
…32222)

* Set permissions on log file creation instead of every write.

* Code style fix and removed unnecessary else condition
@lock lock bot locked as resolved and limited conversation to collaborators Oct 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants