This commit is contained in:
mwiegand 2021-06-17 02:13:25 +02:00
parent 3a390e314e
commit f60108dee1
8 changed files with 29 additions and 18 deletions

View file

@ -4,13 +4,3 @@ from bundlewrap.repo import Repository
from os.path import realpath, dirname
repo = Repository(dirname(dirname(realpath(__file__))))
domains = set()
for node in repo.nodes:
domains.update(
set(node.metadata.get('opendkim/domains', []))
)
print(domains)
# Do in Metaproc

View file

@ -1,3 +1,5 @@
from ipaddress import ip_interface
database_password = repo.vault.password_for(f'{node.name} db mailserver')
defaults = {
@ -10,6 +12,7 @@ defaults = {
'password': database_password,
},
'test_password': repo.vault.password_for(f'{node.name} test_pw mailserver'),
'domains': [],
},
'postgresql': {
'roles': {
@ -33,6 +36,24 @@ defaults = {
},
}
@metadata_reactor.provides(
'dns',
)
def dns(metadata):
dns = {}
for domain in metadata.get('mailserver/domains'):
dns[domain] = {
'MX': [
str(ip_interface(metadata.get('network/ipv4')).ip)
],
}
return {
'dns': dns,
}
@metadata_reactor.provides(
'letsencrypt/domains',
)

View file

@ -1,5 +1,4 @@
from ipaddress import ip_interface
from bundlewrap.metadata import atomic
defaults = {
'apt': {

View file

@ -32,20 +32,20 @@ files = {
'/etc/opendkim/key_table': {
'content_type': 'mako',
'context': {
'domains': node.metadata.get('opendkim/domains'),
'domains': node.metadata.get('mailserver/domains'),
},
**file_attributes,
},
'/etc/opendkim/signing_table': {
'content_type': 'mako',
'context': {
'domains': node.metadata.get('opendkim/domains'),
'domains': node.metadata.get('mailserver/domains'),
},
**file_attributes,
},
}
for domain in node.metadata.get('opendkim/domains'):
for domain in node.metadata.get('mailserver/domains'):
directories[f'/etc/opendkim/keys/{domain}'] = {
**file_attributes,
'purge': True,

View file

@ -13,7 +13,6 @@ defaults = {
},
},
'opendkim': {
'domains': [],
'keys': {},
},
'dns': {
@ -32,7 +31,7 @@ defaults = {
def keys(metadata):
keys = {}
for domain in metadata.get('opendkim/domains'):
for domain in metadata.get('mailserver/domains'):
if domain in metadata.get(f'opendkim/keys'):
continue

1
groups/all.py Normal file
View file

@ -0,0 +1 @@
{}

View file

@ -1,4 +1,7 @@
{
'supergroups': [
'all',
],
'bundles': [
'network',
'systemd',

View file

@ -37,8 +37,6 @@
'mailserver': {
'hostname': 'mail2.sublimity.de',
'admin_email': 'postmaster@sublimity.de',
},
'opendkim': {
'domains': [
'mail2.sublimity.de',
# 'sublimity.de',