Browse Source

Implement exim4 rate limits.

Raphael Schneeberger 7 years ago
parent
commit
3dde921b0a

+ 18 - 0
install/debian/8/exim/exim4.conf.template

@@ -56,8 +56,20 @@ DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}
 #                       ACL CONFIGURATION                            #
 #         Specifies access control lists for incoming SMTP mail      #
 ######################################################################
+
+acl_not_smtp = acl_not_smtp
+
 begin acl
 
+acl_not_smtp:
+  deny message = Web site is sending too much emails [limitlog]: deny / account / $authenticated_id / $sender_rate / $sender_rate_period
+  ratelimit = 40 / 1h / $authenticated_id
+
+  warn ratelimit = 0 / 1h / strict / $authenticated_id
+  log_message = Sender rate [limitlog]: log / account / $authenticated_id / $sender_rate / $sender_rate_period
+
+  accept
+
 acl_check_spammers:
   accept  hosts         = +whitelist
 
@@ -89,6 +101,12 @@ acl_check_mail:
 acl_check_rcpt:
   accept  hosts         = :
 
+  deny message = Email account is sending too much emails [limitlog]: deny / email / $authenticated_id / $sender_rate / $sender_rate_period
+  ratelimit = 40 / 1h / $authenticated_id
+
+  warn ratelimit = 0 / 1h / strict / $authenticated_id
+  log_message = Sender rate [limitlog]: log / email / $authenticated_id / $sender_rate / $sender_rate_period
+
   deny    message       = Restricted characters in address
           domains       = +local_domains
           local_parts   = ^[.] : ^.*[@%!/|]

+ 13 - 1
install/ubuntu/14.04/exim/exim4.conf.template

@@ -6,7 +6,7 @@
 
 #SPAMASSASSIN = yes
 #SPAM_SCORE = 50
-#CLAMD =  yes
+#CLAMD = yes
 
 add_environment = <; PATH=/bin:/usr/bin
 keep_environment =
@@ -56,8 +56,20 @@ DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}
 #                       ACL CONFIGURATION                            #
 #         Specifies access control lists for incoming SMTP mail      #
 ######################################################################
+
+acl_not_smtp = acl_not_smtp
+
 begin acl
 
+acl_not_smtp:
+  deny message = Web site is sending too much emails [limitlog]: deny / account / $authenticated_id / $sender_rate / $sender_rate_period
+  ratelimit = 40 / 1h / $authenticated_id
+
+  warn ratelimit = 0 / 1h / strict / $authenticated_id
+  log_message = Sender rate [limitlog]: log / account / $authenticated_id / $sender_rate / $sender_rate_period
+
+  accept
+
 acl_check_spammers:
   accept  hosts         = +whitelist
 

+ 13 - 1
install/ubuntu/16.04/exim/exim4.conf.template

@@ -6,7 +6,7 @@
 
 #SPAMASSASSIN = yes
 #SPAM_SCORE = 50
-#CLAMD =  yes
+#CLAMD = yes
 
 add_environment = <; PATH=/bin:/usr/bin
 keep_environment =
@@ -56,8 +56,20 @@ DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}
 #                       ACL CONFIGURATION                            #
 #         Specifies access control lists for incoming SMTP mail      #
 ######################################################################
+
+acl_not_smtp = acl_not_smtp
+
 begin acl
 
+acl_not_smtp:
+  deny message = Web site is sending too much emails [limitlog]: deny / account / $authenticated_id / $sender_rate / $sender_rate_period
+  ratelimit = 40 / 1h / $authenticated_id
+
+  warn ratelimit = 0 / 1h / strict / $authenticated_id
+  log_message = Sender rate [limitlog]: log / account / $authenticated_id / $sender_rate / $sender_rate_period
+
+  accept
+
 acl_check_spammers:
   accept  hosts         = +whitelist
 

+ 12 - 0
install/ubuntu/18.04/exim/exim4.conf.template

@@ -56,8 +56,20 @@ DKIM_PRIVATE_KEY = ${if exists{DKIM_FILE}{DKIM_FILE}{0}}
 #                       ACL CONFIGURATION                            #
 #         Specifies access control lists for incoming SMTP mail      #
 ######################################################################
+
+acl_not_smtp = acl_not_smtp
+
 begin acl
 
+acl_not_smtp:
+  deny message = Web site is sending too much emails [limitlog]: deny / account / $authenticated_id / $sender_rate / $sender_rate_period
+  ratelimit = 40 / 1h / $authenticated_id
+
+  warn ratelimit = 0 / 1h / strict / $authenticated_id
+  log_message = Sender rate [limitlog]: log / account / $authenticated_id / $sender_rate / $sender_rate_period
+
+  accept
+
 acl_check_spammers:
   accept  hosts         = +whitelist