monkeysphere: Fix regression with reading new apache domain config

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-02-07 13:55:52 -08:00 committed by James Valleroy
parent 49640fdfce
commit f9a57e4293
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -105,8 +105,11 @@ def get_https_keys(fingerprint_hash):
aug.set('/augeas/load/Httpd/lens', 'Httpd.lns')
aug.set('/augeas/load/Httpd/incl[last() + 1]',
'/etc/apache2/sites-available/*')
aug.set('/augeas/load/Httpd/incl[last() + 1]',
'/etc/apache2/conf-available/*')
aug.load()
# Read from default-tls.conf and default-ssl.conf
keys = {}
path = '/files/etc/apache2/sites-available//VirtualHost'
for match in aug.match(path):
@ -123,6 +126,23 @@ def get_https_keys(fingerprint_hash):
host['key_file'], fingerprint_hash)
keys[host['ssh_fingerprint']] = host
# Read from FreedomBox configured domains with proper SSL certs.
path = "/files/etc/apache2/sites-available//" \
"directive[. = 'Use'][arg[1] = 'FreedomBoxTLSSiteMacro']"
key_file = "/files/etc/apache2//Macro[arg[1] = 'FreedomBoxTLSSiteMacro']//"\
"VirtualHost/directive[. = 'GnuTLSKeyFile']/arg"
key_file = aug.get(key_file)
for match in aug.match(path):
domain = aug.get(match + '/arg[2]')
host = {
'available_domains': [domain],
'service': 'https',
'key_file': key_file.replace('$domain', domain)
}
host['ssh_fingerprint'] = get_pem_ssh_fingerprint(
host['key_file'], fingerprint_hash)
keys[host['ssh_fingerprint']] = host
return keys