summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-05-03 17:13:11 -0700
committerElizabeth Hunt <me@liz.coffee>2025-05-03 17:13:11 -0700
commit5c49715e1cb370d340e61e6aca3f89a8904dc010 (patch)
treed7afcff471bbbe625e59cc72b762ac09a2221504
parent01160ea57f87e1ca8799c55123e491ec7bac6c0c (diff)
downloadinfra-5c49715e1cb370d340e61e6aca3f89a8904dc010.tar.gz
infra-5c49715e1cb370d340e61e6aca3f89a8904dc010.zip
prevent bind throttling
-rwxr-xr-xplaybooks/roles/mail/templates/volumes/data/dms/config/user-patches.sh12
1 files changed, 10 insertions, 2 deletions
diff --git a/playbooks/roles/mail/templates/volumes/data/dms/config/user-patches.sh b/playbooks/roles/mail/templates/volumes/data/dms/config/user-patches.sh
index f03bc81..34ecd51 100755
--- a/playbooks/roles/mail/templates/volumes/data/dms/config/user-patches.sh
+++ b/playbooks/roles/mail/templates/volumes/data/dms/config/user-patches.sh
@@ -26,13 +26,21 @@ sed -i 's/result_attribute = mail/result_attribute = emailprimary/' /etc/postfix
sed -i 's/result_attribute = mail/result_attribute = emailprimary/' /etc/postfix/ldap-domains.cf
sed -i 's/result_attribute = mail/result_attribute = emailprimary/' /etc/postfix/ldap-users.cf
+# recursively search for members in groups
+postconf -e 'recursion_limit = 15'
grep -q '^leaf_result_attribute = mail$' /etc/postfix/ldap-groups.cf || echo "leaf_result_attribute = mail" >> /etc/postfix/ldap-groups.cf
grep -q '^special_result_attribute = member$' /etc/postfix/ldap-groups.cf || echo "special_result_attribute = member" >> /etc/postfix/ldap-groups.cf
-echo 'auth_username_format = %Ln' >> /etc/dovecot/conf.d/10-auth.conf
+echo "ssl = required
-echo 'username_format = %Ln' >> /etc/dovecot/dovecot-oauth2.conf.ext
+auth_username_format = %Ln
+
+# use oauth2 before ldap to prevent bind throttling
+auth_mechanisms = xoauth2 oauthbearer plain login
+!include auth-oauth2.conf.ext
+!include auth-ldap.conf.ext" > /etc/dovecot/conf.d/10-auth.conf
+echo 'username_format = %Ln' >> /etc/dovecot/dovecot-oauth2.conf.ext
echo "passdb {
driver = ldap
args = /etc/dovecot/dovecot-ldap.conf.ext