86 Commits

Author SHA1 Message Date
Ilia Ross
a13461f9c1 Fix to respect global file ACLs for server-local imports
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
ⓘ Centralize global file ACL checks for server-local reads and applies them to batch, LDAP batch, MySQL, and PostgreSQL local import and restore flows. Files are read under the configured `fileunix` identity and staged with the correct command-user ownership, preventing constrained Webmin users from bypassing `root`, `otherdirs`, or `fileunix`.

9ceffce70f (r191495975)
2026-07-07 12:39:35 +02:00
Ilia Ross
2e0028cb65 Fix to harden local batch file ACL checks
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
Close inactive / close-inactive (push) Has been cancelled
ⓘ Fail closed when checking local batch file imports for Webmin-only users that do not have a Unix home directory.

This prevents an unset global file root ACL, or a home-relative root such as `~/path`, from being treated as filesystem-root access. Explicitly configured allowed directories still work as before.
2026-07-07 00:47:22 +02:00
Ilia Ross
9ceffce70f Fix local batch file imports to enforce file access ACLs
ⓘ This tightens local server-side batch file execution in the Users and Groups module.

Both user and group batch endpoints now read local batch files through a shared helper that enforces the module `batchdir` ACL, the user’s global file chooser ACL (`root` / `otherdirs`), and the configured `fileunix` read identity. Existing ACLs remain compatible by treating a missing `batchdir` as `/`, while an explicitly blank value denies local server batch files.

Regression coverage was added for allowed paths, denied paths, `otherdirs`, missing/blank `batchdir`, symlink escape rejection, and successful local batch reads.

----

Reproduction / verification steps:

1. Create a constrained Webmin user with access to the `Users and Groups` module.

2. Set the user's Global ACL:

   - Root directory for file browser: `/home/user1`
   - Other directories to allow: empty
   - Browse as Unix user: `nobody`

3. Set the user's `Users and Groups` module ACL:

   - Can view batch file form?: `Yes`
   - Batch files must be under directory: `/`

4. Create test files on the Webmin host:

   ```sh
   sudo mkdir -p /home/user1

   echo ROOT_SECRET_MARKER | sudo tee /root/batch-secret.txt >/dev/null
   sudo chown root:root /root/batch-secret.txt
   sudo chmod 600 /root/batch-secret.txt

   echo ALLOWED_BATCH_MARKER | sudo tee /home/user1/allowed.batch >/dev/null
   sudo chmod 644 /home/user1/allowed.batch

   sudo ln -sf /root/batch-secret.txt /home/user1/link-secret.batch

   echo ROOT_ONLY_ALLOWED_MARKER | sudo tee /home/user1/root-only.batch >/dev/null
   sudo chown root:root /home/user1/root-only.batch
   sudo chmod 600 /home/user1/root-only.batch
   ```

5. Log in to Webmin as the constrained user and request:

   ```text
   /useradmin/batch_exec.cgi?source=1&local=/root/batch-secret.txt
   /useradmin/gbatch_exec.cgi?source=1&local=/root/batch-secret.txt
   ```

   Expected fixed result:

   ```text
   Local file location is not allowed
   ```

6. Request an allowed readable file:

   ```text
   /useradmin/batch_exec.cgi?source=1&local=/home/user1/allowed.batch
   /useradmin/gbatch_exec.cgi?source=1&local=/home/user1/allowed.batch
   ```

   Expected fixed result:

   ```text
   Invalid action at line 1 : ALLOWED_BATCH_MARKER
   ```

7. Request a symlink inside the allowed directory that points outside it:

   ```text
   /useradmin/batch_exec.cgi?source=1&local=/home/user1/link-secret.batch
   /useradmin/gbatch_exec.cgi?source=1&local=/home/user1/link-secret.batch
   ```

   Expected fixed result:

   ```text
   Local file location is not allowed
   ```

8. Request a root-only file inside the allowed directory:

   ```text
   /useradmin/batch_exec.cgi?source=1&local=/home/user1/root-only.batch
   /useradmin/gbatch_exec.cgi?source=1&local=/home/user1/root-only.batch
   ```

   Expected fixed result:

   ```text
   Local file not found
   ```

The fixed behavior confirms that local batch file imports now enforce the configured global file ACL, reject symlink escapes, and read files using the configured Unix identity instead of the privileged Webmin process.
2026-07-07 00:29:14 +02:00
Ilia Ross
27dcd2db4a Fix to validate SSH public keys without root privileges 2026-06-23 12:41:58 +02:00
Ilia Ross
762e400156 Add editable SSH public keys for existing Unix users
This PR adds SSH public key management to the Users and Groups edit flow for existing Unix users.

Webmin stores its managed key with a readable marker in `authorized_keys`, validates submitted public keys, preserves unrelated keys, supports rename/update/remove flows, and performs user `.ssh` file operations as the target Unix user.

