This commit is contained in:
mwiegand 2021-10-16 15:31:33 +02:00
parent 213aeacbdc
commit 973ce6673b
3 changed files with 21 additions and 5 deletions

View file

@ -1,3 +0,0 @@
% for ip in sorted(node.metadata.get('rspamd/ignore_spam_check_for_ips', set())):
${ip}
% endfor

View file

@ -26,7 +26,9 @@ directories = {
files = {
'/etc/rspamd/local.d/ip_whitelist.map': {
'content_type': 'mako',
'content': '\n'.join(
sorted(node.metadata.get('rspamd/ip_whitelist'))
) + '\n',
'triggers': {
'svc_systemd:rspamd:restart',
},

View file

@ -1,3 +1,5 @@
from ipaddress import ip_interface
defaults = {
'apt': {
'packages': {
@ -20,6 +22,21 @@ defaults = {
},
'rspamd': {
'web_password': repo.vault.password_for(node.name + ' rspamd web password'),
'ignore_spam_check_for_ips': [],
'ip_whitelist': [],
},
}
@metadata_reactor.provides(
'rspamd/ip_whitelist',
)
def ignored_ips(metadata):
return {
'rspamd': {
'ip_whitelist': {
str(ip_interface(network['ipv4']).ip)
for other_node in repo.nodes
for network in other_node.metadata.get('network').values()
}
},
}