summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-12-14 17:24:22 +0100
committerGitHub <noreply@github.com>2023-12-14 17:24:22 +0100
commit9f72aff65e0589b9387227f69a25545eba5ba4f5 (patch)
treee0534e40c7d58ce940860513bdf885e147dcaf10 /src
parent0917ed315aa3e8707ad8b67293b38e7452f9cda8 (diff)
parentfe99c45e05fd5794905145ddca80e6078145c2e8 (diff)
downloadvyos-1x-9f72aff65e0589b9387227f69a25545eba5ba4f5.tar.gz
vyos-1x-9f72aff65e0589b9387227f69a25545eba5ba4f5.zip
Merge pull request #2590 from sever-sever/T5798
T5798: load-balancing revese-proxy add multiple SSL certificates
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/load-balancing-haproxy.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/conf_mode/load-balancing-haproxy.py b/src/conf_mode/load-balancing-haproxy.py
index ec4311bb5..333ebc66c 100755
--- a/src/conf_mode/load-balancing-haproxy.py
+++ b/src/conf_mode/load-balancing-haproxy.py
@@ -108,17 +108,19 @@ def generate(lb):
if 'ssl' in front_config:
if 'certificate' in front_config['ssl']:
- cert_name = front_config['ssl']['certificate']
- pki_cert = lb['pki']['certificate'][cert_name]
- cert_file_path = os.path.join(load_balancing_dir, f'{cert_name}.pem')
- cert_key_path = os.path.join(load_balancing_dir, f'{cert_name}.pem.key')
+ cert_names = front_config['ssl']['certificate']
- with open(cert_file_path, 'w') as f:
- f.write(wrap_certificate(pki_cert['certificate']))
+ for cert_name in cert_names:
+ pki_cert = lb['pki']['certificate'][cert_name]
+ cert_file_path = os.path.join(load_balancing_dir, f'{cert_name}.pem')
+ cert_key_path = os.path.join(load_balancing_dir, f'{cert_name}.pem.key')
- if 'private' in pki_cert and 'key' in pki_cert['private']:
- with open(cert_key_path, 'w') as f:
- f.write(wrap_private_key(pki_cert['private']['key']))
+ with open(cert_file_path, 'w') as f:
+ f.write(wrap_certificate(pki_cert['certificate']))
+
+ if 'private' in pki_cert and 'key' in pki_cert['private']:
+ with open(cert_key_path, 'w') as f:
+ f.write(wrap_private_key(pki_cert['private']['key']))
if 'ca_certificate' in front_config['ssl']:
ca_name = front_config['ssl']['ca_certificate']