Commit Graph

1035 Commits

Author SHA1 Message Date
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
Ask Bjørn Hansen
aef508cb7b Don't check the HELO host for rfc-ignorant compliance (maybe this should be an option?)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@397 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-24 19:17:46 +00:00
Matt Sergeant
ed4e06bcd2 Fix timeout code kicking in when PTR result is blank domain
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@396 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-11 20:09:30 +00:00
Matt Sergeant
41e13e7454 body_write patches from Brian Grossman
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@395 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-10 18:19:27 +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
Ask Bjørn Hansen
58f03e5787 tweaks to make it work with tcpserver
the check_earlytalker fix was entirely wrong


git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@393 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-09 00:28:49 +00:00
Ask Bjørn Hansen
df1efdce73 use $self->can_read rather than $self->qp->can_read with high perf patch
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@392 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-09 00:20:32 +00:00
Matt Sergeant
93e0025aae Remove remnants of older name of this project :-)
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@391 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 23:34:51 +00:00
Matt Sergeant
8588a066d2 Fix strictness
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@390 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 23:32:25 +00:00
Matt Sergeant
6495f41bb2 High perf versions of these plugins
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@389 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 22:58:09 +00:00
Matt Sergeant
b5b3950ef9 Main initial work on poll server.
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@388 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 22:52:23 +00:00
Matt Sergeant
3922235bcf Import Danga libraries. This is a bit evil but we'll just have to track them
from the Danga project. This way we get something stable that we know works,
plus nobody has to go and track down other libraries.

Note that only Danga::Socket is (C) Danga. Everything else is original code
and (C) Matt Sergeant.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@387 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 19:59:45 +00:00
Matt Sergeant
12ae226ad7 high performance branch
git-svn-id: https://svn.perl.org/qpsmtpd/branches/high_perf@386 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 19:56:15 +00:00
Matt Sergeant
321622f0aa Store mail in memory up to a certain threshold (default 10k).
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@385 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-08 18:09:49 +00:00
Ask Bjørn Hansen
3c5d0d93e4 bump version number up
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@384 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-04 19:18:30 +00:00
John Peacock
43f39a4538 * plugins/virus/clamdscan
Correctly support alternate domain socket
    Remove a tab that crept in


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@383 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-04 16:04:59 +00:00
Ask Bjørn Hansen
a44957dc86 fix thinko from the log cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@381 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-03 17:28:43 +00:00
Matt Sergeant
43aa207242 Fix all uses of warn() to be $self->log(LOGWARN, ...)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@380 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-03 02:37:04 +00:00
Ask Bjørn Hansen
db546fe91c prepare 0.29
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@379 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-03 02:30:16 +00:00
John Peacock
167939748c * Changes
Remember (belatedly) to add changes here

*   MANIFEST
    Add all new files to this list

*   plugins/virus/clamdscan
    New AV plugin to directly communicate with clamd daemon


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@378 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-01 20:11:09 +00:00
John Peacock
889845af24 * plugins/virus/clamav
Scan temporary file directly now that the spooled file includes the
    entire message

*   plugins/virus/bitdefender - John Peacock
    plugins/virus/hbedv - Hanno Hecker
    New AV plugins


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@377 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-01 19:55:18 +00:00
John Peacock
ec7aff1415 * lib/Qpsmtpd.pm
Use package lexical to cache spool dir location instead of storing in
    Transaction or other high level object


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@376 958fd67b-6ff1-0310-b445-bb7760255be9
2005-03-01 14:33:26 +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
72eb14dcfb * plugins/virus/clamav
Reword the POD to explain exactly how to chmod the directories to get
    clamdscan to work within the spool directory (Thanks to Robin Bowes)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@373 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-25 03:06:22 +00:00
