fix: admpass.sh hang, OLS httpd_config structure, listener maps
Some checks failed
CI / test WordOps (ubuntu-22.04) (push) Has been cancelled
CI / test WordOps (ubuntu-24.04) (push) Has been cancelled

Three fixes:

1. Replace admpass.sh calls with direct htpasswd writes — the script
   is interactive-only (no --password flag) and hangs forever in
   automation. Write admin htpasswd directly with openssl passwd.

2. Fix httpd_config.conf template — OLS requires virtualHost {} blocks
   with vhRoot/configFile, not bare include of vhconf.conf files.
   Add proper _backend virtualHost block, map it to Backend listener,
   use self-signed cert for Secure listener until real certs exist.

3. Fix addOLSListenerMap to only add maps to Default and Secure
   listeners (not Backend which is reserved for the admin panel).

4. Fix default PHP detection to read from wo.conf config instead
   of picking first installed version (which would prefer php74).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 13:08:03 +01:00
parent eaa5a95168
commit 22227c2849
4 changed files with 73 additions and 31 deletions

View File

@@ -80,22 +80,25 @@ def addOLSVhost(self, domain, webroot):
def addOLSListenerMap(self, domain):
"""Add map entries for domain to listener blocks in httpd_config.conf"""
"""Add map entries for domain to Default+Secure listeners in httpd_config.conf"""
httpd_conf = '{0}/httpd_config.conf'.format(WOVar.wo_ols_conf_dir)
map_line = ' map {0} {0}\n'.format(domain)
map_line = ' map {0} {0}\n'.format(domain)
with open(httpd_conf, 'r') as f:
lines = f.readlines()
new_lines = []
in_listener = False
listener_name = ''
for line in lines:
if line.strip().startswith('listener '):
in_listener = True
listener_name = line.strip().split()[1]
if in_listener and line.strip() == '}':
# Check if map for this domain already exists
if not any(domain in l and 'map' in l for l in new_lines):
new_lines.append(map_line)
# Only add maps to Default and Secure listeners (not Backend)
if listener_name in ('Default', 'Secure'):
if not any(domain in l and 'map' in l for l in new_lines):
new_lines.append(map_line)
in_listener = False
new_lines.append(line)