summaryrefslogtreecommitdiff
path: root/src/conf_mode/load-balancing_haproxy.py
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-05-04 22:08:13 +0200
committerChristian Breunig <christian@breunig.cc>2025-05-05 17:22:57 +0200
commit59d86826a2ffb2df6a0ce603c879e541a4fe88ba (patch)
tree75ce7c42e76aaf4e4ec0551311f6a554977d9c51 /src/conf_mode/load-balancing_haproxy.py
parentc05edd62cf1120fb14b66ca0377061a59a9d00db (diff)
downloadvyos-1x-59d86826a2ffb2df6a0ce603c879e541a4fe88ba.tar.gz
vyos-1x-59d86826a2ffb2df6a0ce603c879e541a4fe88ba.zip
haproxy: T7122: add ACME/certbot bootstrap support
When both the CLI PKI node for an ACME-issued certificate and HAProxy are configured during initial setup, the certbot challenge cannot be served via the reverse proxy because HAProxy has not yet been configured at all. This commit introduces a special case to handle this bootstrap scenario, ensuring that the certbot challenge can still be served correctly in standalone mode on port 80 despite initial config dependencies/priorities between PKI and HAProxy.
Diffstat (limited to 'src/conf_mode/load-balancing_haproxy.py')
-rw-r--r--src/conf_mode/load-balancing_haproxy.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/conf_mode/load-balancing_haproxy.py b/src/conf_mode/load-balancing_haproxy.py
index 0e959480c..504a90596 100644
--- a/src/conf_mode/load-balancing_haproxy.py
+++ b/src/conf_mode/load-balancing_haproxy.py
@@ -19,6 +19,7 @@ import os
from sys import exit
from shutil import rmtree
+from vyos.defaults import systemd_services
from vyos.config import Config
from vyos.configverify import verify_pki_certificate
from vyos.configverify import verify_pki_ca_certificate
@@ -39,7 +40,6 @@ airbag.enable()
load_balancing_dir = '/run/haproxy'
load_balancing_conf_file = f'{load_balancing_dir}/haproxy.cfg'
-systemd_service = 'haproxy.service'
systemd_override = '/run/systemd/system/haproxy.service.d/10-override.conf'
def get_config(config=None):
@@ -191,11 +191,11 @@ def generate(lb):
return None
def apply(lb):
+ action = 'stop'
+ if lb:
+ action = 'reload-or-restart'
call('systemctl daemon-reload')
- if not lb:
- call(f'systemctl stop {systemd_service}')
- else:
- call(f'systemctl reload-or-restart {systemd_service}')
+ call(f'systemctl {action} {systemd_services["haproxy"]}')
return None