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

Is it possible to run keyd systemd service as DynamicUser (uid != 0)? #459

Closed
woojiq opened this issue Mar 20, 2023 · 4 comments
Closed

Comments

@woojiq
Copy link

woojiq commented Mar 20, 2023

Start a service like this:

keyd/keyd.service

Lines 7 to 8 in 04c9e15

Type=simple
ExecStart=/usr/bin/keyd
is ok on a personal machine, but when you want to create a service "for all" you need to sandbox service as much as possible. Now I'm trying to transfer the keyd service to NixOS and have a little trouble with DynamicUser option. So I'm wondering if this is even possible, I haven't looked at the codebase, maybe someone knows, or even starts the service like that.

@tkna91
Copy link
Contributor

tkna91 commented Mar 21, 2023

@woojiq
Copy link
Author

woojiq commented Mar 21, 2023

That's a bit not what I want to achieve. I understand that keyd can have one instance at a time and cannot be run for a specific user. This is fine. What I want to do is set the DynamicUser option (or User + Group) so that systemd will automatically apply multiple security settings for this service. Also, I tried adding /dev/input and /dev/uinput to DeviceAllow; input to SupplementaryGroups, but still sudo journalctl -eu keyd shows that it doesn't have access to /dev/input/event<num> .

If my wishes are theoretically possible, I can provide my exact solution and errors.
Hope I understand right that DynamicUser and #228 are different issues 🥲

@rvaiya
Copy link
Owner

rvaiya commented Mar 22, 2023

I am not familiar with that particular systemd option, but as long as keyd has r/w access to /dev/uinput, /dev/input/event* (e.g the input group on most systems) and/etc/keyd, then it should work.

@woojiq
Copy link
Author

woojiq commented Mar 22, 2023

Yes, it works. Only my fault as I am not a long time systemd user yet. I added access to /dev/input correctly and it works now. If anyone is interested in this in the future, the issue mentioned above has the answer to how we achieved this.
Cheers.

@woojiq woojiq closed this as completed Mar 22, 2023
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