mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[muc subdomain] add to domain's certificate the alt subdomain muc
This commit is contained in:
parent
3bbc93d54b
commit
4432d28c09
2 changed files with 19 additions and 14 deletions
|
@ -6,7 +6,7 @@ map $http_upgrade $connection_upgrade {
|
|||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name {{ domain }} xmpp-upload.{{ domain }};
|
||||
server_name {{ domain }} xmpp-upload.{{ domain }} muc.{{ domain }};
|
||||
|
||||
access_by_lua_file /usr/share/ssowat/access.lua;
|
||||
|
||||
|
|
|
@ -659,34 +659,39 @@ def _prepare_certificate_signing_request(domain, key_file, output_folder):
|
|||
csr.get_subject().CN = domain
|
||||
|
||||
from yunohost.domain import domain_list
|
||||
|
||||
# For "parent" domains, include xmpp-upload subdomain in subject alternate names
|
||||
# For "parent" domains, include xmpp-upload and muc subdomains in subject
|
||||
# alternate names
|
||||
if domain in domain_list(exclude_subdomains=True)["domains"]:
|
||||
subdomain = "xmpp-upload." + domain
|
||||
xmpp_records = (
|
||||
Diagnoser.get_cached_report(
|
||||
"dnsrecords", item={"domain": domain, "category": "xmpp"}
|
||||
).get("data")
|
||||
or {}
|
||||
)
|
||||
if xmpp_records.get("CNAME:xmpp-upload") == "OK":
|
||||
sanlist = []
|
||||
for sub in ('xmpp-upload', 'muc'):
|
||||
subdomain = sub + "." + domain
|
||||
if xmpp_records.get("CNAME:" + sub) == "OK":
|
||||
sanlist.append(("DNS:" + subdomain))
|
||||
else:
|
||||
logger.warning(
|
||||
m18n.n(
|
||||
"certmanager_warning_subdomain_dns_record",
|
||||
subdomain=subdomain,
|
||||
domain=domain,
|
||||
)
|
||||
)
|
||||
|
||||
if sanlist:
|
||||
csr.add_extensions(
|
||||
[
|
||||
crypto.X509Extension(
|
||||
"subjectAltName".encode("utf8"),
|
||||
False,
|
||||
("DNS:" + subdomain).encode("utf8"),
|
||||
(", ".join(sanlist)).encode("utf-8"),
|
||||
)
|
||||
]
|
||||
)
|
||||
else:
|
||||
logger.warning(
|
||||
m18n.n(
|
||||
"certmanager_warning_subdomain_dns_record",
|
||||
subdomain=subdomain,
|
||||
domain=domain,
|
||||
)
|
||||
)
|
||||
|
||||
# Set the key
|
||||
with open(key_file, "rt") as f:
|
||||
|
|
Loading…
Add table
Reference in a new issue