This commit is contained in:
mwiegand 2021-06-26 11:02:49 +02:00
parent 6519def8d5
commit 609ef98ca2
14 changed files with 62 additions and 25 deletions

View file

@ -5,21 +5,19 @@ def column_width(column, table):
$TTL 600
@ IN SOA ns.sublimity.de. admin.sublimity.de. (
2020080302 ;Serial
1200 ;Refresh
600 ;Retry
600 ;Refresh
300 ;Retry
1209600 ;Expire
600 ;Negative response caching TTL
300 ;Negative response caching TTL
)
% for record in sorted(records, key=lambda r: (r['name'], r['type'], r['value'])):
% for part in (record['value'][i:i+255] for i in range(0, len(record['value']), 255)):
${record['name'].ljust(column_width('name', records))} \
${(record['name'] or '@').ljust(column_width('name', records))} \
IN \
${record['type'].ljust(column_width('type', records))} \
% if record['type'] == 'TXT':
"${part}"
% else:
${part}
% endif
% endfor
% if record['type'] == 'TXT':
(${' '.join('"'+record['value'][i:i+255]+'"' for i in range(0, len(record['value']), 255))})
% else:
${record['value']}
% endif
% endfor

View file

@ -0,0 +1,3 @@
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";

View file

@ -5,4 +5,4 @@ zone "${zone}" {
};
% endfor
// include "/etc/bind/zones.rfc1918";
include "/etc/bind/zones.rfc1918";

View file

@ -0,0 +1,7 @@
options {
directory "/var/cache/bind";
dnssec-validation auto;
listen-on-v6 { any; };
max-cache-size 20%;
querylog yes;
};

View file

@ -18,6 +18,26 @@ files['/etc/default/bind9'] = {
],
}
files['/etc/bind/named.conf'] = {
'owner': 'root',
'group': 'bind',
'needed_by': [
'svc_systemd:bind9',
],
'triggers': [
'svc_systemd:bind9:restart',
],
}
files['/etc/bind/named.conf.options'] = {
'owner': 'root',
'group': 'bind',
'needed_by': [
'svc_systemd:bind9',
],
'triggers': [
'svc_systemd:bind9:restart',
],
}
files['/etc/bind/named.conf.local'] = {
'content_type': 'mako',
'context': {

View file

@ -46,9 +46,8 @@ def collect_records(metadata):
),
key=len,
)
if matching_zones:
zone = matching_zones[0]
zone = matching_zones[-1]
else:
continue
@ -77,7 +76,7 @@ def ns_records(metadata):
'bind': {
'zones': {
zone: [
{'name': '', 'type': 'NS', 'value': f"{metadata.get('bind/domain')}."},
{'name': '@', 'type': 'NS', 'value': f"{metadata.get('bind/domain')}."},
] for zone in metadata.get('bind/zones').keys()
},
},

View file

@ -45,7 +45,7 @@ def dns(metadata):
for domain in metadata.get('mailserver/domains'):
dns[domain] = {
'MX': [f'5 {domain}'],
'MX': [f'5 {domain}.'],
'TXT': ['v=spf1 a mx -all'],
}

View file

