1
0
Fork 0
This commit is contained in:
Joao M 2022-08-17 22:04:10 +00:00
parent ad8aef16a2
commit fee0126442
6 changed files with 9 additions and 10 deletions

View file

@ -197,7 +197,6 @@ easymapping:
host2.com.br:
containers:
- other:3000
ssl: false
redirect:
www.host1.com.br: http://host1.com.br

View file

@ -165,7 +165,7 @@ class HaproxyConfigGenerator:
easymapping["443"]["hosts"][hostname] = dict(easymapping[port]["hosts"][hostname])
easymapping["443"]["hosts"][hostname]["letsencrypt"] = False
easymapping["443"]["hosts"][hostname]["redirect_ssl"] = False
easymapping["443"]["ssl_cert"] = self.ssl_cert_letsecncrypt
easymapping["443"]["ssl"] = True
self.letsencrypt_hosts.append(hostname) if hostname not in self.letsencrypt_hosts else self.letsencrypt_hosts
@ -175,12 +175,12 @@ class HaproxyConfigGenerator:
filename = "{}/{}.pem".format(
self.ssl_cert_haproxy, d[host_label]
)
easymapping[port]["ssl_cert"] = filename
easymapping[port]["ssl"] = True
with open(filename, 'wb') as file:
file.write(
base64.b64decode(d[ssl_label])
)
if self.label.get_bool(self.label.create([definition, "ssl"])):
easymapping[port]["ssl_cert"] = self.ssl_cert_haproxy
easymapping[port]["ssl"] = True
return easymapping.values()

View file

@ -12,7 +12,7 @@ easymapping:
www.host1.local: https://host1.local
- port: 443
ssl_cert: /certs/haproxy/host1.local.pem
ssl: true
hosts:
host1.local:
containers:

View file

@ -1,4 +1,4 @@
{% if "ssl_cert" in o %}
{% if "ssl" in o %}
bind *:{{ o["port"] }} ssl crt /certs/letsencrypt/ alpn http/1.1 crt /certs/haproxy/ alpn http/1.1
{% elif "h2" in o and o["h2"] %}
bind *:{{ o["port"] }} proto h2

View file

@ -19,7 +19,7 @@ easymapping:
www.host1.com.br: http://host1.com.br
- port: 443
ssl_cert: /certs/haproxy/mycert.pem
ssl: True
hosts:
host1.com.br:
containers:

View file

@ -168,7 +168,7 @@ def test_parser_finds_services_raw():
"byjg.ca":"https://www.somehost.com.br",
"www.byjg.ca":"https://www.somehost.com.br"
},
"ssl_cert":CERT_FILE
"ssl": True
},
{
"mode":"http",
@ -247,7 +247,7 @@ def test_parser_static_raw():
},
{
"port": 443,
"ssl_cert": "/certs/haproxy/mycert.pem",
"ssl": True,
"hosts": {
"host1.com.br": {
"containers": [