Commit Graph

6 Commits

Author SHA1 Message Date
Ilia Ross
750940e2f5 Fix to respect Unix user identity for systemd user unit defaults 2026-06-04 12:11:35 +02:00
Ilia Ross
a83db9f57d Add advanced systemd unit and user unit management
This PR expands the "Bootup and Shutdown" module’s systemd support with creation and management for services, timers, sockets, paths and targets. It also adds user-scoped systemd units, linger controls, status and log actions, tabbed unit listings by type, and contextual help for the new options.

For user-scoped units, the implementation includes several safety guards because unit files live under user-controlled home directories:

- User accounts are validated with system account data before any user-unit operation is attempted.
- User unit names are restricted to known systemd unit suffixes and safe filename characters.
- User unit files are limited to direct children of `~/.config/systemd/user`.
- Symlinked `.config`, `.config/systemd`, and `.config/systemd/user` paths are rejected.
- User unit reads, writes, directory creation, and deletes are performed after dropping privileges to the target Unix user.
- File operations re-check paths close to the actual read/write/delete operation to reduce symlink race exposure.
- User unit create failures roll back half-created files when daemon reload fails.
- User-provided unit names, owners, paths, command output, and logs are HTML-escaped before display.
- systemctl, journalctl, and loginctl command arguments are shell-quoted before execution.
- User services omit `User=` and `Group=` directives because they already run under the selected user’s systemd manager.

Together, all these changes will allow Webmin admin to manage both system and user systemd units while keeping user-controlled home-directory paths from becoming root-level file read/write/delete exploits.

Implemented in response to these two issue requests  https://github.com/webmin/webmin/issues/2733 and https://github.com/webmin/webmin/issues/2734
2026-06-02 20:32:03 +02:00
iliajie
60349eb62e Protect Webmin from being deleted or stopped, and restart properly 2022-10-19 14:25:43 +03:00
Jamie Cameron
20db4a29cf Show config file name 2021-09-09 21:50:17 -07:00
Jamie Cameron
8a684d8c41 Detect and show unknown status systemd actions https://www.virtualmin.com/node/59115 2018-10-20 10:33:26 -07:00
Jamie Cameron
b1362f4994 Fix message with PID is not known 2011-12-25 19:40:57 -08:00