Qpsmtpd-Plugin-Quarantine

 view release on metacpan or  search on metacpan

lib/Qpsmtpd/Plugin/Quarantine/Common.pm  view on Meta::CPAN

use CGI qw();
require Exporter;
use Sys::Hostname;
use strict;

our @ISA = qw(Exporter);
our @EXPORT = qw(new_sender new_recipient get_oops oops_args %defaults %escape recompute_defaults);
our @EXPORT_OK = qw(%base_defaults);

our $myhostname = hostname();

# ------------------------------- begin defaults section ------------------------------------------------

#
# These defaults can be overridden in the defaults_file (see below) or
# in the Qpsmtpd plugins configuration file.  The location of the defaults
# file can't be overridden.  The location of the Qpsmtpd configuration
# directory can only be overridden by the defaults_file.
#
our %base_defaults = (
	#
	# Configuration files
	#
	defaults_file		=> '/etc/default/qpsmtpd-quarantine.pl',
	templates		=> "/etc/qpsmtpd/quarantine-templates",
	qpsmtpd_dir		=> '/etc/qpsmtpd',
	admin_passwd_file	=> "/etc/qpsmtpd/quarantine.access",		# htpasswd style user file
	notify_recipient_only	=> "/etc/qpsmtpd/recipient.special.db",		# notify these recipients instead of senders
	special_sender_db	=> "/etc/qpsmtpd/sender.special.db",		# always check mail from these senders
	# $qpsmtpd_dir/filter_domains		- list of domain names that might blacklist us
	# $qpsmtpd_dir/our_domains		- list of domain names that are us
	# $qpsmtpd_dir/our_networks		- list of IP addresses a.b.c.d/size that are us
	# $qpsmtpd_dir/ignore_networks		- list of IP addresses a.b.c.d/size that don't count

	#
	# Data Store
	#
	dbi_dsn			=> $ENV{OOPS_DSN} || 'DBI::SQLite:dbname=/var/spool/qpsmtpd-quarantine.db',
	username		=> "biteme",	# database user
	password		=> "harder",	# database password
	table_prefix		=> 'q',		# see OOPS documentation

	#
	# Identity
	#
	send_from		=> "root\@$myhostname",
#	baseurl			=> "http://$myhostname/perl/quarantine.pl",    # mod_perl with Apache::Registry
	baseurl			=> "http://$myhostname/quarantine.cgi",
	bounce_from		=> "MAILER-DAEMON\@$myhostname",

	#
	# Spam filtering
	#
	spamd3			=> {
		'spamc -R -d 127.0.0.1 <'	=>  100,	# can use a farm of servers, value is load share weighting
	},
	accessio		=> '', # see http://www.miavia.com
	clamd			=> '/usr/bin/clamdscan --stdout - <',
	clamav			=> '/usr/local/bin/clamscan --stdout',
	virus_content 		=> qr/(?:application|name=.*\.(?:asd|bat|chm|cmd|com|cpl|dll|exe|hlp|hta|js|jse|lnk|ocx|pif|rar|scr|shb|shm|shs|vb|vbe|vbs|vbx|vxd|wsf|wsh|zip))/i,
	subcommand_timeout	=> 150,

	#
	# Bounce message
	#
	senderbounce1		=> 'Your message is quarantined because we think it is probably spam, if it is not spam, click',
	senderbounce2		=> 'to release your message from quarantine or to choose to have the spam you send silently deleted instead of bounced',
	senderbounce3		=> 'None of the recipients of your email wish to receive mail that is likely to be spam',

	#
	# Networks
	#
	ignore_networks		=> [ qw(127.0.0.0/8 10.0.0.0/8 172.16/12 192.168/16) ],

	#
	# Mail configuration
	#
	bypass_mailhosts	=> [qw(127.0.0.1)],			# Where to SMTP-inject messages (post-filter)
	bypass_mailcmd		=> [qw(/usr/sbin/sendmail -oeml -i)],	# ... if that didn't work
	nobody_address		=> "nobody\@$myhostname",		# this user should silently discard


	#
	# Quarantine behavior
	#
	check_all_recipients	=> 0,		# Check mail to non-filtered domains for spam too
	randomly_check_messages	=> 1,		# check N % of messages regardless
	check_from_our_domain	=> 0,		# Force a check of mail from our domains even if not to a filtered destination
	check_not_our_domain	=> 0,		# Force a check of mail not from our domains even if not to a filtered destination
	check_from_our_ip	=> 0,		# Force a check of mail from our netblock even if not to a filtered destination
	check_not_from_our_ip	=> 0,		# Force a check of mail not from our netblock even if not to a filtered destination
	renotify_sender_ip	=> 10,		# Send a bounce every N days (per IP, per sender)
	notify_recipients	=> 75,		# After N messages, notify the recipient instead (0 = disable)
	renotify_recipient_days	=> 10,		# Notify recipients every N days (when there is a new message)
	max_bounces_per_header	=> 3,		# allow N bounes with our URL to bypass the filter (per message URL)
	notify_other_senders	=> 0,		# send bounces to external senders?

	#
	# Cron job config
	#
	sender_stride_length	=> 40,		# when cleaning, process N senders per transaction
	recipient_stride_length	=> 40,		# when cleaning, process N recipients per transaction
	sender_history_to_keep	=> 20,		# how many days spamming history to keep per sender
	keep_every_nth_message	=> 200,		# quarantine every Nth spam per sender (regardless of sender settings)
	report_senders_after	=> 100,		# minimum number of spams required to make a report on a sender
	message_longevity	=> 30,		# how long to keep messages in quarantine (days)
	delete_batchsize	=> 50,		# how many messages to delete per transaction
	keep_idle_recipients	=> 720,		# how long to keep idle recipients that have settings (days)
	message_store_size	=> 1500,	# Megabytes

	#
	# Internal data structures
	#
	size_storage_array_size	=> 256,		# transaction parallism
	message_size_overhead	=> 500,		# header, etc

	#
	# Internal Mail Queue
	#
	mqueue_stride_length	=> 50,		# when sending mail, process N recipients per transaction
	mqueue_minimum_attempts	=> 100,		# how many times to try sending something



( run in 2.891 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )