--- exim.conf-SpamBlockerTechnology-v4.2.1.txt	2014-06-04 02:42:06.000000000 -0600
+++ exim.conf-SpamBlockerTechnology-v4.2.3.txt	2014-09-04 01:58:53.000000000 -0600
@@ -1,8 +1,8 @@
-# SpamBlockerTechnology* powered exim.conf, Version 4.2.1
-# April 28, 2014  17:54 (-0700)
+# SpamBlockerTechnology* powered exim.conf, Version 4.2.3-alpha1
+# September 1, 2014  17:54 (-0700)
 # Exim configuration file for DirectAdmin
 # Requires exim.pl as distributed by DirectAdmin here:
-# http://files.directadmin.com/services/exim.pl Dated 28-Mar-2008 or later
+# http://files.directadmin.com/services/exim.pl version 19 or higher
 # New version 4.2.1 removes obsolete dnsbl.njabl.org blocklist
 # and two ahbl blocklists; see: # http://forum.directadmin.com/showthread.php?t=48774
 # Edit#42 : entire section now commented out as there is no other
@@ -67,6 +67,9 @@
 # av_scanner = clamd:/var/run/clamav/clamd
 #.include_if_exists /etc/exim.clamav.load.conf
 
+#Block Cracking variables
+.include_if_exists /etc/exim.blockcracking/variables.conf
+
 #EDIT#3:
 # qualify_domain =
 
@@ -82,6 +85,7 @@
 #EDIT#7:
 daemon_smtp_ports = 25 : 587 : 465
 tls_on_connect_ports = 465
+disable_ipv6=false
 
 #EDIT#8:
 local_from_check = false
@@ -92,7 +96,7 @@
 smtp_accept_max = 100
 message_body_visible = 3000
 print_topbitchars = true
-smtp_accept_max_nonmail = 19
+smtp_accept_max_nonmail = 10
 smtp_accept_max_per_host = 10
 recipients_max = 150
 smtp_accept_queue_per_connection = 10
@@ -122,6 +126,8 @@
 syslog_duplication = false
 
 #EDIT#13:
+acl_not_smtp = acl_script
+acl_smtp_auth = acl_check_auth
 acl_smtp_connect = acl_connect
 acl_smtp_helo = acl_check_helo
 acl_smtp_rcpt = acl_check_recipient
@@ -141,6 +147,7 @@
 hostlist bad_sender_hosts_ip = /etc/virtual/bad_sender_hosts_ip
 hostlist whitelist_hosts = lsearch;/etc/virtual/whitelist_hosts
 hostlist whitelist_hosts_ip = /etc/virtual/whitelist_hosts_ip
+BLACKLIST_USERNAMES = /etc/virtual/blacklist_usernames
 
 #EDIT#15:
 #domainlist skip_av_domains = lsearch;/etc/virtual/skip_av_domains
@@ -186,6 +193,15 @@
 acl_connect:
   accept hosts = *
 
+#EDIT#24.5#
+acl_check_auth:
+  drop  set acl_m_authcount = ${eval10:0$acl_m_authcount+1}
+        condition = ${if >{$acl_m_authcount}{2}}
+        delay = 10s
+        message = Only one authentication attempt is allowed per connection
+
+  accept
+
 #EDIT#25:
 acl_check_helo:
   # accept mail originating on this server unconditionally
@@ -198,19 +214,72 @@
                           } {true}{false} }
   # deny if the HELO is an IP address
     deny message = HELO is an IP address (See RFC2821 4.1.3)
+         condition   = ${if eq{$interface_port}{25}}
          condition   = ${if isip{$sender_helo_name}}
+  # deny if hostname if ylmf-pc, which accounts for a HUGE percentage of BF attacks
+    deny message = Bad HELO - Blocked due to abuse
+         condition   = ${if eq{$sender_helo_name}{ylmf-pc}}
   # deny if the HELO pretends to be one of the domains hosted on the server
     deny message = Bad HELO - Host impersonating domain name [$sender_helo_name]
         condition = ${if match_domain{$sender_helo_name}{+local_domains}{true}{false}}
         hosts = ! +relay_hosts
   accept
 
+acl_script:
+  discard set acl_m_uid = ${perl{find_uid}}
+          set acl_m_username = ${perl{get_username}{$acl_m_uid}}
+          condition = ${if !eq {$acl_m_uid}{-1}{yes}{no}}
+          condition = ${if >{${perl{hit_limit_user}{$acl_m_username}}}{1}}
+          message = User account ($acl_m_username) has sent too many emails. Script delivery blocked.
+
+  discard condition = ${if !eq{$originator_uid}{$exim_uid}}
+          condition = ${if exists{BLACKLIST_USERNAMES}}
+          condition = ${lookup{$acl_m_username}lsearch{BLACKLIST_USERNAMES}{1}{0}}
+          message = User account ($acl_m_username) is not allowed to send emails.  Script delivery blocked via BLACKLIST_USERNAMES.
+
+  .include_if_exists /etc/exim.blockcracking/script.conf
+
+  accept
+
+  .include_if_exists /etc/exim.blockcracking/script.recipients.conf
+
 #EDIT#26:
 acl_check_recipient:
   # block certain well-known exploits, Deny for local domains if
   # local parts begin with a dot or contain @ % ! / |
   deny  domains       = +local_domains
         local_parts   = ^[.] : ^.*[@%!/|]
