Commit Graph

49 Commits

Author SHA1 Message Date
Ask Bjørn Hansen c408aa98ca Update copyright year 2010-04-07 22:32:41 -07:00
Devin Carraway b8958d333b forkserver: accurately report default run-as user 2009-06-02 15:36:41 -07:00
Ask Bjørn Hansen ff0c6134a9 Update URL 2009-04-02 23:35:05 -07:00
Hanno Hecker eff638dd79 forkserver: fix wrong detection of closed connection
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@954 958fd67b-6ff1-0310-b445-bb7760255be9
2008-10-24 17:18:08 +00:00
Matt Sergeant 59b826d4bb Fix to check client is writable before writing to it.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@946 958fd67b-6ff1-0310-b445-bb7760255be9
2008-09-26 17:40:04 +00:00
Hanno Hecker a64742cc7c prefork, forkserver: restart on SIGHUP: * reset to defaults * clear config cache * reload all plugins (includes compiling, register()/init())
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@927 958fd67b-6ff1-0310-b445-bb7760255be9
2008-06-15 09:28:02 +00:00
Hanno Hecker ea243c2f2f add reset() to Qpsmtpd::Connection to clear the connection notes after
the post-connection hooks - needed for -prefork and STARTTLS


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@893 958fd67b-6ff1-0310-b445-bb7760255be9
2008-05-09 17:40:31 +00:00
Hanno Hecker 7d4605fdbc remove the connection / transaction id feature for 0.42 release
- add back in after 0.42 is out? if yes: start implementing in -prefork 


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@809 958fd67b-6ff1-0310-b445-bb7760255be9
2007-10-09 12:00:43 +00:00
Peter J. Holzer af82701fff New id scheme: Start with a unique id for the Qpsmtpd::SMTP object,
then derive ids for connections and transactions from that via
simple counters.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@785 958fd67b-6ff1-0310-b445-bb7760255be9
2007-09-02 10:50:23 +00:00
Peter J. Holzer 5ccdcca7b2 Connection id similar to the transaction id by Matt.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@780 958fd67b-6ff1-0310-b445-bb7760255be9
2007-08-30 20:19:30 +00:00
Matt Sergeant ccf990e032 IPv6 support from issue #7.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@740 958fd67b-6ff1-0310-b445-bb7760255be9
2007-05-17 22:16:27 +00:00
Matt Sergeant 2db48784fe Applied patch from issue #5: qpsmtpd-forkserver 0.32 patches
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@739 958fd67b-6ff1-0310-b445-bb7760255be9
2007-05-17 22:09:33 +00:00
Peter J. Holzer 72da879365 Ensure that each child process in qpsmtpd-forkserver will use a
differenct sequence of ids in DNS requests.
See the thread "dnsbl or spamhaus occassionally blocks wrong IP"
starting at 14 Mar 2006 for details.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@682 958fd67b-6ff1-0310-b445-bb7760255be9
2006-12-16 09:42:52 +00:00
Peter J. Holzer 839eddc558 Older perls don't know constant AF_INET6, but don't mind a function
which is never called.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@673 958fd67b-6ff1-0310-b445-bb7760255be9
2006-11-06 09:06:39 +00:00
Devin Carraway 02bf7b80e5 Fix startup of qpsmtpd-forkserver on hosts lacking Socket6 (it's not enough
to have 'use Socket6' in a conditional, it must be evalled also)


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@670 958fd67b-6ff1-0310-b445-bb7760255be9
2006-11-05 09:47:18 +00:00
Ask Bjørn Hansen 6ef0bf27c7 r4175@embla: ask | 2006-08-28 01:17:10 +0200
Experimental IPv6 support (forkserver only). (Mike Williams)


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@657 958fd67b-6ff1-0310-b445-bb7760255be9
2006-08-27 23:17:33 +00:00
John Peacock 4a824a2e7d Improve support for listening to multiple ports and/or multiple IP addresses.
Document using plugins/tls to handle SMTPS (port 465).

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@625 958fd67b-6ff1-0310-b445-bb7760255be9
2006-03-01 16:44:20 +00:00
John Peacock 2c683f22ef Implement multiple IP:PORT listen in forkserver (Devin Carraway).
Add support in plugins/tls to use SMTPS (John Peacock).

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@624 958fd67b-6ff1-0310-b445-bb7760255be9
2006-02-28 21:10:11 +00:00
John Peacock c0920346e5 the pre-connection and post-connection hooks are not working in
qpsmtpd-forkserver. This patch merges Peter's patch (with the possibilty
to DENY/DENSOFT the connection) and my first attempt. The --max-from-ip
check was moved from core to the hosts_allow plugin. 

