Commit Graph

66 Commits

Author SHA1 Message Date
John Peacock
3aa64debd8 remove way too agressive blocking of DENY'd servers
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@628 958fd67b-6ff1-0310-b445-bb7760255be9
2006-03-06 21:33:46 +00:00
John Peacock
bd19ded5a2 Need to cover situation where there are *no* hooks. Should we actually return
OK from run_hooks() in the case where no hooks are there to fire?

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@627 958fd67b-6ff1-0310-b445-bb7760255be9
2006-03-01 17:25:51 +00:00
John Peacock
82a32ed558 Automatically disconnect DENY'd server if it doesn't go willingly.
Implement queue_pre and queue_post hooks.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@626 958fd67b-6ff1-0310-b445-bb7760255be9
2006-03-01 16:46:55 +00:00
John Peacock
5959cc1c32 * lib/Qpsmtpd/Auth.pm
lib/Qpsmtpd/SMTP.pm
    Take the AUTH method and put it in SMTP.pm where it belongs.

* lib/Qpsmtpd.pm
  lib/Qpsmtpd/Plugin.pm
    Expose the auth_user/auth_mechanism property to plugin writers.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@556 958fd67b-6ff1-0310-b445-bb7760255be9
2005-10-31 17:12:37 +00:00
John Peacock
58f7129ada [merge from trunk] Use qmail/control/smtpdgreeting if it exists, otherwise
show the original qpsmtpd greeting (with version information).

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@518 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-19 14:20:05 +00:00
Matt Sergeant
8c018d75ac Pass args to unrecognized_command
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@494 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-11 12:24:26 +00:00
Matt Sergeant
8a3c3c40b0 tls support
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@489 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-08 16:50:24 +00:00
Ask Bjørn Hansen
254b4fd2b2 return 500 rather than 521 for DENY in the unrecognized_command hook
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@478 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 22:22:29 +00:00
Matt Sergeant
c3562e256d Allow DENY to be returned from unrecognised_command again
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@476 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 22:16:08 +00:00
Ask Bjørn Hansen
4f0c4d94a1 The unrecognized_command hook now understands the DENY_DISCONNECT return
and the DENY return is deprecated.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@473 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 21:52:45 +00:00
Matt Sergeant
d48cd2e37e No idea what that was doing in there...
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@472 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 20:36:02 +00:00
Matt Sergeant
71f6fc1dff Fix plugin docs to reflect reality
Re-order plugin docs to appear in the order things generally get called
Fix SMTP.pm to reflect what's documented in README.plugins :-)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@471 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 20:30:14 +00:00
Ask Bjørn Hansen
df5a2e9d95 bump version to 0.31-dev
From: 	  hjp@hjp.at
	Subject: 	PATCH: Return 421 if we are going to disconnect
	Date: 	July 3, 2005 1:23:21 PM PDT
	To: 	  qpsmtpd@perl.org

RFC 2821 says we should return 421, if we disconnect, not 450 or 451.

	hp



git-svn-id: https://svn.perl.org/qpsmtpd/trunk@459 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-04 14:39:29 +00:00
John Peacock
e331f6b248 Add plugable logging support include sample plugin which replicates the
existing core code.  Add OK hook.

*  lib/Qpsmtpd.pm
   (init_logger): replaced with log_level()
   (load_logging): NEW - load logging plugins without calling log()
   (log_level): NEW - set/get global $LogLevel scalar
   (log): now just a wrapper for varlog(); called only by core code
   (varlog): initializes logging if not already done, calls logging plugins
     in turn and falls back to interal logging unless plugins OK or DECLINED
   (_load_plugins): only display "Loading plugin" when actually loading one
   (run_hooks): load logging plugins without calling log(); add OK hook as
     else of the DENY* case
   (spool_dir): use global $Spool_dir scalar to cache location