+
+  # If you've hit the limit, you can't send anymore. Requires exim.pl 17+
+  drop  message = User account ${authenticated_id} has sent too many emails
+        condition = ${perl{auth_hit_limit_acl}}
+        authenticated = *
+
+  drop  message = Legitimate bounces are never sent to more than one recipient.
+        senders = : postmaster@*
+        condition = ${if >{$recipients_count}{0}{true}{false}}
+
+  drop  message = REJECTED - Too many failed recipients - count = $rcpt_fail_count
+        log_message = REJECTED - Too many failed recipients - count = $rcpt_fail_count
+        condition = ${if > {${eval:$rcpt_fail_count}}{3}{yes}{no}}
+        !verify = recipient/callout=2m,defer_ok,use_sender
+
+  drop  message = The domain ${domain} is currently suspended. Try later.
+        domains = +local_domains
+        condition = ${if exists{/etc/virtual/${domain}_off}{yes}{no}}
+
+  drop  authenticated = *
+        condition = ${if exists{BLACKLIST_USERNAMES}}
+        set acl_m_uid = ${perl{find_uid_auth_id}{$authenticated_id}}
+        set acl_m_username = ${perl{get_username}{$acl_m_uid}}
+        condition = ${if !eq {$acl_m_uid}{-1}{yes}{no}}
+        condition = ${lookup{$acl_m_username}lsearch{BLACKLIST_USERNAMES}{1}{0}}
+        message = User account ($acl_m_username) is not allowed to send emails.  E-Mail delivery blocked.
+        logwrite = User account $acl_m_username is blocked via BLACKLIST_USERNAMES
+
+  #Block Cracking - https://github.com/Exim/exim/wiki/BlockCracking
+  .include_if_exists /etc/exim.blockcracking/auth.conf
+
   # restrict port 587 to authenticated users only
   # see also daemon_smtp_ports above
   accept  hosts = +auth_relay_hosts
@@ -274,20 +343,20 @@
           logwrite = $sender_host_address whitelisted in local sender whitelist
 
 #EDIT#32:
-    deny message = Email blocked by local blacklist
+    deny message = 554 denied. 5.7.1 Email Blocked due to SPAM
     domains = +use_rbl_domains
     domains = !+skip_rbl_domains
     senders = +blacklist_senders
 
 #EDIT#33:
-    deny message = Email blocked by local blacklist
+    deny message = 554 denied. 5.7.1 Host Blocked due to SPAM
        # only for domains that do want to be tested against RBLs
        domains = +use_rbl_domains
        domains = !+skip_rbl_domains
        hosts = +bad_sender_hosts
 
 #EDIT#34:
-    deny message = Email blocked by local blacklist
+    deny message = 554 denied. 5.7.1 IP Blocked due to SPAM
        hosts = +bad_sender_hosts_ip
 
 #EDIT#35:
@@ -308,15 +377,15 @@
   require verify = sender
 
 #EDIT#39:
-    deny message = Email blockedby local blacklist
+    deny message = 554 denied. 5.7.1 Domain Blocked due to SPAM
        domains = +use_rbl_domains
        domains = !+skip_rbl_domains
        sender_domains = +blacklist_domains
 
 #EDIT#40:
-    deny message = Forged Paypal Mail, not sent from PayPal.
-         senders = *@paypal.com
-         condition = ${if match {$sender_host_name}{\Npaypal.com$\N}{no}{yes}}
+#    deny message = 554 denied. 5.7.1 Forged Paypal Mail, not sent from PayPal.
+#         senders = *@paypal.com
+#         condition = ${if match {$sender_host_name}{\Npaypal.com$\N}{no}{yes}}
 
 #EDIT#41:
   deny message = Email blocked by $dnslist_domain
@@ -345,13 +414,15 @@
   accept  domains = +relay_domains
           endpass
           verify = recipient
-
 #EDIT#45:
   accept  hosts = +relay_hosts
+          add_header = X-Relay-Host: $sender_host_address
+
   accept  hosts = +auth_relay_hosts
           endpass
           message = authentication required
           authenticated = *
+
 # FINAL DENY EMAIL BEFORE DATA BEGINS HERE
   # default at end of acl causes a "deny", but line below will give
   # an explicit error message:
@@ -398,14 +469,14 @@
     driver = plaintext
     public_name = PLAIN
     server_prompts = :
-    server_condition = "${perl{smtpauth}}"
+    server_condition = "${perl{smtpauth}{0}}"
     server_set_id = $2
 
 login:
     driver = plaintext
     public_name = LOGIN
     server_prompts = "Username:: : Password::"
-    server_condition = "${perl{smtpauth}}"
+    server_condition = "${perl{smtpauth}{0}}"
     server_set_id = $1
 
 #EDIT#47:
@@ -436,21 +507,11 @@
 #COMMENT#49:
 #DIRECTORS CONFIGURATION
 
+.include_if_exists /etc/exim.spamassassin.conf
+
 #EDIT#50:
-#.include_if_exists /etc/exim.spamassassin.conf
-# spamcheck_director:
-#   driver = accept
-#   condition = "${if and { \
-#    {!def:authenticated_id} \
-#    {!def:h_X-Spam-Flag:} \
-#    {!eq {$received_protocol}{spam-scanned}} \
-#    {!eq {$received_protocol}{local}} \
-#    {exists{/home/${lookup{$domain}lsearch{/etc/virtual/domainowners}{$value}}/.spamassassin/user_prefs}} \
-#    {<{$message_size}{100k}} \
-#    } {1}{0}}"
-#  retry_use_local_part
-#  transport = spamcheck
-#  no_verify
+# Spam Assassin
+#spamcheck_director removed. Use the exim.spamassassin.conf
 
 majordomo_aliases:
   driver = redirect
@@ -696,6 +757,7 @@
 #COMMENT#61:
 remote_smtp:
   driver = smtp
+.include_if_exists /etc/exim.dkim.conf
 
 #EDIT#62:
 address_pipe:
