Commit Graph

119 Commits

Author SHA1 Message Date
Jamie Cameron
1b029fb2c3 Merge pull request #2847 from webmin/dev/preserve-apache-comments
Add Apache comment preservation
2026-09-19 17:33:05 -07:00
Jamie Cameron
08d9ef3cd0 Add checks for allowed .htaccess file path
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
2026-09-18 16:57:34 -07:00
Jamie Cameron
fa98ace56d Merge branch 'master' of github.com:webmin/webmin 2026-09-18 15:43:47 -07:00
Jamie Cameron
991840e890 Use my instead of local 2026-09-18 15:43:40 -07:00
Ilia Ross
efe1dddca8 Fix to change Apache comments to use directive fields
https://github.com/webmin/webmin/pull/2847#issuecomment-5705632150
2026-09-17 01:46:50 +02:00
Ilia Ross
dcd929e7e3 Add Apache comment preservation
This PR fixes full-line comments being removed when Webmin rewrites Apache configuration blocks.
2026-09-17 00:07:52 +02:00
Ilia Ross
faaef530f2 Drop Apache comment preservation from this PR 2026-09-17 00:01:01 +02:00
Ilia Ross
3d27aca04a Fix nested Apache directive rewrites
This PR fixes incorrect line numbers when Apache directives contain nested blocks.

It preserves comments during rewrites and correctly tracks every nested line.

This prevents Virtualmin from corrupting custom Apache configurations.

