Mail::SpamCannibal::LaBreaDaemon - interface to LaBrea::Tarpit


Mail-SpamCannibal documentation Contained in the Mail-SpamCannibal distribution.

Index


Code Index:

NAME

Top

Mail::SpamCannibal::LaBreaDaemon - interface to LaBrea::Tarpit

SYNOPSIS

Top

  use Mail::SpamCannibal::LaBreaDaemon;

  daemon(&hash | \%hash)

DESCRIPTION

Top

This module has one function, to interface to the LaBrea::Tarpit::daemon routine to start and run its data collection daemon.

* daemon(&hash | \%hash)
 input parameters: from hash or pointer to hash
 {
  'LaBrea'      => '/usr/local/spamcannibal/bin/dbtarpit',
  'd_port'      => 8687,                # REQUIRED
  'd_host'      => 'localhost',         # defaults to ALL interfaces
                                        # NOT recommended
  'allowed'     => 'localhost,remote.com',      # default is ALL
                                        # recommend only 'localhost'
  'pid'         => '/var/run/dbtarpit/sc_lbdaemon.pid',
  'cache'       => '/var/run/dbtarpit/sc_lbdaemon.cache',
  'fifo'        => '/var/run/dbtarpit/dbtplog',
 # 'kids'       => default 5            # kids to deliver net msgs
                                        # why would you need more??
 # 'umask'      => 033,         # default 033, cache_file umask
 # 'cull'       => 600,         # default 600, seconds to keep old threads
  'scanners'    => 100,                 # keep this many dead threads
 # 'port_timer' => 86400,       # default 86400, seconds per collection period
  'port_intvls' => 30,                  # keep #nintvls of port stats
                                        # 0 or missing disables
                                        # this can take lots of memory
 };  

DEPENDENCIES

Top

	LaBrea::Tarpit verion 1.17 or better

COPYRIGHT

Top

AUTHOR

Top

Michael Robinton <michael@bizsystems.com>

SEE ALSO

Top

LaBrea::Tarpit, LaBrea::Tarpit::Report


Mail-SpamCannibal documentation Contained in the Mail-SpamCannibal distribution.
#!/usr/bin/perl
package Mail::SpamCannibal::LaBreaDaemon;

use strict;
use LaBrea::Tarpit 1.20 qw(daemon);
use vars qw(@ISA @EXPORT $FIFO $VERSION);
require Exporter;

@ISA = qw(Exporter);

$VERSION = do { my @r = (q$Revision: 0.03 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };

@EXPORT = qw(daemon);

sub lbd_open {
  my($LaBrea,$DEBUG) = @_;
  local *LABREA;
  $LaBrea =~ /^([^\s]+)/;		# bare path to LaBrea
  qx/$1 -V 2>&1/ =~ /(\d+\.[^\s]+)/;	# get version
  my $version = $1;			# save version
# open LaBrea daemon
  my $kid = open(LABREA,$FIFO);
	die "Can't open $FIFO: $!" unless $kid;
  unless ($DEBUG) {
    open STDERR, '>&STDOUT'		or die "Can't dup stdout: $!";
  }
  $0 =~ /[^\s]+$/;
  $0 = $&;
  return(*LABREA,$version,$kid);
}

sub lbd_close {
  my($LBfh,$kid) = @_;
  close $LBfh;
}

*LaBrea::Tarpit::lbd_open = \&lbd_open;
*LaBrea::Tarpit::lbd_close = \&lbd_close;

sub daemon {
  local $_ = ( ref $_[0] ) ? $_[0] : {@_};
  $FIFO = $_->{fifo} || die 'no fifo found';
  goto &LaBrea::Tarpit::daemon;
}


1;