Patch by: Hanno Hecker <hah@uu-x.de>

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@599 958fd67b-6ff1-0310-b445-bb7760255be9
2006-01-11 16:21:08 +00:00
Devin Carraway 239daaf55a Drop root privileges before loading plugins, rather than after. This reduces
root exposure, and avoids (e.g.) files being created as root which then won't
be writable by the normal qpsmtpd user.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.3x@584 958fd67b-6ff1-0310-b445-bb7760255be9
2005-12-11 02:19:43 +00:00
John Peacock 9cbf206a4a * lib/Qpsmtpd/TcpServer.pm
Don't try to load the plugins if they are already loaded.

* lib/Qpsmtpd/Transaction.pm
  Get the size_threshold by inheritance.
  Extract the spooling of the body as a new sub.
  Always spool the body when calling body_filename().
  Compare the body_size to the cached size_threshold.

* lib/Qpsmtpd.pm
  Cache the size_threshold and provide an accessor method.

* qpsmtpd-forkserver
  Initialize both the spool_dir and size_threshold caches before forking.

git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@547 958fd67b-6ff1-0310-b445-bb7760255be9
2005-09-22 17:14:20 +00:00
Devin Carraway da5c0a74fe Fix unitialized-value warning if the PID file existed but was zero-length
at startup time.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@536 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-30 09:32:36 +00:00
Devin Carraway a4e4c5217c Fix whitespace (spaces for a tab)
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@526 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 07:24:04 +00:00
Devin Carraway 00e06cc612 Remove PID file on exit, if we were told to create one with --pid-file
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@525 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 07:22:36 +00:00
Devin Carraway a2064bc22e Add --detach commandline option to forkserver; if supplied, daemonize just
prior to entering the main accept loop.

Split handling of --pid-file so that preexisting pid files are dealt with and
the file is opened before priveleges are dropped, but the writing out of the
new file happens after dropping privs and (if applicable) forking the
daemonized process, so the correct PID is recorded.


git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@524 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 06:42:00 +00:00
Devin Carraway a3ff03fec9 Merge r493 from trunk to truncate PID file before re-use
git-svn-id: https://svn.perl.org/qpsmtpd/branches/0.31@523 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-29 06:21:02 +00:00
Matt Sergeant 3fc6a4f318 Make sure we process all servers after select()
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@466 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 12:13:53 +00:00
Devin Carraway 1e68345cf2 Clean up whitespace (mainloop had a swath of 4-space indentation, while everything else used 2-space; also removed some tabs towards the beginning.)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@465 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 07:53:41 +00:00
Devin Carraway 1fbfe5156b Implement listening on multiple local addresses simultaneously, if specified by
more than one --listen-address commandline argument.


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@464 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-06 07:50:00 +00:00
Matt Sergeant 314625d05a Another small cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@463 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-05 15:25:54 +00:00
Matt Sergeant 4b72a40100 Minor cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@462 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-05 15:20:40 +00:00
Matt Sergeant 698fc01595 Make pid-file optional
Use known-safe fork code for forking
No more SIGCHLD for managing zombies (Peter Holzer)
Don't block on accept() so we can call REAPER every second


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@461 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-05 15:16:36 +00:00
Ask Bjørn Hansen 03f8c0d2f8 + qpsmtpd-forkserver: add an option for writing a PID file (pjh)
+
+  qpsmtpd-forkserver: set auxiliary groups (this is needed for the
+  postfix backend, which expects to have write permission to a fifo
+  which usually belongs to group postdrop). (pjh)