*  lib/Qpsmtpd/Plugin.pm
   (%hooks): add "logging" and "ok"
   (register_hook): add local _hook to object cache
   (log): call varlog() with additional parameters hook and plugin_name
     except for logging hook
   (compile): add accessor sub for local _hook scalar

*  lib/Qpsmtpd/SMTP.pm
   (mail, rcpt): change loglevel to LOGALERT instead of LOGWARN for from/to

*  qpsmtpd-forkserver
   (REAPER): use package ::log() instead of warn()
   (main): defer calling log until $plugin_loader has been initialized
   (log): call logging using the $plugin_loader object

*  plugins/logging/warn
   NEW: sample plugin which replicates the core logging functionality

*  plugins/logging/devnull
   NEW: sample plugin which logs nothing (for testing multiple logging
     plugin functionality)

*  config.sample/logging
   sample configuration file for logging plugins

*  plugins/virus/uvscan
   plugins/virus/clamav
   Increase loglevel for non-serious warnings to LOGWARN from LOGERROR


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@398 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-24 21:16:35 +00:00
Matt Sergeant
6ecc991a20 body_write patches from Brian Grossman
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@394 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-10 18:18:28 +00:00
John Peacock
f82dffe5ce * lib/Qpsmtpd/SMTP.pm
Copy all lines of incoming message to spool file and keep track of
    where the body lines started (ease use of inplace scanning for
    viruses).

