aboutsummaryrefslogtreecommitdiff
path: root/cluster/prod/app/email/deploy
diff options
context:
space:
mode:
authorArmael <armael@noreply.localhost>2024-11-21 17:49:15 +0000
committerArmael <armael@noreply.localhost>2024-11-21 17:49:15 +0000
commit90f861e1e12ebaa232225ff22f7782af1cff563c (patch)
treee27ea8432dd89559f7a3bd16e62e2760f62bb292 /cluster/prod/app/email/deploy
parent3f51534e0335e1335312adebf8a285abcf9faf1b (diff)
parente0385b0456cbd5f64e5464d0b6a36171ba770ba6 (diff)
downloadnixcfg-90f861e1e12ebaa232225ff22f7782af1cff563c.tar.gz
nixcfg-90f861e1e12ebaa232225ff22f7782af1cff563c.zip
Merge pull request 'postfix: add rate-limiting exceptions for our own nodes' (#39) from postfix-rate-limit-exceptions into mainHEADmain
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/nixcfg/pulls/39
Diffstat (limited to 'cluster/prod/app/email/deploy')
-rw-r--r--cluster/prod/app/email/deploy/email.hcl23
1 files changed, 23 insertions, 0 deletions
diff --git a/cluster/prod/app/email/deploy/email.hcl b/cluster/prod/app/email/deploy/email.hcl
index 10e4d50..287cff3 100644
--- a/cluster/prod/app/email/deploy/email.hcl
+++ b/cluster/prod/app/email/deploy/email.hcl
@@ -382,6 +382,29 @@ job "email" {
destination = "secrets/postfix/transport"
}
+ 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
+ {{- range ls "diplonat/autodiscovery/ipv4" }}
+ {{- with $a := .Value | parseJSON }}
+ {{- scratch.MapSet "ipv4" $a.address $a.address }}
+ {{- end }}
+ {{- end -}}
+ {{- range ls "diplonat/autodiscovery/ipv6" }}
+ {{- with $a := .Value | parseJSON }}
+ {{- scratch.MapSet "ipv6" $a.address $a.address }}
+ {{- end }}
+ {{- end -}}
+ {{- range scratch.MapValues "ipv4" }}{{ . }} {{ end }}
+ {{- range scratch.MapValues "ipv6" }}[{{ . }}] {{ end }}
+ EOH
+ destination = "secrets/postfix/rate-limit-exceptions"
+ }
+
# --- secrets ---
template {
data = "{{ with $d := key \"tricot/certs/smtp.deuxfleurs.fr\" | parseJSON }}{{ $d.cert_pem }}{{ end }}"