John Peacock
f95c2f8826 * plugins/virus/clamav
Improved documentation for running clamdscan correctly inside the
    qpsmtpd spool directory.

    Change file permissions to permit non-owner external process to access
    files inside spool directory


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@372 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-24 20:00:23 +00:00
John Peacock
c049917d8e * plugins/virus/clamav
Provide more documentation on using clamdscan
    Provide back_compat option to eliminate warnings in log with old ClamAV
    Use new $self->spool_dir() function instead of homebrew


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@371 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-24 16:54:02 +00:00
John Peacock
9da2fc7343 Explicitely ignore non-multipart messages for virus scanning
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@370 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-22 22:01:21 +00:00
John Peacock
bb36c60b6a Abstracted spool_dir creation and added temp_file() and temp_dir() subs to
make it easier for plugins to manage temporary workspace.  Also add POD and
tests for the new functions.  Still need to add tests to the temp_*() calls
from a plugin.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@369 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-22 02:47:39 +00:00
John Peacock
d790bd519d rcpt_handler requires a Qpsmtpd::Address object not just the bare address
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@368 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-22 00:38:06 +00:00
Ask Bjørn Hansen
d0b9558ce9 APR::Bucket API changed...
From: peter[at]boku.net (Peter Eisch)
Message-ID: <BE3F8D10.1C451%peter[at]boku.net>
Subject: Apache::Qpsmptd.pm patch
Date: Mon, 21 Feb 2005 13:05:20 -0600


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@367 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-21 21:48:45 +00:00
Ask Bjørn Hansen
b7cdef5f46 update status
can someone look into the clamav thing?  When that's done I think we can roll a release...
:)


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@366 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-15 21:47:15 +00:00
Ask Bjørn Hansen
40a1f2fc2a add Gavin's greylisting plugin
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@365 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-15 21:42:52 +00:00
Ask Bjørn Hansen
7217af9d42 don't manage config in cvs
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@364 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-15 19:25:29 +00:00
John Peacock
d26cffdb5e * t/addresses.t
Only need to 'my' the $command scalar once


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@363 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-13 21:40:24 +00:00
John Peacock
e48bc9fa3c * MANIFEST
Actually include all files that are in the repository now


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@362 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-13 21:37:03 +00:00
John Peacock
dd7b8be78f * MANIFEST
Since the config/ folder was renamed, have to update this too

*   t/qpsmtpd-address.t
    New tests added so the count needs to be incremented, too


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@361 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-13 21:28:10 +00:00
John Peacock
60cab010f8 * plugins/auth/auth_vpopmail_sql
Handle case where pw_clear_passwd doesn't exists in vpopmail database


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@360 958fd67b-6ff1-0310-b445-bb7760255be9
2005-02-10 14:33:13 +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
1d1799feb6 Correct handling for vpopmail built without clear password option
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@358 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-30 17:24:49 +00:00
Matt Sergeant
d26797c6d2 Make the original string available in the Connection notes
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@357 958fd67b-6ff1-0310-b445-bb7760255be9
2005-01-30 05:40:24 +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
ed2ab5f5fd From: Nick Leverton <>
Subject: SPF plugin: using it in practice (PATCH attached for CVS)
Date: Tue, 30 Nov 2004 11:35:30 +0000
Message-ID: <20041130113530.GA31737@leverton.org>


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@355 958fd67b-6ff1-0310-b445-bb7760255be9
2004-12-02 07:26:11 +00:00
Robert Spier
22a1d99981 From: Jim Winstead
Subject: default port for qpsmtpd-forkserver
Date: Sun, 28 Nov 2004 10:14:20 -0800
Message-ID: <20041128181420.GA17602@trainedmonkey.com>

it's a minor thing, but the default port for qpsmtpd-forkserver is 2525
in the code, but it claims to be 25 in the usage text.

also, the $MAXCONNIP was not settable from the command line.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@354 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-29 03:37:38 +00:00
Robert Spier
ddc945f8f6 DENYHARD is deprecated in favor of DENY_DISCONNECT
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@353 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-28 05:58:58 +00:00
Robert Spier
9422b16c0f Inspired by Justin E@Apache...
- log the fact that badmailfrom is rejecting
- emacs header
- formatting tweak


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@352 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 18:40:54 +00:00
Robert Spier
3757913d54 Remove extraneous filehandling twiddling from qmail-queue that could cause weirdness if the exec failed.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@351 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 17:54:46 +00:00
Robert Spier
3341a5b4ab emacsisms, more timeouts
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@350 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 07:08:46 +00:00
Robert Spier
012c6db2d3 - dnsbl, count_unrec_commands, spamassassin:
use symbolic log levels, instead of numeric
- dnsbl:  set some (probably too large) timeouts
- count_unrec_commands: DENYHARD
- spamassassin: upgrade protocol to support switching users


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@349 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 07:02:23 +00:00
Robert Spier
0a2fc866de - logging tweaks..
- move some things to more appropriate levels
   - make 'running plugin' more interesting


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@348 958fd67b-6ff1-0310-b445-bb7760255be9
2004-11-27 06:46:21 +00:00