*   lib/Qpsmtpd/Transaction.pm
    New function body_start() to get/set the body in spool file
    Tweak body_resetpos() and body_getline() to use body_start instead of 0


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@375 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-01 14:31:25 +00:00
John Peacock
e503c04ed2 * lib/Qpsmtpd/SMTP.pm
Require a domain/address be given in HELO or EHLO command


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@374 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-25 16:18:08 +00:00
John Peacock
31a8e7d438 Lets the data hook handle missing envelope sender/recipient,
then falls back to the builtin 503 response (Brian Gross)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@359 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-30 17:40:11 +00:00
John Peacock
c840a1d04f Changes by jpeacock@cpan.org (John Peacock)
o plugins/check_badmailfromto
    - New plugin in the style of check_badmailfrom, which matches a pair
      of FROM/TO and makes it seem like the recipient's address no longer
      exists (but only from the matching sender's point of view).  Useful
      for stalkers and other harassment cases.

o plugins/dns_whitelist_soft
    - New plugin to provide a DNS-based whitelist (good for distributed
      sites).

o various files
    - Replaced tab character with 8 spaces and adjusted line breaks for
      better readability.

Changes by mct@toren.net (Michael C. Toren)

o lib/Qpsmtpd/SMTP.pm

    - Assumes a MAIL FROM value of "<#@[]>" (utilized by qmail to
      indicate a null sender when generating a doublebounce message)
      is equivalent to "<>".  Previously qpsmtpd complained that the
      value could not be parsed.

    - Adds LOGIN to the default list of supported auth mechanisms.
      The documentation in Auth.pm indicated that auth-login was not
      currently supported due to lack of functionality, however I can
      confirm that LOGIN appears to work fine as tested by using msmtp
      (http://msmtp.sourceforge.net/).  Are there any indications that
      LOGIN support is actually broken in the current implementation?

    - Removes the "X-Qpsmtpd-Auth: True" header appended when a message
      has been sent by an authenticated user.  One problem with such a
      header is that it's impossible to say which SMTP hop added it,
      and it provides no information which could be used to backtrack
      the transaction.  I grepped through my mail archives a bit
      looking for how other MTAs handled the problem, and decided it
      would be best to place this information in the Received: header:

        Received: from remotehost (HELO remotehost) (192.168.42.42)
          (smtp-auth username foo, mechanism cram-md5)
          by mail.netisland.net (qpsmtpd/0.28) with ESMTP; <date>


o lib/Qpsmtpd/Auth.pm:

    - Documentation update for the arguments passed to an auth
      handler; previously the $mechanism argument was not mentioned,
      which threw off the argument offsets.

    - Documentation update for auth-login removing the warning
      that auth-login is not currently supported due to lack of
      functionality.

    - Fix to execute a generic auth hook when a more specific
      auth-$mechanism hook does not exist.  (Previously posted
      to the list last week.)

    - Upon authentication, sets $session->{_auth_user} and
      $session->{_auth_mechanism} so that SMTP.pm can include them
      in the Received: header.


o plugins/queue/qmail-queue

    - Added a timestamp and the qmail-queue qp identifier to the
      "Queued!" 250 message, for compatibility with qmail-smtpd, which
      can be very useful for tracking message delivery from machine to
      machine.  For example, the new 250 message might be:

        250 Queued! 1105927468 qp 3210 <1105927457@netisland.net>

      qmail-smtpd returns:

        250 ok 1106546213 qp 7129

      Additionally, for consistency angle brackets are placed around
      the Message-ID displayed in the 250 if they were missing in the
      message header.


o plugins/check_badmailfrom:

    - Changed the error message from "Mail from $bad not accepted
      here" to "sorry, your envelope sender is in my badmailfrom
      list", for compatibility with qmail-smtpd.  I didn't see any
      reason to share with the sender the value of $bad, especially
      for situations where the sender was rejected resulting from a
      wildcard.


o plugins/check_earlytalker:
o plugins/require_resolvable_fromhost:

    - No longer checks for earlytalkers or resolvable senders if the
      connection note "whitelistclient" is set, which is nice for
      helping backup MX hosts empty their queue faster.


o plugins/count_unrecognized_commands:

    - Return code changed from DENY_DISCONNECT, which isn't valid in
      an unrecognized_command hook, to DENY, which in this context
      drops the connection anyway.  (Previously posted to the list
      last week.)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@356 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-28 03:30:50 +00:00
Robert Spier
e10bb78cd3 - modify some comments about timeouts
- remove extraneous pid's from log messages


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@346 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 06:38:32 +00:00
Matt Sergeant
09531ad70c To balance out with the rcpt logging diff'd against the CVS version
(peter@boku.net)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@343 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-22 20:50:57 +00:00
Matt Sergeant
bfd609fb32 Fix timeout config warnings.
Fix alarm not being reset at end of while loop


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@342 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-19 08:44:24 +00:00
John Peacock
b9646eef75 Remove the $transaction->relaying() code completely
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@327 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-23 13:51:09 +00:00
John Peacock
f92e99bd9c * plugins/check_relay
*   plugins/rcpt_ok
    Split check_relay into two plugins

*   config/plugins
    Reorder plugins to take advantage of the new check_relay

*   lib/Qpsmtpd/Connection.pm
    Add support for relay_client() method

*   lib/Qpsmtpd/SMTP.pm
    Copy connection relay settings to transaction object when created

*   lib/Qpsmtpd/Auth.pm
    Use the connection->relay_client() instead of setting an env var


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@326 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-22 16:01:16 +00:00
Matt Sergeant
8c37005161 Use a method for getting a line, so we can subclass it.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@316 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-14 05:48:39 +00:00
Robert Spier
fb3f0b4604 Matt says wipe it!
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@311 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-07 15:08:26 +00:00
Robert Spier
fd1cf0b9b0 Qpsmtpd::TCPServer will handle calling load_plugins. We *really* only
want to call it once per process.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@310 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-07 05:50:36 +00:00
Matt Sergeant
606519b06c Fix for hooks not running with previous patch, caused by qpsmtpd objects not
asking each plugin to register. There is slightly more overhead this way,
but it feels more correct, and we can fix the overhead later in a more clean
way.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@300 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-05 16:28:08 +00:00
Robert Spier
ee1017a1a4 VRFY plugin support
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@298 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-05 04:30:21 +00:00
Matt Sergeant
9d94f4d96a Pass extra "stuff" to HELO/EHLO callbacks
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@293 958fd67b-6ff1-0310-b445-bb7760255be9
2004-09-01 05:56:52 +00:00
Matt Sergeant
e6e2091ee0 Attempt to clean up circular refs problems
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@292 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-31 01:58:57 +00:00
Ask Bjørn Hansen
42719a179f support NULL envelopes again (doh, typo of the week :-) )
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@278 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-20 12:46:20 +00:00
Ask Bjørn Hansen
b9dca51d2a fix minor warning introduced with the data hook
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@270 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-16 09:44:39 +00:00
Matt Sergeant
c60710e871 Add a hook for the DATA command
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@269 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-16 07:27:26 +00:00
Robert Spier
de9a7fa02a Message-ID: <40F6EB78.1010107@rowman.com>
From: John Peacock <jpeacock@rowman.com>

Yeah, I was just noticing how odd it was that FROM was always logged
but TO wasn't logged at all.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@268 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-16 05:06:43 +00:00
Ask Bjørn Hansen
86c887fd59 take out spurious warning
improve address parsing a bit to make it easier to add parsing of MAIL
FROM extensions


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@263 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-16 02:22:11 +00:00
Ask Bjørn Hansen
87323ed62e Mail::Address does RFC822 addresses, we need SMTP addresses.
Replace Mail::Address with Peter J. Holzer's Qpsmtpd::Address module.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@261 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-14 23:58:47 +00:00
Matt Sergeant
011f44e11d Auth changes (John Peacock with minor modifications by baud)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@252 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-29 21:45:35 +00:00
Robert Spier
ac9dd50928 DENY_DISCONNECT and DENYSOFT_DISCONNECT instead of *HARD
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@245 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-14 22:25:52 +00:00
Robert Spier
971b696ffa forgot another place to put DENYSOFTHARD
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@241 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-11 06:11:27 +00:00
Robert Spier
48d753ca25 add DENYSOFTHARD status
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@240 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-11 06:06:30 +00:00
Matt Sergeant
9c700b18e1 New for 0.28: Log levels and $Include for config/plugins
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@217 958fd67b-6ff1-0310-b445-bb7760255be9
2004-03-05 12:46:24 +00:00
Ask Bjørn Hansen
22523ead2d reject bare carriage-returns in addition to the bare line-feeds
(based on a patch from Robert James Kaes, thanks!)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@209 958fd67b-6ff1-0310-b445-bb7760255be9
2004-03-04 04:30:02 +00:00
Ask Bjørn Hansen
9523d55cd7 reset_transaction is called after disconnect plugins are called so
the Transaction objects DESTROY method is called. (Thanks to Robert
  James Kaes <rjkaes@flarenet.com>)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@207 958fd67b-6ff1-0310-b445-bb7760255be9
2004-02-24 10:31:12 +00:00
Ask Bjørn Hansen
dfb763acdf don't call exit from the SMTP object, call the disconnect method instead
minor tweaks


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@203 958fd67b-6ff1-0310-b445-bb7760255be9
2004-02-13 13:10:18 +00:00
Matt Sergeant
c567f3726a Support DENYHARD as response to RCPT
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@198 958fd67b-6ff1-0310-b445-bb7760255be9
2003-12-03 20:58:30 +00:00
Matt Sergeant
c4903199ff DENYHARD - allows you to DENY with a disconnect
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@196 958fd67b-6ff1-0310-b445-bb7760255be9
2003-12-03 08:07:36 +00:00
Matt Sergeant
c2fb24c4e4 Split received header so it doesn't exceed 78 chars
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@191 958fd67b-6ff1-0310-b445-bb7760255be9
2003-11-04 22:52:49 +00:00
Matt Sergeant
b442d002f1 Don't unfold header lines.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@178 958fd67b-6ff1-0310-b445-bb7760255be9
2003-11-01 10:05:23 +00:00
Ask Bjørn Hansen
2a76892570 don't use Data::Dumper
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@172 958fd67b-6ff1-0310-b445-bb7760255be9
2003-09-15 10:50:27 +00:00