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

su command in emonhub logrotate file causing issues #152

Closed
borpin opened this issue Dec 17, 2022 · 2 comments
Closed

su command in emonhub logrotate file causing issues #152

borpin opened this issue Dec 17, 2022 · 2 comments

Comments

@borpin
Copy link
Contributor

borpin commented Dec 17, 2022

The su command is causing issues.

With it and running logrotate without sudo this error appears

switching euid to 0 and egid to 0
error: error switching euid to 0 and egid to 0: Operation not permitted

Removing the command and logrotate complains that

error: skipping "/var/log/emonhub/emonhub.log" because parent directory has insecure permissions 
(It's world writable or writable by group which is not "root") 
Set "su" directive in config file to tell logrotate which user/group should be used for rotation.

Note the parent directory for emoncms and emonhub are different.

drwxr-xr-x  2 pi        root       280 Dec 17 14:52 emoncms
drwxrwxr-x  2 pi        emonhub     60 Jun  9  2020 emonhub

However, I cannot see how the /var/log/emonhub permission get set to 775!

the use of su is a kludge and should be fixed.

@alexandrecuer
Copy link
Contributor

On the emonhub log folder, user should be the current/service user and group should be root so that logrotate can make its job without su root root

The process is very complex for a simple thing :

I cannot test as I dont have any emonpi with emonhub but at least this line :
https://github.com/openenergymonitor/emonhub/blob/afa562bb371a2a426c80ed15a96d808efefc2fed/install.sh#L109
should be :

sudo chown $user:root /var/log/emonhub/emonhub.log

But why using the service to create the log ? wont it be enought to just do it in the install.sh file like for other OEM services ?

@borpin
Copy link
Contributor Author

borpin commented Dec 23, 2022

Firstly, there are more issues than this on the latest release as discussed here https://community.openenergymonitor.org/t/no-disk-space-although-enough-room/22042/53?u=borpin

The process is because this is part of the Log2ram system, so the ram log files are rotated off the ramlog into persistent disk.

This is also tied up with the emonhub user not being used anymore by emonhub.

There are a multitude of issues and if I get a chance I'll work through it to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants