Permalink
Browse files

Merge branch 'master' of github.com:baudehlo/Haraka

Conflicts:
	tests/rfc1869.js
  • Loading branch information...
2 parents 80b2976 + ff38515 commit 312268b049daf42e19e12c9be7083972bb89b1e6 @baudehlo committed Feb 7, 2014
Showing with 4,153 additions and 642 deletions.
  1. +3 −4 README.md
  2. +25 −3 TODO
  3. +9 −0 UPGRADE
  4. +10 −0 bin/haraka
  5. +18 −5 config.js
  6. +2 −0 config/auth_vpopmaild.ini
  7. +5 −0 config/bounce.ini
  8. +20 −0 config/connect.geoip.ini
  9. +8 −0 config/connect.p0f.ini
  10. +30 −0 config/data.headers.ini
  11. +7 −0 config/delay_deny.ini
  12. +70 −0 config/dkim/dkim_key_gen.sh
  13. +70 −3 config/extra-tlds
  14. +12 −0 config/graph.ini
  15. +98 −0 config/karma.ini
  16. +1 −0 config/mail_from.is_resolvable.ini
  17. +0 −1 config/mail_from.is_resolvable.timeout
  18. +1 −1 config/plugins
  19. +8 −0 config/rcpt_to.qmail_deliverable.ini
  20. +38 −0 config/spamassassin.ini
  21. +125 −2 config/three-level-tlds
  22. +144 −13 config/top-level-tlds
  23. +703 −2 config/two-level-tlds
  24. +44 −12 configfile.js
  25. +65 −4 connection.js
  26. +19 −2 docs/Config.md
  27. +8 −8 docs/Connection.md
  28. +23 −13 docs/CoreConfig.md
  29. +2 −2 docs/Header.md
  30. +46 −0 docs/Logging_API.md
  31. +1 −1 docs/Net_Utils.md
  32. +9 −5 docs/Outbound.md
  33. +16 −16 docs/Plugins.md
  34. +13 −13 docs/Transaction.md
  35. +1 −1 docs/plugins/aliases.md
  36. +1 −1 docs/plugins/auth/auth_ldap.md
  37. +1 −1 docs/plugins/auth/auth_proxy.md
  38. +18 −0 docs/plugins/auth/auth_vpopmaild.js
  39. +5 −5 docs/plugins/auth/flat_file.md
  40. +2 −2 docs/plugins/avg.md
  41. +1 −1 docs/plugins/block_me.md
  42. +23 −0 docs/plugins/bounces.md
  43. +5 −5 docs/plugins/clamd.md
  44. +69 −0 docs/plugins/connect.geoip.md
  45. +48 −0 docs/plugins/connect.p0f.md
  46. +11 −11 docs/plugins/connect.rdns_access.md
  47. +3 −3 docs/plugins/daemonize.md
  48. +24 −0 docs/plugins/data.headers.md
  49. +2 −0 docs/plugins/data.nomsgid.md
  50. +2 −0 docs/plugins/data.noreceived.md
  51. +3 −1 docs/plugins/data.rfc5322_header_checks.md
  52. +4 −4 docs/plugins/data.uribl.md
  53. +16 −0 docs/plugins/delay_deny.md
  54. +61 −38 docs/plugins/dkim_sign.md
  55. +4 −4 docs/plugins/dnsbl.md
  56. +5 −5 docs/plugins/dnswl.md
  57. +3 −3 docs/plugins/early_talker.md
  58. +14 −4 docs/plugins/graph.md
  59. +7 −7 docs/plugins/helo.checks.md
  60. +111 −0 docs/plugins/karma.md
  61. +1 −1 docs/plugins/log.syslog.md
  62. +13 −13 docs/plugins/lookup_rdns.strict.md
  63. +11 −11 docs/plugins/mail_from.access.md
  64. +4 −4 docs/plugins/mail_from.blocklist.md
  65. +3 −3 docs/plugins/mail_from.is_resolvable.md
  66. +1 −1 docs/plugins/mail_from.nobounces.md
  67. +3 −3 docs/plugins/max_unrecognized_commands.md
  68. +6 −6 docs/plugins/messagesniffer.md
  69. +1 −1 docs/plugins/process_title.md
  70. +1 −1 docs/plugins/queue/quarantine.md
  71. +5 −5 docs/plugins/queue/smtp_forward.md
  72. +5 −5 docs/plugins/queue/smtp_proxy.md
  73. +9 −9 docs/plugins/rate_limit.md
  74. +13 −13 docs/plugins/rcpt_to.access.md
  75. +4 −4 docs/plugins/rcpt_to.blocklist.md
  76. +3 −3 docs/plugins/rcpt_to.in_host_list.md
  77. +2 −2 docs/plugins/rcpt_to.max_count.md
  78. +14 −0 docs/plugins/rcpt_to.qmail_deliverable.md
  79. +4 −4 docs/plugins/rdns.regexp.md
  80. +3 −3 docs/plugins/relay_acl.md
  81. +1 −1 docs/plugins/relay_all.md
  82. +4 −4 docs/plugins/relay_force_routing.md
  83. +2 −2 docs/plugins/reseed_rng.md
  84. +56 −19 docs/plugins/spamassassin.md
  85. +8 −8 docs/plugins/spf.md
  86. +1 −1 docs/plugins/toobusy.md
  87. +2 −2 docs/tutorials/Migrating_from_v1_to_v2.md
  88. +2 −2 docs/tutorials/SettingUpOutbound.md
  89. +2 −0 messagestream.js
  90. +34 −16 outbound.js
  91. +1 −1 package.json
  92. +1 −1 plugins.js
  93. +3 −0 plugins/auth/auth_base.js
  94. +70 −0 plugins/auth/auth_vpopmaild.js
  95. +2 −0 plugins/auth/flat_file.js
  96. +75 −0 plugins/bounce.js
  97. +147 −0 plugins/connect.geoip.js
  98. +243 −0 plugins/connect.p0f.js
  99. +118 −0 plugins/data.headers.js
  100. +5 −1 plugins/data.nomsgid.js
  101. +5 −1 plugins/data.noreceived.js
  102. +6 −2 plugins/data.rfc5322_header_checks.js
  103. +152 −0 plugins/delay_deny.js
  104. +116 −44 plugins/dkim_sign.js
  105. +37 −50 plugins/graph.js
  106. +409 −0 plugins/karma.js
  107. +25 −28 plugins/lookup_rdns.strict.js
  108. +1 −1 plugins/mail_from.is_resolvable.js
  109. +7 −0 plugins/mail_from.nobounces.js
  110. +5 −18 plugins/queue/smtp_forward.js
  111. +10 −0 plugins/queue/smtp_proxy.js
  112. +3 −0 plugins/rcpt_to.max_count.js
  113. +107 −0 plugins/rcpt_to.qmail_deliverable.js
  114. +3 −0 plugins/rdns.regexp.js
  115. +4 −1 plugins/relay_acl.js
  116. +7 −12 plugins/relay_force_routing.js
  117. +225 −123 plugins/spamassassin.js
  118. +5 −0 plugins/spf.js
  119. +5 −3 rfc1869.js
  120. +25 −2 smtp_client.js
  121. +9 −1 tests/rfc1869.js
  122. +7 −0 utils.js