Fixes: https://github.com/virtualmin/virtualmin-gpl/issues/1153
2026-09-16 23:00:38 +02:00
Jamie Cameron
e3d6fa3c0a When editing a .htaccess file, don't update the file tracking when the master apache config was changed
Some checks failed
Close inactive / close-inactive (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
Tests / prove (push) Has been cancelled
https://github.com/virtualmin/virtualmin-gpl/issues/1276
2026-09-01 21:20:47 -07:00
Ilia Ross
52d0382619 Fix regression and hide disabled default vhost files 2026-05-19 23:28:24 +02:00
Ilia Ross
d93fd6a4b6 Fix to harden vhost file handling
* Note: Resolve enabled-site link paths through ServerRoot and include disabled vhost file deletions in Apache config-test rollback coverage, with focused regressions.

https://github.com/webmin/webmin/actions/runs/26125036339/job/76836427985
2026-05-19 23:16:09 +02:00
Ilia Ross
a5be2f9d39 Add Debian-style sites-available file management to Apache
* Note: Bring the Apache module to parity with the Nginx module's Debian
sites-available/sites-enabled handling: list disabled vhost files
alongside active ones, toggle their state via symlink with apachectl
configtest rollback, and delete VirtualHost blocks from inactive files.
When Virtualmin manages a vhost, defer enable/disable to Virtualmin's
own forms instead of touching the symlink directly.

https://forum.virtualmin.com/t/enable-disable-toggle-buttons-in-ngnix-module/137238/4?u=ilia
2026-05-19 23:00:18 +02:00
Jamie Cameron
3713ee01b8 The server_root function doesn't need the global config as a parameter 2026-02-10 10:21:22 -08:00
Ilia Ross
a6bd5c6ebc Fix to use quotemeta to prevent shell injection in Apache module 2026-02-10 15:57:07 +02:00
Ilia Ross
0955695a15 Fix to place apply last; looks better and makes a bit more sense 2025-11-09 00:35:25 +02:00
Jamie Cameron
ce6bbe44ff Factor out code to create the site file, and add a function to force a re-gen 2025-06-15 08:24:17 -07:00
Jamie Cameron
c5e8c77526 Keep the words array in sync with value 2025-05-27 19:33:52 -07:00
Jamie Cameron
825ce6154c Don't reference config array entries that don't exist 2025-05-26 17:05:51 -07:00
Jamie Cameron
ea7b52d65b dummy directive doesn't use up any lines 2025-05-25 19:53:11 -07:00
Jamie Cameron
f5ff544439 Use format params 2025-05-10 21:58:17 -07:00
Jamie Cameron
24d17dc0c8 Keep the split value in sync with the full value 2025-05-10 16:36:03 -07:00
Jamie Cameron
fcdebf6891 Some systems use the event MPM instead of prefork https://github.com/webmin/webmin/issues/2365 2025-01-21 20:05:15 -08:00
Jamie Cameron
2c93a3c694 Detect all the installed Apache modules 2023-05-23 11:15:13 -07:00
Jamie Cameron
a80024fe70 Handle case where <IfModeule prefork.c> is used 2022-03-31 22:35:40 -07:00
Ilia Rostovtsev
4f9cba0b33 Fix to drop beloved line separators for Apache config formatter 2022-02-01 22:44:00 +03:00
Ilia Rostovtsev
4ba0629549 Fix to separate Protocols too 2021-11-19 20:48:03 +03:00
Jamie Cameron
71aa88adfc Don't re-format config if somehow the config option isn't set 2021-11-13 11:09:21 -08:00
Ilia Rostovtsev
99478d9741 Remove empty space 2021-11-05 01:57:26 +03:00
Ilia Rostovtsev
6ccfd2c7bc If file was deleted prevent recreating an empty file 2021-11-04 19:34:19 +03:00
Ilia Rostovtsev
9a66592601 Format directive if not the first in VirtualHost 2021-11-04 19:29:20 +03:00
Ilia Rostovtsev
79ab64939f Add format config to do magic with separating directives 2021-11-04 17:32:13 +03:00
Ilia Rostovtsev
2b43b2baa4 Format configs cross changes made in UI; fix allowed test 2021-11-04 14:43:27 +03:00
Ilia Rostovtsev
471767d1b8 Fix format_config test 2021-11-04 13:22:13 +03:00
Ilia Rostovtsev
c9147a8ca1 Clean no-lng used var 2021-11-04 12:58:06 +03:00
Ilia Rostovtsev
ebeea77dd9 Update comments 2021-11-04 12:57:14 +03:00
Ilia Rostovtsev
50875dffab Add API to format all modified conf files 2021-11-04 12:55:57 +03:00
Ilia Rostovtsev
9cb874c605 Add support for Apache config indent formatting 2021-11-03 21:21:19 +03:00
Jamie Cameron
fb12201be6 Store the full version in the site file 2021-09-22 23:35:54 -07:00
Jamie Cameron
4ccebeff91 Store the full apache version, with all the dots 2021-09-21 17:46:37 -07:00
Jamie Cameron
f4f163b046 Set indent reasonably when saving a directive 2020-09-25 22:22:47 -07:00
Jamie Cameron
f99cbe4bd3 Preserve and extend indents 2020-09-20 12:53:45 -07:00
Ilia Rostovtsev
fa8bc4d9ed When starting Apache, update last restart time e23db63f33 2d95efa30e 2020-08-27 18:06:43 +03:00
Jamie Cameron
2d95efa30e Bold apply link when there are changes to be saved 2020-08-23 17:43:27 -07:00
Jamie Cameron
e23db63f33 Record last config change and restart times 2020-08-23 17:23:56 -07:00
Jamie Cameron
78b70f7e1f Handle case where no standard filters are defined 2020-07-10 19:13:21 -07:00
Jamie Cameron
c71cfc96f9 Handle case where there are no filters 2020-07-10 18:53:39 -07:00
Ilia Rostovtsev
971467c91b Prefix is already set on redirect 2020-04-05 15:58:47 +03:00
Jamie Cameron
a2dc3f7124 Switch all calls to open() to explicitly open for read 2020-03-14 17:20:54 -07:00
Jamie Cameron
4810b7a02b Protect against invalid values 2019-10-04 22:35:39 -07:00
Ilia Rostovtsev
94234a5d43 Fix missing webprefix 2019-04-25 11:06:53 +03:00