@ -1,6 +1,5 @@
from base64 import b64decode
defaults = {
'users': {
'root': {
@ -18,7 +17,7 @@ def user(metadata):
for name, config in metadata.get('users').items():
users[name] = {
'authorized_keys': []
'authorized_keys': [],
}
if not 'full_name' in config:
@ -31,7 +30,7 @@ def user(metadata):
users[name]['shell'] = '/bin/bash'
if not 'privkey' in users[name] and not 'pubkey' in users[name]:
privkey, pubkey = repo.libs.ssh.generate_ad25519_key_pair(
privkey, pubkey = repo.libs.ssh.generate_ed25519_key_pair(
b64decode(str(repo.vault.random_bytes_as_base64_for(f"{name}@{metadata.get('id')}", length=32)))
)
users[name]['keytype'] = 'ed25519'

View file

@ -0,0 +1 @@
encrypt$gAAAAABg1uKdl_1A48p7K8tAxh-3QrP8XEplOoQ0VPf4ioO5MN7EF-cJr6QaYEE8zGyJ1luIcqIs8gOICYnMBM6_PsHLkTRq4cvdoEy3989F26fLrc8n2VaXe1eXhe6f87slT4ZR64NJL9UKhaZpkWKXTzDxJd621-wb8MUXJdTg_aJFDh0YK2Qh2waayiQeGa4IY6IOp68un0DIw_XrawxJgZZn9lae1oWdkg_hZeeuZS09kGBVYdwkJDC_mmebwJzYPxek96bn5vdxm2-YTVoeB8PyGA5q8gRJSKyuxtqBQAJJhXJtBdQX--mh0lA3PzCmhA_qwIEhqmJjiE6InnFkFADibofpJsT2MLuS-1PyeD54lhuMZlY9J6HU2fDWdlCVF9K-vy04mjBpWdUU_CUdURkRdOwVrdzt5P2CgilXSaM2nmK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BTfplupSqYVGNMboPwNLOwsOG7D7fCVx8915L7tVuYWLLi6HT5iC2ML393QYAm_YfypFCS7BzvTCw_sr0K03zgnk63y8XKJltPBRZuouB94WgkfSCMoB3R_66Dtnl8icLJDV0QpHwtFSLcjUYKPlyaN0a3SffHr1ExJtzsw9Bvqrp85S1ii1Uj-TVu4SU8rtTKme5GQ6-WS9jt2Dw_3Me7c6Ms5L3B-t9G2ZhI-O5Q2lzkXNdN2KN70wT-GjOXPuolwFkcDGDYM6QueB_nAQErsTtuMeiyQVO7j97dkNVMhUn-ZRUBUNs_nP7CPMw8uki903gPLmC3kJFKZ73u0wzv0SkWMSj4A_0b6o1J-2ixD97pIWPwnbOIEU_8u0fY3GMXsjK8t-usdzkTgD427zh23t3Uk=

View file

@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCbsx9bRuzwTsAiFeuYq00Xtxlqqu+aNLBDGFIVSAVETojhqmNlBBaZ0R3mxT/YVkGPYQC5IOF4lZRtCjcRs3QKSJCHxEs3dHba84wP1wg0y1X9WK8pkXiZo9BgbUbxkJz6EWg5FUM/LYWly2lTg4VY/YvoMEKUEicr2fAJuDYiUnK6WXcYIfgHe3Jfjw2IE/oNuk8p1XoazCPcLLw7xT6TleVE/t3pZT0AYFOepm1HQ9xTDS475E4Rn11OkGC7Wd+Roqguer/zAT0353iKIQNj1H3pxHiKY84TFs36p7m3CbeEFDDfdi3bbBFy3Rm9774/mVXyLVE5ZGoKfU8rS0TT

View file

@ -3,7 +3,7 @@ from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from cryptography.hazmat.primitives import serialization
def generate_ad25519_key_pair(secret):
def generate_ed25519_key_pair(secret):
privkey_bytes = Ed25519PrivateKey.from_private_bytes(secret)
nondeterministic_privatekey = privkey_bytes.private_bytes(

View file

@ -15,6 +15,7 @@
'zfs',
],
'metadata': {
'id': 'ea29bdf0-0b47-4bf4-8346-67d60c9dc4ae',
'bind': {
'domain': 'ns.sublimity.de',
'zones': {
@ -28,9 +29,17 @@
'wingl.de': [],
'woodpipe.de': [],
'ckn.li': [],
'islamicstate.eu': [],
},
},
'dns': {
'islamicstate.eu': {
'A': ['1.2.3.4'],
},
'test.islamicstate.eu': {
'AAAA': ['::1337'],
},
},
'id': 'ea29bdf0-0b47-4bf4-8346-67d60c9dc4ae',
'network': {
'interface': 'eth0',
'ipv4': '162.55.188.157/32',
@ -58,7 +67,8 @@
'hostname': 'mail2.sublimity.de',
'admin_email': 'postmaster@sublimity.de',
'domains': [
'mail2.sublimity.de',
'mail3.sublimity.de',
'islamicstate.eu',
# 'sublimity.de',
# 'freibrief.net',
# 'nadenau.net',
@ -78,9 +88,6 @@
'version': '1.4.11',
'installer': True,
},
'users': {
'test': {},
},
'vm': {
'cpu': 2,
},