Commit Graph

182 Commits

Author SHA1 Message Date
Ilia Ross
14f90afb89 Fix to cache init mode for menu title selection 2026-06-07 16:55:20 +02:00
Ilia Ross
5499d1c051 Fix to modernize init module configuration by boot system 2026-06-05 20:49:53 +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
Ilia Ross
911aa64a36 Fix systemd multiline ExecStart handling
* Note: Generate separate ExecStart= entries for newline-separated systemd start commands and set Type=oneshot when required.

https://github.com/webmin/webmin/issues/2697
2026-05-13 01:06:57 +02:00
Ilia Ross
5558910722 Add API to activate and deactivate a service 2026-03-17 20:05:06 +02:00
Ilia Ross
f778af84a0 Fix create_launchd_agent to support optional load parameter
Some checks failed
webmin.dev: webmin/webmin / build (push) Has been cancelled
https://github.com/webmin/authentic-theme/issues/1729#issuecomment-3899950457
2026-02-16 20:15:52 +02:00
Ilia Ross
76efb4ee10 Fix not to show runlevels config option for systemd 2025-07-12 19:40:04 +03:00
Ilia Ross
049542b7ed Add DropInPaths property 2025-07-05 15:43:26 +03:00
Jamie Cameron
ceb3e583a3 Reduce duplication in list of unit types 2025-07-02 16:51:17 -07:00
Jamie Cameron
436d6f70bb Its cleaner for the API to always return a list 2025-07-02 16:48:39 -07:00
Ilia Ross
699de35596 Fix to create correct rc script
2b357cf0f1 (r152033120)
2025-02-02 13:57:35 +02:00
Ilia Ross
9d5d790526 Fix to ensure systemd custom units are created in the correct directory 2025-02-01 21:23:22 +02:00
Ilia Ross
761a879919 Add ability to return filtered systemd unit options 2025-01-16 21:45:47 +02:00
Ilia Ross
1c8c259eae Add API to edit systemd units 2025-01-16 15:02:54 +02:00
Ilia Ross
468a570adf Add cat_systemd sub to parse systemd unit config 2025-01-15 02:27:50 +02:00
Ilia Ross
dedfc90e71 Fix comment 2025-01-15 01:34:08 +02:00
Ilia Ross
89ae8632e0 Add is_active_systemd sub 2025-01-15 01:23:03 +02:00
Jamie Cameron
d8a7a583a3 Prevent duplication of systemd actions and init scripts https://github.com/webmin/webmin/issues/2227 2024-07-26 14:56:46 -07:00
Ilia Ross
61d2081371 Add to support more passible options to systemd service file 2024-06-16 01:55:03 +03:00
Ilia Ross
0d0e9170b9 Add timeoutstopsec as well 2023-10-13 10:51:33 +03:00
Jamie Cameron
f7cf6419d2 Use taqbs 2023-09-06 16:23:40 -07:00
Ilia Ross
1e375b4740 Fix indent one more time
c573496914
2023-09-04 13:14:31 +03:00
Jamie Cameron
c573496914 Fix indenting 2023-09-03 22:54:28 -07:00
iliajie
f300bd7f5b Add support for more options in unit section in systemd 2022-12-10 15:14:00 +02:00
iliajie
cb98164c82 Fix to only get specific properties for speed 2022-10-22 19:07:05 +03:00
iliajie
0930bdde32 Fix indent 2022-10-22 14:33:42 +03:00
iliajie
debcde489d Abstract systemd unit types 2022-10-22 14:32:02 +03:00
iliajie
bf0a3a109b Fix to filter out all possible templates 2022-10-22 14:18:46 +03:00
Ilia
231c8fcbd3 Merge branch 'master' into dev/fix-systemd-lost-properties 2022-10-22 13:57:02 +03:00
iliajie
831abe0812 Fix to run systemctl show individually for each unit instead 2022-10-22 13:51:40 +03:00
iliajie
429cf742be Sync with master 2022-10-22 13:48:46 +03:00
iliajie
e2438029ab Fir to preformat error message 2022-10-22 13:40:57 +03:00
Jamie Cameron
532e1150ce Asking for properties causes some units to be skipped 2022-10-21 22:22:05 -07:00
iliajie
5404142690 Fix to run systemctl show for each unit 2022-10-20 13:33:01 +03:00
Jamie Cameron
9350bd79cd Separate units in systemctl show by the spaces between them 2022-10-19 22:06:50 -07:00
Jamie Cameron
854d34bda2 Revert "Fix stop loosing systemd units https://github.com/webmin/webmin/issues/1745"
This reverts commit 5a53efb560.
2022-10-19 22:01:33 -07:00
iliajie
b9e6ceecfc Fix systemd lost properties 2022-10-19 15:19:11 +03:00
iliajie
460ba7d8cd Add support to display No (masked) state 2022-10-19 12:33:08 +03:00
iliajie
79f485d81d Fix to test if unit exists before masking ; add return codes 2022-10-18 19:05:45 +03:00
iliajie
783ba32a48 Fix detection of systemd unit (more than just .service) 2022-10-18 18:27:11 +03:00
iliajie
5a53efb560 Fix stop loosing systemd units https://github.com/webmin/webmin/issues/1745 2022-10-18 18:25:16 +03:00
iliajie
fa57718bf8 Fix for systemd types tests (more than just .service) 2022-10-18 18:14:03 +03:00
iliajie
b863134d61 Add new {mask|unmask}_actions for systemd systems 2022-10-18 13:54:02 +03:00
iliajie
2d2bac1804 Fix to consider timers 2022-10-14 13:28:04 +03:00
Jamie Cameron
391773274f Remove obsolete option to skip use of chkconfig 2022-10-01 18:11:01 -07:00
Jamie Cameron
52d34aea5d Remove un-used show_opts option 2022-10-01 17:59:06 -07:00
Jamie Cameron
8307d78c07 Links to init scripts are always symlinks 2022-10-01 17:44:24 -07:00
Jamie Cameron
0c22608c7a Remove support for ancient caldera-only daemons_dir feature 2022-10-01 17:35:46 -07:00
Jamie Cameron
4f8b96cfeb Remove start/stop messages option from configs, as it can be determined by the OS 2022-10-01 17:07:53 -07:00
iliajie
8f65e8f47a Fix default stop command for systemd units 2022-07-26 17:47:43 +03:00