View
@@ -49,7 +49,7 @@ code in Haraka, or maybe someone has already written this plugin.
Plugins are already provided for running mail through SpamAssassin, checking
for known bad HELO patterns, checking DNS Blocklists, and watching for
-violators of the SMTP protocol via the "early_talker" plugin.
+violators of the SMTP protocol via the "early\_talker" plugin.
Furthermore Haraka comes with a simple plugin called "graph" which shows you
real-time charts of which plugins rejected the most mail, allowing you to
@@ -90,9 +90,8 @@ And it will run.
However the big thing you want to do next is to edit the `config/plugins`
file. This determines what plugins run in Haraka, and controls the overall
behaviour of the server. By default the server is setup to receive mails for
-domains in `host_list` and deliver them via `qmail-queue`. Queueing to
-qmail is likely not what you need unless you have qmail installed, so this is
-likely the first thing you want to change.
+domains in `host_list` and deliver them via `smtp-forward`. Configure the
+destination in `config/smtp_forward.ini`.
Each plugin has documentation available via `haraka -h plugins/<name>`.
Look there for information about how each plugin is configured, edit your
View
28 TODO
@@ -1,19 +1,41 @@
-- Rate Limiting for outbound mail (there's a branch for this but it's incomplete)
- Milter support
- Ability to modify the body of email (e.g add a banner)
- Create a config file for each of the core shipping configs, so people have something as a baseline
- IMAP server (long shot for now)
- Plugins to copy from Qpsmtpd:
- - bogus_bounce (checks bounces have one recipient and no return-path)
- dspam
- greylisting
- - karma?
- virus/*
Outbound improvements
+ - Rate Limiting (there's a branch for this but it's incomplete)
- Provide better command line tools for manipulating/inspecting the queue
- Add the ability to force a run on a specific queue file or destination domain
- Make retry times configurable (handle RFC requirements for 5 days and DSN queued warnings)
- Limit concurrency by domain
- Disable deliveries for a domain
- Pool connections by domain/MX
+
+Plugin behavior changes
+ - in SpamAssassin plugin, change default behavior of 'legacy' status header.
+ Presently, when undefined, legacy is used. Legacy support should be changed to
+ only when requested, with a sunset date.
+
+Remove the following deprecated plugins
+ - rdns.regexp
+ - data.nomsgid
+ - data.noreceived
+ - data.rfc5322_header_checks
+ - daemonize
+ - mail_from.nobounces
+
+Rename the following plugins
+ - toobusy -> connect.toobusy
+ - attachment -> data.attachment
+ - avg -> data.avg
+ - clamd -> data.clamd
+ - spamassassin -> data.spamassassin
+ - spf -> mail_from.spf
+
+Move the following plugins:
+ - test_queue -> queue/test_queue
View
@@ -0,0 +1,9 @@
+
+2013.12.27
+
+new plugin: data.headers
+
+ deprecates data.rfc5322_header_checks.js
+ deprecates data.noreceived.js
+ deprecates data.nomsgid.js
+
View
@@ -344,6 +344,16 @@ else if (parsed.qempty) {
}
else if (parsed.configs) {
var haraka_path = path.join(base, 'haraka.js');
+
+ var base_dir = process.argv[3];
+ var err_msg = "Did you install a Haraka config? (haraka -i " + base_dir +")";
+ if ( !fs.existsSync(base_dir) )
+ fail( "No such directory: " + base_dir + "\n" + err_msg );
+
+ var smtp_ini = path.join(base_dir,'config','smtp.ini');
+ if ( !fs.existsSync( smtp_ini ) )
+ fail( "No smtp.ini at: " + smtp_ini + "\n" + err_msg );
+
process.argv[1] = haraka_path;
process.env.HARAKA = parsed.configs;
require(haraka_path);
View
@@ -7,14 +7,27 @@ var config = exports;
var config_path = process.env.HARAKA ? path.join(process.env.HARAKA, 'config') : path.join(__dirname, './config');
-config.get = function(name, type, cb) {
- if (type === 'nolog') {
- type = arguments[2]; // deprecated - TODO: remove later
+/* Ways this can be called:
+config.get('thing');
+config.get('thing', type);
+config.get('thing', cb);
+config.get('thing', type, cb);
+config.get('thing', type, options);
+config.get('thing', type, cb, options);
+*/
+config.get = function(name, type, cb, options) {
+ if (typeof type == 'function') {
+ options = cb;
+ cb = type;
+ type = 'value';
+ }
+ if (typeof cb != 'function') {
+ options = cb;
+ cb = null;
}
-
type = type || 'value';
var full_path = path.resolve(config_path, name);
- var results = configloader.read_config(full_path, type, cb);
+ var results = configloader.read_config(full_path, type, cb, options);
// Pass arrays by value to prevent config being modified accidentally.
if (Array.isArray(results)) {
@@ -0,0 +1,2 @@
+host=127.0.0.6
+port=89
View
@@ -0,0 +1,5 @@
+; reject all bounce messages (generally not a good idea)
+reject_all=0
+
+; reject bounces that are not RFC compliant (likely faked)
+reject_invalid=1
View
@@ -0,0 +1,20 @@
+; public_ip: the public IP address of *this* mail server
+; if your mail server is not bound to a public IP, you'll have to provide
+; this for distance calculations to work.
+; public_ip=
+
+; show_city: show city data in logs and headers
+; note: city data is less accurate than country
+show_city=1
+
+; show_region: show regional data (US states, CA provinces, etc..)
+show_region=1
+
+; enable distance calculations. If you don't use the distance, leave it
+; disabled to save few CPU cycles.
+calc_distance=0
+
+; if calculating distance, an additional 'too_far' key in the geoip
+; connection note can be set to true if the distance exceeds the limit (in
+; kilometers). A suggested use for that data is the karma plugin.
+;too_far=4000
View
@@ -0,0 +1,8 @@
+
+; where the p0f socket is found
+; default: socket_path=/tmp/.p0f_socket
+socket_path=/tmp/.p0f_socket
+
+; add_header, add a message header with a p0f summary
+; default: X-Haraka-p0f
+add_header=X-Haraka-p0f
View
@@ -0,0 +1,30 @@
+; configuration for data.headers plugin
+
+; Requiring a date header will cause the loss of valid mail. The JavaMail
+; sender used by some banks, photo processing services, health insurance
+; companies, bounce senders, and others send messages without a Date header.
+;
+; If you can afford to reject some valid mail, please do enforce this, and
+; encourage mailers toward RFC adherence. Otherwise, do not require Date.
+
+; Headers that MUST be present (RFC 5322)
+; required=From,Date ; <-- RFC 5322 compliant
+required=From,Date
+
+; Received
+; If you have no outbound, add 'Received' to the required list for an
+; aggressive anti-spam measure. It works because all real mail relays will
+; add a `Received` header. It may false positive on some bulk mail that
+; uses a custom tool to send, but this appears to be fairly rare.
+
+; If the date header is present, and future and/or past days are
+; defined, it will be validated. 0 = disabled
+date_future_days=2
+date_past_days=15
+
+
+; Headers that MUST be unique if present (RFC 5322)
+; singular=Date,From,Sender,Reply-To,To,Cc,Bcc,Message-Id,In-Reply-To,References,Subject (RFC 5322)
+singular=Date,From,Sender,Reply-To,To,Cc,Bcc,Message-Id,In-Reply-To,References,Subject
+
+
View
@@ -0,0 +1,7 @@
+
+; excluded plugins: a list of denials that are to be excluded (ie, all the immediate rejection)
+; Examples: <plugin>
+; <plugin>:<hook>
+; <plugin>:<hook>:<function name>
+;
+;excluded_plugins=spf,lookup_rdns_strict
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+usage() {
+ echo " usage: $0 <example.com> [haraka username]"
+ echo " "
+ exit
+}
+
+if [ -z $1 ];
+then
+ usage
+fi
+
+DOMAIN=$1
+SMTPD=$2
+if [ -z $SMTPD ];
+then
+ SMTPD="www"
+fi
+
+# create a directory for each DKIM signing domain
+mkdir -p $DOMAIN
+cd $DOMAIN
+
+# The selector can be any value that is a valid DNS label
+# create in the common format: mmmYYYY (apr2014)
+date '+%h%Y' | tr "[:upper:]" "[:lower:]" > selector
+
+# generate private and public keys
+# key length considerations
+# The minimum recommended key length for short duration keys (ones that
+# will be replaced within a few months) is 1024. If you are unlikely to
+# rotate your keys frequently, choose 2048, at the expense of more CPU.
+openssl genrsa -out private 2048
+chmod 400 private
+openssl rsa -in private -out public -pubout
+
+# make it really easy to publish the public key in DNS
+# by creating a file named 'dns', with instructions
+cat > dns <<EO_DKIM_DNS
+
+Add this TXT record to the $DOMAIN DNS zone.
+
+`cat selector | tr -d "\n"`._domainkey TXT "v=DKIM1;p=`grep -v -e '^-' public | tr -d "\n"`"
+
+Tell the world that the ONLY mail servers that send mail from this domain are DKIM signed and/or bear our MX and A records.
+
+With SPF:
+
+ SPF "v=spf1 mx a -all"
+ TXT "v=spf1 mx a -all"
+
+With DMARC:
+
+_dmarc TXT "v=DMARC1; p=reject; adkim=s; aspf=r; rua=mailto:dmarc-feedback@$DOMAIN; ruf=mailto:dmarc-feedback@$DOMAIN; pct=100"
+
+With DomainKeys (deprecated)
+
+_domainkey TXT "o=-; t=y; r=postmaster@$DOMAIN"
+
+For more information about DKIM and SPF policy, the documentation within each plugin contains a longer discussion and links to more detailed information:
+
+ haraka -h dkim_sign
+ haraka -h spf
+
+
+EO_DKIM_DNS
+
+cd ..
+#chown -R $SMTPD:$SMTPD $DOMAIN
Oops, something went wrong.

0 comments on commit 312268b

Please sign in to comment.