git-svn-id: https://svn.perl.org/qpsmtpd/trunk@460 958fd67b-6ff1-0310-b445-bb7760255be9
2005-07-04 14:44:51 +00:00
Devin Carraway 2847144641 Fix typo in forkserver commandline help
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@454 958fd67b-6ff1-0310-b445-bb7760255be9
2005-06-29 09:37:10 +00:00
John Peacock 662003437d * qpsmtpd-forkserver
Create a single Qpsmtpd::TcpServer object in the parent process and
     then rely on fork to let each child have it's own copy
     
 *   lib/Qpsmtpd/Plugin.pm
     Add new pre-connection and post-connection hooks
     
 *   README.plugins
     Document the above new hooks

 *   lib/Qpsmtpd.pm
     No longer have local value for trace_level() the first time through, which 
     was masking the global value (due to stupid search/replace error).
     Don't call log() from trace_level() since it is only ever called from
     within the varlog() sub when no logging plugin is registered.

 *   plugins/dnsbl
     Config line option to use DENY_DISCONNECT instead of DENY (since any IP
     on a blacklist should not have a chance to send anything for now).
     Add POD to document the new disconnect behavior

 *   lib/Qpsmtpd.pm
     Compatibility changes so test files continue to work
 
 *   t/Test/Qpsmtpd.pm
     Compatibility sub for core subs which call varlog() directly


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@428 958fd67b-6ff1-0310-b445-bb7760255be9
2005-05-25 20:07:58 +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
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 acbb51a555 - set a sane ALRM handler
- pass more information to the Connection


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@291 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-29 07:57:07 +00:00
Robert Spier 616aa735b9 fix compilation error
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@288 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-14 17:42:45 +00:00
Robert Spier 1eefd49c22 slight cleanup
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@287 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-09 15:40:56 +00:00
Matt Sergeant dae911cec8 When REAPER is called by SIGCHLD, it can start in the middle of the loop
over values %childstatus in the MAXCONNIP block.  This can cause $rip to be
deleted by REAPER while we're using it.  Perl will die saying "Use of freed
value in iteration".
 -- brian@SoftHome.net


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@286 958fd67b-6ff1-0310-b445-bb7760255be9
2004-08-09 08:13:26 +00:00
Robert Spier 606df3773c Switch to a simpler and known good seeding algorithm
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@274 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-18 01:29:00 +00:00
Matt Sergeant ce59fc98b6 srand after the fork.
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@272 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-17 08:45:09 +00:00
Matt Sergeant b82536df19 Support per-IP throttling (Hanno Hecker <hah@uu-x.de>)
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@259 958fd67b-6ff1-0310-b445-bb7760255be9
2004-07-05 19:20:15 +00:00
Devin Carraway 29ac28601b - Enable taint checking
- Allow most operating parameters (bind address, port, etc) to be overriden
  on the commandline
- Drop an unused scalar
- Minor logging improvements


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@251 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-28 03:05:03 +00:00
Matt Sergeant 5d40964053 Make signal handling slightly more stable
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@246 958fd67b-6ff1-0310-b445-bb7760255be9
2004-06-16 20:27:51 +00:00
Robert Spier d8c8d40ef6 - move configuration to top. (still suboptimal)
- child limiting
- logging helper


git-svn-id: https://svn.perl.org/qpsmtpd/trunk@229 958fd67b-6ff1-0310-b445-bb7760255be9
2004-04-15 02:19:01 +00:00
Matt Sergeant f84bd18601 Slightly better signal handling - may help stability issues for some people
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@228 958fd67b-6ff1-0310-b445-bb7760255be9
2004-03-18 23:02:43 +00:00
Matt Sergeant 04dacc4488 Pure perl forking qpsmtpd
git-svn-id: https://svn.perl.org/qpsmtpd/trunk@227 958fd67b-6ff1-0310-b445-bb7760255be9
2004-03-15 08:59:02 +00:00