sardemff7 / eventd

A simple daemon to track remote or local events and do actions the user wants to
https://www.eventd.org
Other
46 stars 4 forks source link

eventd: incorrectly uses /run directory in absence of XDG_RUNTIME_DIR env variable #32

Closed Coacher closed 7 years ago

Coacher commented 7 years ago

Hello.

Spec on XDG_RUNTIME_DIR says:

The directory MUST be owned by the user, and he MUST be the only one
having read and write access to it. Its Unix access mode MUST be 0700.
[...]
If $XDG_RUNTIME_DIR is not set applications should fall back to
a replacement directory with similar capabilities and print a warning
message.

FHS spec on /run says:

/run should not be writable for unprivileged users; it is a major
security problem if any user can write in this directory. User-specific
subdirectories should be writable only by each directory's owner.

eventd falls back to /run/eventd directory when XDG_RUNTIME_DIR isn't set. Because /run mustn't be writable by regular users, this attempt fails, e.g:

~ $ echo $XDG_RUNTIME_DIR

~ $ eventdctl start

(eventd:2362): eventd-WARNING **: Couldn't create the run dir '/run/eventd': Permission denied
Segmentation fault (core dumped)

This problem prevents d-bus activation from happening when XDG_RUNTIME_DIR is not set.

Please fix.

Coacher commented 7 years ago

I suggest to use either user-specific subdirectory in run, e.g. /run/user/<UID>, or /tmp.

sardemff7 commented 7 years ago

It is not a fallback value issue at all. It is the way I detect system-wide mode. I made it this way so system-wide clients are auto-detected, and both client and server detect it the same way. I do not see a nicer way to auto-detect system-wide mode on the client side.

I pushed a series that should fix it: 4f98f44fcfb54c2933d61e3d3262b494f131d56e...ddec4fe347aa2eb53048aae4907f7d6459d4e021

Coacher commented 7 years ago

These changes fixed the problem for me: I can now start eventd via eventdctl start as user and d-bus activation also works. Thank you very much!