postfix: add rate-limiting exceptions for our own nodes #39

Merged
Armael merged 2 commits from postfix-rate-limit-exceptions into main 2024-11-21 17:49:15 +00:00
Showing only changes of commit e0385b0456 - Show all commits

View file

@ -383,15 +383,24 @@ job "email" {
} }
template { template {
# Collect machine IPs from the cluster.
# We use intermediate maps to ensure we get a sorted list with no duplicates,
# so that it is robust wrt. changes in the order of the output of ls or
# addition of new machines in an existing site.
# (scratch.MapValues returns the list of *values* in the map, sorted by *key*)
data = <<EOH data = <<EOH
{{- range ls "diplonat/autodiscovery/ipv4" }} {{- range ls "diplonat/autodiscovery/ipv4" }}
{{- with $a := .Value | parseJSON }} {{ $a.address }} {{- with $a := .Value | parseJSON }}
{{- end }} {{- scratch.MapSet "ipv4" $a.address $a.address }}
{{- end }} {{- end }}
{{- end -}}
{{- range ls "diplonat/autodiscovery/ipv6" }} {{- range ls "diplonat/autodiscovery/ipv6" }}
{{- with $a := .Value | parseJSON }} [{{ $a.address }}] {{- with $a := .Value | parseJSON }}
{{- end }} {{- scratch.MapSet "ipv6" $a.address $a.address }}
{{- end }} {{- end }}
{{- end -}}
{{- range scratch.MapValues "ipv4" }}{{ . }} {{ end }}
{{- range scratch.MapValues "ipv6" }}[{{ . }}] {{ end }}
EOH EOH
destination = "secrets/postfix/rate-limit-exceptions" destination = "secrets/postfix/rate-limit-exceptions"
} }