Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tarpit: removed connection tests, add docs for tarpit.ini

setting hooks_to_delay
  • Loading branch information...
commit 39c7cf5c3ae7cf6e32084b1b7b884cf4be2d5507 1 parent ae433df
@msimerson msimerson authored
Showing with 21 additions and 10 deletions.
  1. +16 −1 docs/plugins/tarpit.md
  2. +5 −9 plugins/tarpit.js
View
17 docs/plugins/tarpit.md
@@ -23,9 +23,24 @@ or
Configuration
--------------
+
+The configuration file for tarpit is config/tarpit.ini.
+
+* hooks\_to\_delay - a list of hooks to delay at. This setting can be used to
+ override the default list in the plugin. For example, if you notice that
+ malware is disconnecting after delaying rcpt\_ok, you can remove just that
+ hook from the list:
+
+hooks\_to\_delay=connect,helo,ehlo,mail,rcpt,data,data\_post,queue,unrecognized\_command,vrfy,noop,rset,quit
+
+
+Plugin Timeout
+--------------
+
config/tarpit.timeout (Default: 0)
-How long Haraka lets the plugin do nothing before it times out. When zero,
+All Haraka plugins can configure a *name*.timeout file. The timeout specifies
+how long Haraka lets the plugin do nothing before it times out. When zero,
there is no timeout. When non-zero and *seconds to delay* is longer than
tarpit.timeout (default: 1s), you'll get errors like this in your log files:
View
14 plugins/tarpit.js
@@ -20,21 +20,17 @@ exports.register = function () {
exports.tarpit = function (next, connection) {
var plugin = this;
- if (!connection) return next();
- var conn_delay, trans_delay;
- if (connection.transaction) {
- trans_delay = connection.transaction.notes.tarpit;
- }
- if (connection) {
- conn_delay = connection.notes.tarpit;
+ var delay = connection.notes.tarpit;
+
+ if (!delay && connection.transaction) {
+ delay = connection.transaction.notes.tarpit;
}
- var delay = trans_delay || conn_delay;
if (!delay) return next();
connection.loginfo(plugin, 'tarpitting response for ' + delay + 's');
setTimeout(function () {
- if (connection) return next();
+ return next();
}, delay * 1000);
};
Please sign in to comment.
Something went wrong with that request. Please try again.