https://github.com/webmin/webmin/issues/1827
2026-06-22 01:34:40 +02:00
Jamie Cameron
019cc10b79 Use formal function parameters 2026-03-05 20:41:45 -08:00
Ilia Ross
07a11f7de6 Fix to use quotemeta to prevent shell injection in Useradmin module
Some checks failed
webmin.dev: webmin/webmin / build (push) Has been cancelled
2026-02-11 13:03:27 +02:00
Jamie Cameron
c5b0e4c7ff Work on password reset for sudo-capable users 2025-05-03 22:05:46 -07:00
Ilia Ross
1d57955672 Fix to call last command for the given user if no lastlog available 2024-10-22 19:19:47 +03:00
Ilia Ross
21e110cc8a Fix to bring back support for limit in last command
https://forum.virtualmin.com/t/is-this-process-normal-or-should-i-worry/128835/10?u=ilia
2024-10-20 15:59:41 +03:00
Jamie Cameron
728ae07eed Merge branch 'master' of github.com:webmin/webmin 2023-05-15 11:16:38 -07:00
Jamie Cameron
cfd66281eb Add some more sensible username checks 2023-05-15 11:16:30 -07:00
iliajie
8ae1c01b5e Fix to run hotkeys initializer script 2023-05-13 13:20:34 +03:00
iliajie
2081cf7002 Fix offsets and use a better structure for holding data 2023-05-13 12:45:04 +03:00
iliajie
696199033c Fix to drop an option to enable paginating and let it just work 2023-05-12 11:27:02 +03:00
iliajie
b9b2546060 Fix to drop no longer need code to inject client height 2023-05-12 10:49:48 +03:00
iliajie
2be0169902 Add support for paginated tables in Users and Groups module 2023-05-10 16:49:15 +03:00
iliajie
36f2e5d077 Fix to properly handle macOS mode #1877 2023-04-04 18:31:55 +03:00
Jamie Cameron
277f67dac9 Fix line length 2023-01-07 22:07:27 -08:00
luz paz
3e6142f098 Fix user and non-user facing typos 2022-06-29 07:17:11 -04:00
Ilia
fd223e7933 Revert "Fix not to show as config option yescrypt when not supported"
This reverts commit f431aaafde.
2022-05-30 23:45:39 +03:00
Ilia
f431aaafde Fix not to show as config option yescrypt when not supported 2022-05-30 01:35:39 +03:00
Ilia
3aa792f73d Allow foreign callers to force system detection of hashing format 2022-05-29 13:44:38 +03:00
Ilia
dae7f8a397 Fix error message 2022-05-28 23:01:11 +03:00
Ilia
547fc9caf6 Add support for yescrypt password hashing scheme
https://sourceforge.net/p/webadmin/discussion/55377/thread/01e65be3f9/
2022-05-28 19:26:32 +03:00
Jamie Cameron
ed59ce2984 Code cleanups 2020-11-01 22:11:11 -08:00
Jamie Cameron
d4aada9248 Cache status of a password file, rather than re-reading it over and over 2015-09-27 10:43:46 -07:00
Ján Dráb
76e9b421dd Fix numerical operators 2014-04-17 11:48:13 +02:00
Nawawi Jamili
21348b23b3 ui_link conversion -> useradmin 2013-12-19 20:41:19 +08:00
Jamie Cameron
bdaaf0aefe Handle case where validation command produces no output http://virtualmin.com/node/29763 2013-09-19 21:46:35 -07:00
Jamie Cameron
e4d0fc8709 Include quota variables in envs to set http://virtualmin.com/node/29023 2013-08-01 18:52:07 +10:00
Jamie Cameron
ebadc8100a Move dictionary func into a common library 2013-02-09 18:03:36 -08:00
Jamie Cameron
e21c851c13 use words file to validate passwords https://www.virtualmin.com/node/25300 2013-02-08 18:06:17 -08:00
Jamie Cameron
075b7fb822 Option to restore default SElinux context for a home dir 2012-12-31 23:01:14 -08:00
Jamie Cameron
1b362d18b2 Add option for human-readable regexp description 2012-06-28 15:45:38 -07:00
Jamie Cameron
6cb2783d66 Fix finding list of skel files when subdirectory contains a link 2012-04-26 11:19:54 -07:00
Jamie Cameron
270398f914 Don't copy links from skeleton directory 2012-04-25 10:47:30 -07:00
Jamie Cameron
74ea1f9da8 Add new password restriction for min days before a change is allowed 2012-03-29 22:37:37 -07:00
Javier Bassi
9c4fd45f92 Escaping primary group name 2011-10-19 01:20:08 -02:00
Jamie Cameron
64942cac82 Fix setting of USERADMIN_OLD_* variables
https://www.virtualmin.com/node/19190
2011-08-15 14:26:30 -07:00
Jamie Cameron
5697264b97 Use lastlog command to get last logins 2011-07-22 10:31:24 -07:00
Jamie Cameron
e96015a92c Make all user and group links be by name instead of by index. 2011-05-30 18:09:29 -07:00
Jamie Cameron
46e3d3ad19 Fix possible XSS attack due to user's real name not being escaped 2011-04-23 18:03:29 -07:00
Jamie Cameron
48ff24ce5e Move API to check password hash to md5-lib.pl 2011-04-08 16:13:03 -07:00
Jamie Cameron
2a5cd96b60 Added support for SHA512 format passwords, created common function to validate a password 2011-02-11 16:20:02 -08:00
Jamie Cameron
57480a2a96 Fix stupid use of length(@) when I meant scalar(@) 2010-12-17 12:16:14 -08:00
Jamie Cameron
8926759d15 Remove use of deprecated defined(@foo)
https://sourceforge.net/tracker/?func=detail&atid=117457&aid=3138980&group_id=17457
2010-12-17 11:37:04 -08:00
Jamie Cameron
10ffa287f6 re-factor random password generation function, use in LDAP module
https://github.com/webmin/webmin/issues#issue/9
2010-11-16 11:07:38 -08:00
Jamie Cameron
d2e25cc8a8 Show LDAP group descriptions in list 2010-05-20 10:48:35 -07:00
Jamie Cameron
09c25b8eb5 Set USERADMIN_GROUP variable too, where possible 2010-01-18 15:21:11 -08:00