Advertisement
Guest User

Untitled

a guest
Dec 1st, 2010
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 12.02 KB | None | 0 0
  1. use strict;
  2. $MYHOME = '/var/amavis';   # (default is '/var/amavis'), -H
  3. ############ change the next two lines to be ones fitting for your environment
  4. $mydomain = 'whitehathouston.com';      # (no useful default)
  5. $myhostname = 'gentoob0x.whitehathouston.com';  # fqdn of this host, default by uname(3)
  6. $daemon_user  = 'amavis';   # (no default;  customary: vscan or amavis), -u
  7. $daemon_group = 'amavis';   # (no default;  customary: vscan or amavis), -g
  8. $TEMPBASE = "$MYHOME/tmp";     # prefer to keep home dir /var/amavis clean?
  9. $ENV{TMPDIR} = $TEMPBASE; # used for SA temporary files, by some decoders, etc.
  10. $enable_db = 1;              # enable use of BerkeleyDB/libdb (SNMP and nanny)
  11. $enable_global_cache = 1;    # enable use of libdb-based cache if $enable_db=1
  12. $enable_dkim_verification = 0;  # enable DKIM signatures verification
  13. $enable_dkim_signing = 0;    # load DKIM signing code, needs keys in dkim_key()
  14. $forward_method = 'smtp:[127.0.0.1]:10025';  # where to forward checked mail
  15. $notify_method = $forward_method;            # where to submit notifications
  16. $max_servers = 15;     # num of pre-forked children (2..30 is common), -m
  17. $max_requests = 20;   # retire a child after that many accepts (default 20)
  18. $child_timeout=5*60;  # abort child if it does not complete its processing in
  19.                       # approximately n seconds (default: 8*60 seconds)
  20. $smtpd_timeout = 120; # disconnect session if client is idle for too long
  21.                       # (default: 8*60 seconds); should be higher than a
  22.                       # Postfix setting max_idle (default 100s)
  23. @local_domains_maps = ( [".$mydomain"] );  # $mydomain and its subdomains
  24. $insert_received_line = 0;        # behave like MTA: insert 'Received:' header
  25.                                   # (does not apply to sendmail/milter)
  26.                                   # (default is true)
  27. $unix_socketname = "$MYHOME/amavisd.sock"; # amavis helper protocol socket
  28. $inet_socket_port = 10024;        # accept SMTP on this local TCP port
  29.                                   # (default is undef, i.e. disabled)
  30. $inet_socket_bind = '127.0.0.1'; # limit socket bind to loopback interface
  31.                                   # (default is '127.0.0.1')
  32. @inet_acl = qw(127.0.0.1 [::1]);  # allow SMTP access only from localhost IP
  33.                                   # (default is qw(127.0.0.1 [::1]) )
  34. @mynetworks = qw( 127.0.0.0/8 192.168.0.0/16 );  # default
  35. $DO_SYSLOG = 1;                   # (defaults to 0)
  36. $syslog_ident = 'amavis';     # Syslog ident string (defaults to 'amavis')
  37. $syslog_facility = 'mail';    # Syslog facility as a string
  38. $syslog_priority = 'debug';   # Syslog base (minimal) priority as a string,
  39. $LOGFILE = "$MYHOME/amavis.log";  # (defaults to empty, no log)
  40. $log_level = 2;            # (defaults to 0), -d
  41. $log_recip_templ = undef;  # undef disables by-recipient level-0 log entries
  42. $hdr_encoding = 'iso-8859-1';  # MIME charset (default: 'iso-8859-1')
  43. $hdr_encoding_qb = 'Q';        # MIME encoding: quoted-printable (default)
  44. $hdr_encoding_qb = 'B';        # MIME encoding: base64
  45. $bdy_encoding = 'iso-8859-1';  # (default: 'iso-8859-1')
  46. %final_destiny_by_ccat = (
  47.   CC_VIRUS,      D_DISCARD,
  48.   CC_BANNED,     D_DISCARD,
  49.   CC_UNCHECKED,  D_PASS,
  50.   CC_SPAM,       D_DISCARD,
  51.   CC_BADH,       D_PASS,
  52.   CC_OVERSIZED,  D_PASS,
  53.   CC_CLEAN,      D_PASS,
  54.   CC_CATCHALL,   D_PASS,
  55. );
  56. @viruses_that_fake_sender_maps = (new_RE(
  57.   qr'nimda|hybris|klez|bugbear|yaha|braid|sobig|fizzer|palyh|peido|holar'i,
  58.   qr'tanatos|lentin|bridex|mimail|trojan\.dropper|dumaru|parite|spaces'i,
  59.   qr'dloader|galil|gibe|swen|netwatch|bics|sbrowse|sober|rox|val(hal)?la'i,
  60.   qr'frethem|sircam|be?agle|tanx|mydoom|novarg|shimg|netsky|somefool|moodown'i,
  61.   qr'@mm|@MM',    # mass mailing viruses as labeled by f-prot and uvscan
  62.   qr'Worm'i,      # worms as labeled by ClamAV, Kaspersky, etc
  63.   [qr/^/ => 1],   # true by default  (remove or comment-out if undesired)
  64. ));
  65. ###### change $virus_admin to whateverusershouldreceivevirusnotifications\@$mydomain
  66. $virus_admin = "meat\@$mydomain";
  67. $spam_admin = undef;    # do not send spam admin notifications (default)
  68. $mailfrom_notify_admin     = "amavis\@$mydomain";
  69. $mailfrom_notify_recip     = "amavis\@$mydomain";
  70. $mailfrom_notify_spamadmin = "spam\@$mydomain";
  71. $mailfrom_to_quarantine = ' ';   # override sender address with null return path
  72. $QUARANTINEDIR = "$MYHOME/quarantine";
  73. $quarantine_subdir_levels = 1;  # add level of subdirs to disperse quarantine
  74. $sa_quarantine_cutoff_level = 50;  # dflt: undef, which disables this feature
  75. $X_HEADER_TAG = 'X-ClamAV-Scanned';     # (default: 'X-Virus-Scanned')
  76. $undecipherable_subject_tag = '***ENCRYPTED*** ';  # undef disables it
  77. $defang_virus  = 1;  # default is false: don't modify mail body
  78. $defang_banned = 1;  # default is false: don't modify mail body
  79. $remove_existing_x_scanned_headers= 1; # remove existing X-Virus-Scanned
  80. $remove_existing_spam_headers  = 1;     # remove existing spam headers if
  81. $allow_fixing_improper_header_folding = 1;  # (default is true)
  82. @keep_decoded_original_maps = (new_RE(
  83.   qr'^MAIL-UNDECIPHERABLE$',  # retain full mail if it contains undecipherables
  84.   qr'^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)'i,
  85. ));
  86. $banned_filename_re = new_RE(
  87. qr'^\.(exe|lha|cab|dll)$',         # banned file(1) types
  88. [ qr'^\.(gz|bz2)$'             => 0 ],  # allow any in gzip or bzip2
  89.   qr'.\.(pif|scr)$'i,                     # banned extensions - rudimentary
  90. [ qr'^\.(zip|rar|arc|arj|zoo)$'=> 0 ],  # allow any within these archives
  91.   qr'^application/x-msdownload$'i,        # block these MIME types
  92.   qr'^application/x-msdos-program$'i,
  93.   qr'^application/hta$'i,
  94.   qr'\.[^./]*[A-Za-z][^./]*\.\s*(exe|vbs|pif|scr|bat|cmd|com|cpl|dll)[.\s]*$'i,
  95.   qr'\{[0-9a-z]{4,}(-[0-9a-z]{4,}){0,7}\}?'i, # Class ID extension CLSID, loose
  96.   qr'.\.(exe|vbs|pif|scr|cpl|bat|cmd|com)$'i, # banned extension - basic+cmd
  97.   qr'.\.(ade|adp|app|bas|bat|chm|cmd|com|cpl|crt|emf|exe|fxp|grp|hlp|hta|
  98.        inf|ins|isp|js|jse|lnk|mda|mdb|mde|mdw|mdt|mdz|msc|msi|msp|mst|
  99.        ops|pcd|pif|prg|reg|scr|sct|shb|shs|vb|vbe|vbs|
  100.        wmf|wsc|wsf|wsh)$'ix,  # banned ext - long
  101. );
  102.   $banned_namepath_re = undef;  # to disable new-style
  103. %banned_rules = (
  104.   'MYNETS-DEFAULT' => new_RE(   # permissive set of rules for internal hosts
  105.     [ qr'^\.(rpm|cpio|tar)$' => 0 ],  # allow any name/type in Unix archives
  106.     qr'.\.(vbs|pif|scr)$'i,     # banned extension - rudimentary
  107.   ),
  108.   'DEFAULT' => $banned_filename_re,
  109. );
  110. $localpart_is_case_sensitive = 0;       # (default is false)
  111. $MAXLEVELS = 20;                # (default is undef, no limit)
  112. $MAXFILES = 1500;               # (default is undef, no limit)
  113. $MIN_EXPANSION_QUOTA =      100*1024;  # bytes  (default undef, not enforced)
  114. $MAX_EXPANSION_QUOTA = 300*1024*1024;  # bytes  (default undef, not enforced)
  115. $MIN_EXPANSION_FACTOR =   5;  # times original mail size  (default is 5)
  116. $MAX_EXPANSION_FACTOR = 500;  # times original mail size  (default is 500)
  117. $virus_check_negative_ttl=  3*60; # time to remember that mail was not infected
  118. $virus_check_positive_ttl= 30*60; # time to remember that mail was infected
  119. $spam_check_negative_ttl = 10*60; # time to remember that mail was not spam
  120. $spam_check_positive_ttl = 30*60; # time to remember that mail was spam
  121. $path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin:/opt/bin';
  122. $file   = 'file';   # file(1) utility; use 3.41 or later to avoid vulnerability
  123.  
  124. ######## to get amavisd-new "unpacking" archives for analysis, you may have to emerge
  125. ######## one or more packages in order to get all of these present on your system. Whenever you
  126. ######## start up amavisd, it should tell you in the logs which of these are missing. Emerge accordingly
  127.  
  128. @decoders = (
  129.   ['mail', \&do_mime_decode],
  130.   ['asc',  \&do_ascii],
  131.   ['uue',  \&do_ascii],
  132.   ['hqx',  \&do_ascii],
  133.   ['ync',  \&do_ascii],
  134.   ['F',    \&do_uncompress, ['unfreeze','freeze -d','melt','fcat'] ],
  135.   ['Z',    \&do_uncompress, ['uncompress','gzip -d','zcat'] ],
  136.   ['gz',   \&do_uncompress,  'gzip -d'],
  137.   ['gz',   \&do_gunzip],
  138.   ['bz2',  \&do_uncompress,  'bzip2 -d'],
  139.   ['lzo',  \&do_uncompress,  'lzop -d'],
  140.   ['rpm',  \&do_uncompress, ['rpm2cpio.pl','rpm2cpio'] ],
  141.   ['cpio', \&do_pax_cpio,   ['pax','gcpio','cpio'] ],
  142.   ['tar',  \&do_pax_cpio,   ['pax','gcpio','cpio'] ],
  143.   ['deb',  \&do_ar,          'ar'],
  144.   ['zip',  \&do_unzip],
  145.   ['7z',   \&do_7zip,       ['7zr','7za','7z'] ],
  146.   ['rar',  \&do_unrar,      ['rar','unrar'] ],
  147.   ['arj',  \&do_unarj,      ['arj','unarj'] ],
  148.   ['arc',  \&do_arc,        ['nomarch','arc'] ],
  149.   ['zoo',  \&do_zoo,        ['zoo','unzoo'] ],
  150.   ['lha',  \&do_lha,         'lha'],
  151.   ['cab',  \&do_cabextract,  'cabextract'],
  152.   ['tnef', \&do_tnef_ext,    'tnef'],
  153.   ['tnef', \&do_tnef],
  154.   ['exe',  \&do_executable, ['rar','unrar'], 'lha', ['arj','unarj'] ],
  155. );
  156. $sa_local_tests_only = 0;   # only tests which do not require internet access?
  157. $sa_mail_body_size_limit = 400*1024; # don't waste time on SA if mail is larger
  158.                             # (less than 1% of spam is > 64k)
  159.                             # default: undef, no limitations
  160. $sa_tag_level_deflt  = 1.0; # add spam info headers if at, or above that level;
  161.                             # undef is interpreted as lower than any spam level
  162.  
  163. ########change this as needed
  164. ########since I simply let users handle their own spam, instead of quarantining the message, I can
  165. ########afford to do an aggressively low score here. Normal should be 5.0 - 6.0
  166. $sa_tag2_level_deflt = 4.0 ;# add 'spam detected' headers at that level to
  167.                             # passed mail, adding address extensions;
  168.                             # at or above that level: bounce/reject/drop,
  169.                             # quarantine
  170.  
  171. #############change this next line as needed. This is the score above which the message is quarantined in the DB, rather than
  172. #############tagged as [SPAM] and put into the user's inbox
  173. $sa_kill_level_deflt = 8.0;
  174. $sa_dsn_cutoff_level = 9;   # spam level beyond which a DSN is not sent,
  175.                             # effectively turning D_BOUNCE into D_DISCARD;
  176.                             # undef disables this feature and is a default;
  177. $penpals_bonus_score = 5;
  178.  $penpals_halflife = 10*24*60*60;
  179.  $penpals_threshold_low = 1.0; # no need for pen pals lookup on low spam score
  180.  $penpals_threshold_high = $sa_kill_level_deflt; # don't waste time on hi spam
  181. $sa_spam_subject_tag = '[SPAM] ';       # (defaults to undef, disabled)
  182. @spam_subject_tag_maps  = ('[SUSPECT SPAM] _SCORE_ ');
  183. @spam_subject_tag2_maps = ('[SPAM] _SCORE_ (_REQD_) ');
  184. @spam_subject_tag3_maps = ('[EXPLICIT SPAM] _SCORE_ (_REQD_) ');
  185. $sa_spam_modifies_subj = 1; # in @spam_modifies_subj_maps, default is true
  186. $first_infected_stops_scan = 1;  # default is false, all scanners in a section
  187. @av_scanners = (
  188. ['ClamAV-clamd',
  189. \&ask_daemon, ["CONTSCAN {}\n", "/var/amavis/clamd.sock"],
  190.   qr/\bOK$/, qr/\bFOUND$/,
  191.   qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
  192. );
  193. ############ change @storage_sql_dsn next line as needed
  194. ############ you will need to create the 'amavis' database first, and create its tables, using mysqladmin and mysql (respectively)
  195. ############ the code/syntax for this database is on the 'gentoo mailfilter' page, under "Code Listing 9.2: MySQL table layout"
  196. ############ once it's made, you should fire up 'mysql', login, then
  197. ############ "grant all privileges on amavis.* to 'amavis'@'localhost' identified by 'somepassword'"
  198. ############ and then do a "flush privileges"
  199. @storage_sql_dsn = ( ['DBI:mysql:amavis:localhost', 'amavis', 'somepassword']  );
  200. $quarantine_subdir_levels = 1;  # add level of subdirs to disperse quarantine
  201.  
  202. ############## change the next 4 lines as needed. As set now, only viruses, banned files, malformed emails,
  203. ############## and spam scoring higher than 9.0, gets sent to the database. Otherwise, I just tag it and send it to the user
  204. $virus_quarantine_method          = 'sql:';
  205. $spam_quarantine_method           = 'sql:';
  206. $banned_files_quarantine_method   = 'sql:';
  207. $bad_header_quarantine_method     = 'sql:';
  208. 1;  # insure a defined return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement