Advertisement
myunixman

50-user

Nov 22nd, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.00 KB | None | 0 0
  1. use strict;
  2.  
  3. #
  4. # Place your configuration directives here. They will override those in
  5. # earlier files.
  6. #
  7. # See /usr/share/doc/amavisd-new/ for documentation and examples of
  8. # the directives you can use in this file
  9. #
  10.  
  11.  
  12. #------------ Do not modify anything below this line -------------
  13.  
  14. #---------------------------Fuck you!-----------------------------
  15. #{1}
  16. @local_domains_acl = ( ".$mydomain" );
  17. chomp($mydomain = "my.domain.ru"); # тут реальное доменное имя
  18. @local_domains_maps = 1;
  19. @mynetworks = qw( 127.0.0.0/8 [::1] [FE80::]/10 [FEC0::]/10
  20. 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 46.228.5.# 46.228.5.# ); # замазал айпи
  21.  
  22. # listen on multiple TCP ports. 9998 is used for releasing quarantined mails.
  23. $inet_socket_port = [10024, 9998,];
  24.  
  25. # Enable virus check.
  26. @bypass_virus_checks_maps = (
  27. \%bypass_virus_checks,
  28. \@bypass_virus_checks_acl,
  29. $bypass_virus_checks_re,
  30. );
  31.  
  32. # Enable spam check.
  33. @bypass_spam_checks_maps = (
  34. \%bypass_spam_checks,
  35. \@bypass_spam_checks_acl,
  36. $bypass_spam_checks_re,
  37. );
  38.  
  39. $virus_admin = "root\@$mydomain"; # due to D_DISCARD default
  40. $mailfrom_notify_admin = "root\@$mydomain";
  41. $mailfrom_notify_recip = "root\@$mydomain";
  42. $mailfrom_notify_spamadmin = "root\@$mydomain";
  43.  
  44. # Mail notify.
  45. $mailfrom_notify_admin = "root\@$mydomain"; # notifications sender
  46. $mailfrom_notify_recip = "root\@$mydomain"; # notifications sender
  47. $mailfrom_notify_spamadmin = "root\@$mydomain"; # notifications sender
  48. $mailfrom_to_quarantine = ''; # null return path; uses original sender if undef
  49.  
  50. # Disable defang banned mail.
  51. $defang_banned = 0; # MIME-wrap passed mail containing banned name
  52.  
  53. $policy_bank{'MYNETS'} = { # mail originating from @mynetworks
  54. originating => 1, # is true in MYNETS by default, but let's make it explicit
  55. os_fingerprint_method => undef, # don't query p0f for internal clients
  56. allow_disclaimers => 1, # enables disclaimer insertion if available
  57. };
  58.  
  59. $policy_bank{'ORIGINATING'} = { # mail supposedly originating from our users
  60. originating => 1, # declare that mail was submitted by our smtp client
  61. allow_disclaimers => 1, # enables disclaimer insertion if available
  62. # notify administrator of locally originating malware
  63. virus_admin_maps => ["root\@$mydomain"],
  64. spam_admin_maps => ["root\@$mydomain"],
  65. warnbadhsender => 0,
  66. warnbannedsender => 0,
  67. warnvirussender => 1,
  68. warnspamsender => 1,
  69. # forward to a smtpd service providing DKIM signing service
  70. #forward_method => 'smtp:[amavis]:10027',
  71. # force MTA conversion to 7-bit (e.g. before DKIM signing)
  72. smtpd_discard_ehlo_keywords => ['8BITMIME'],
  73. #bypass_banned_checks_maps => [1], # allow sending any file names and types
  74. terminate_dsn_on_notify_success => 0, # don't remove NOTIFY=SUCCESS option
  75. };
  76.  
  77. # SpamAssassin debugging. Default if off(0).
  78. # Note: '$log_level' variable above is required for SA debug.
  79. $log_level = 0; # verbosity 0..5, -d
  80. $sa_debug = 0;
  81.  
  82. # Set hostname.
  83. $myhostname = "mail.flagmax.ru";
  84.  
  85. # Set listen IP/PORT.
  86. $notify_method = 'smtp:[127.0.0.1]:10025';
  87. $forward_method = 'smtp:[127.0.0.1]:10025';
  88.  
  89. # Set default action.
  90. # Available actions: D_PASS, D_BOUNCE, D_REJECT, D_DISCARD.
  91. $final_virus_destiny = D_DISCARD;
  92. $final_banned_destiny = D_PASS;
  93. $final_spam_destiny = D_PASS;
  94. $final_bad_header_destiny = D_PASS;
  95.  
  96. @av_scanners = (
  97.  
  98. #### http://www.clamav.net/
  99. ['ClamAV-clamd',
  100. \&ask_daemon, ["CONTSCAN {}\n", "/tmp/clamd.socket"],
  101. qr/\bOK$/, qr/\bFOUND$/,
  102. qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
  103. );
  104.  
  105. @av_scanners_backup = (
  106.  
  107. ### http://www.clamav.net/ - backs up clamd or Mail::ClamAV
  108. ['ClamAV-clamscan', 'clamscan',
  109. "--stdout --disable-summary -r --tempdir=$TEMPBASE {}", [0], [1],
  110. qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
  111. );
  112.  
  113. # This policy will perform virus checks only.
  114. #$interface_policy{'10026'} = 'VIRUSONLY';
  115. #$policy_bank{'VIRUSONLY'} = { # mail from the pickup daemon
  116. # bypass_spam_checks_maps => [1], # don't spam-check this mail
  117. # bypass_banned_checks_maps => [1], # don't banned-check this mail
  118. # bypass_header_checks_maps => [1], # don't header-check this mail
  119. #};
  120.  
  121. # Allow SASL authenticated users to bypass scanning. Typically SASL
  122. # users already submit messages to the submission port (587) or the
  123. # smtps port (465):
  124. #$interface_policy{'10026'} = 'SASLBYPASS';
  125. #$policy_bank{'SASLBYPASS'} = { # mail from submission and smtps ports
  126. # bypass_spam_checks_maps => [1], # don't spam-check this mail
  127. # bypass_banned_checks_maps => [1], # don't banned-check this mail
  128. # bypass_header_checks_maps => [1], # don't header-check this mail
  129. #};
  130.  
  131. # Apply to mails which coming from internal networks or authenticated
  132. # roaming users.
  133. # mail supposedly originating from our users
  134. $policy_bank{'MYUSERS'} = {
  135. # declare that mail was submitted by our smtp client
  136. originating => 1,
  137.  
  138. # enables disclaimer insertion if available
  139. allow_disclaimers => 1,
  140.  
  141. # notify administrator of locally originating malware
  142. virus_admin_maps => ["root\@$mydomain"],
  143. spam_admin_maps => ["root\@$mydomain"],
  144.  
  145. # forward to a smtpd service providing DKIM signing service
  146. #forward_method => 'smtp:[127.0.0.1]:10027',
  147.  
  148. # force MTA conversion to 7-bit (e.g. before DKIM signing)
  149. smtpd_discard_ehlo_keywords => ['8BITMIME'],
  150.  
  151. # don't remove NOTIFY=SUCCESS option
  152. terminate_dsn_on_notify_success => 0,
  153.  
  154. # don't perform spam/virus/header check.
  155. #bypass_spam_checks_maps => [1],
  156. #bypass_virus_checks_maps => [1],
  157. #bypass_header_checks_maps => [1],
  158.  
  159. # allow sending any file names and types
  160. #bypass_banned_checks_maps => [1],
  161.  
  162. # Quarantine clean messages
  163. #clean_quarantine_method => 'sql:',
  164. #final_destiny_by_ccat => {CC_CLEAN, D_DISCARD},
  165. };
  166.  
  167. # regular incoming mail, originating from anywhere (usually from outside)
  168. #$policy_bank{'EXT'} = {
  169. # # just use global settings, no special overrides
  170. #};
  171.  
  172. #
  173. # Port used to release quarantined mails.
  174. #
  175. $interface_policy{'9998'} = 'AM.PDP-INET';
  176. $policy_bank{'AM.PDP-INET'} = {
  177. protocol => 'AM.PDP', # select Amavis policy delegation protocol
  178. inet_acl => [qw( 127.0.0.1 [::1] )], # restrict access to these IP addresses
  179. auth_required_release => 1, # 0 - don't require secret_id for amavisd-release
  180. #log_level => 4,
  181. #always_bcc_by_ccat => {CC_CLEAN, 'admin@example.com'},
  182. };
  183.  
  184. #########################
  185. # Quarantine mails.
  186. #
  187.  
  188. # Don't quarantine mails with bad header.
  189. $bad_header_quarantine_method = undef;
  190.  
  191. # Quarantine SPAM.
  192. # Where to store quarantined mail message:
  193. # - 'local:spam-%i-%m', quarantine mail on local file system.
  194. # - 'sql:', quarantine mail in SQL server specified in @storage_sql_dsn.
  195. # - undef, do not quarantine mail.
  196. $spam_quarantine_method = undef;
  197. #$spam_quarantine_method = 'sql:';
  198. #$spam_quarantine_to = 'spam-quarantine';
  199.  
  200. #########################
  201. # Quarantine VIRUS mails.
  202. #
  203. #$virus_quarantine_to = 'virus-quarantine';
  204. #$virus_quarantine_method = 'sql:';
  205.  
  206. #########################
  207. # Quarantine BANNED mails.
  208. #
  209. $banned_files_quarantine_method = undef;
  210. # Or quarantine banned mail to SQL server.
  211. #$banned_files_quarantine_method = 'sql:';
  212. #$banned_quarantine_to = 'banned-quarantine';
  213.  
  214. #########################
  215. # Quarantine CLEAN mails.
  216. # Don't forget to enable clean quarantine in policy bank 'MYUSERS'.
  217. #
  218. # = 'sql:';
  219. # = 'clean-quarantine';
  220.  
  221. # Modify email subject, add '$sa_spam_subject_tag'.
  222. # 0: disable
  223. # 1: enable
  224. $sa_spam_modifies_subj = 1;
  225.  
  226. # remove existing headers
  227. #$remove_existing_x_scanned_headers= 0;
  228. #$remove_existing_spam_headers = 0;
  229.  
  230. # Leave empty (undef) to add no header.
  231. # Modify /usr/sbin/amavisd or /usr/sbin/amavisd-new file to add customize header in:
  232. #
  233. # sub add_forwarding_header_edits_per_recip
  234. #
  235. $X_HEADER_TAG = 'X-Virus-Scanned';
  236. #$X_HEADER_LINE = "by amavisd at $myhostname";
  237.  
  238. # Notify virus sender?
  239. #$warnvirussender = 0;
  240.  
  241. # Notify spam sender?
  242. #$warnspamsender = 0;
  243.  
  244. # Notify sender of banned files?
  245. $warnbannedsender = 0;
  246.  
  247. # Notify sender of syntactically invalid header containing non-ASCII characters?
  248. $warnbadhsender = 0;
  249.  
  250. # Notify virus (or banned files) RECIPIENT?
  251. # (not very useful, but some policies demand it)
  252. $warnvirusrecip = 0;
  253. $warnbannedrecip = 0;
  254.  
  255. # Notify also non-local virus/banned recipients if $warn*recip is true?
  256. # (including those not matching local_domains*)
  257. $warn_offsite = 0;
  258.  
  259. #$notify_sender_templ = read_text('/var/amavis/notify_sender.txt');
  260. #$notify_virus_sender_templ= read_text('/var/amavis/notify_virus_sender.txt');
  261. #$notify_virus_admin_templ = read_text('/var/amavis/notify_virus_admin.txt');
  262. #$notify_virus_recips_templ= read_text('/var/amavis/notify_virus_recips.txt');
  263. #$notify_spam_sender_templ = read_text('/var/amavis/notify_spam_sender.txt');
  264. #$notify_spam_admin_templ = read_text('/var/amavis/notify_spam_admin.txt');
  265.  
  266. $sql_allow_8bit_address = 1;
  267. $timestamp_fmt_mysql = 1;
  268.  
  269. # a string to prepend to Subject (for local recipients only) if mail could
  270. # not be decoded or checked entirely, e.g. due to password-protected archives
  271. #$undecipherable_subject_tag = '***UNCHECKED*** '; # undef disables it
  272. $undecipherable_subject_tag = undef;
  273. # Hope to fix 'nested MAIL command' issue on high load server.
  274. $smtp_connection_cache_enable = 0;
  275.  
  276. # The default set of header fields to be signed can be controlled
  277. # by setting %signed_header_fields elements to true (to sign) or
  278. # to false (not to sign). Keys must be in lowercase, e.g.:
  279. # 0 -> off
  280. # 1 -> on
  281. $signed_header_fields{'received'} = 0;
  282. $signed_header_fields{'to'} = 1;
  283.  
  284. # Make sure it sings all inbound mails, avoid error log like this:
  285. # 'dkim: not signing inbound mail'.
  286. $originating = 1;
  287.  
  288. # Add dkim_key here.
  289. dkim_key("flagmax.ru", "dkim", "/var/lib/dkim/flagmax.ru.pem");
  290.  
  291. # Note that signing mail for subdomains with a key of a parent
  292. # domain is treated by recipients as a third-party key, which
  293. # may 'hold less merit' in their eyes. If one has a choice,
  294. # it is better to publish a key for each domain (e.g. host1.a.cn)
  295. # if mail is really coming from it. Sharing a pem file
  296. # for multiple domains may be acceptable, so you don't need
  297. # to generate a different key for each subdomain, but you
  298. # do need to publish it in each subdomain. It is probably
  299. # easier to avoid sending addresses like host1.a.cn and
  300. # always use a parent domain (a.cn) in 'From:', thus
  301. # avoiding the issue altogether.
  302. #dkim_key("host1.flagmax.ru", "dkim", "/var/lib/dkim/flagmax.ru.pem");
  303. #dkim_key("host3.flagmax.ru", "dkim", "/var/lib/dkim/flagmax.ru.pem");
  304.  
  305. # Add new dkim_key for other domain.
  306. #dkim_key('Your_New_Domain_Name', 'dkim', 'Your_New_Pem_File');
  307.  
  308. @dkim_signature_options_bysender_maps = ( {
  309. # ------------------------------------
  310. # For domain: flagmax.ru.
  311. # ------------------------------------
  312. # 'd' defaults to a domain of an author/sender address,
  313. # 's' defaults to whatever selector is offered by a matching key
  314.  
  315. #'postmaster@flagmax.ru' => { d => "flagmax.ru", a => 'rsa-sha256', ttl => 7*24*3600 },
  316. #"spam-reporter@flagmax.ru" => { d => "flagmax.ru", a => 'rsa-sha256', ttl => 7*24*3600 },
  317.  
  318. # explicit 'd' forces a third-party signature on foreign (hosted) domains
  319. "flagmax.ru" => { d => "flagmax.ru", a => 'rsa-sha256', ttl => 10*24*3600 },
  320. #"host1.flagmax.ru" => { d => "host1.flagmax.ru", a => 'rsa-sha256', ttl => 10*24*3600 },
  321. #"host2.flagmax.ru" => { d => "host2.flagmax.ru", a => 'rsa-sha256', ttl => 10*24*3600 },
  322. # ---- End domain: flagmax.ru ----
  323.  
  324. # catchall defaults
  325. '.' => { a => 'rsa-sha256', c => 'relaxed/simple', ttl => 30*24*3600 },
  326. } );
  327. $enable_dkim_verification = 0; # enable DKIM signatures verification
  328. $enable_dkim_signing = 0; # load DKIM signing code, keys defined by dkim_key
  329. # ------------ Disclaimer Setting ---------------
  330. # Uncomment this line to enable singing disclaimer in outgoing mails.
  331. #$defang_maps_by_ccat{+CC_CATCHALL} = [ 'disclaimer' ];
  332.  
  333. # Program used to signing disclaimer in outgoing mails.
  334. $altermime = '/usr/bin/altermime';
  335.  
  336. # Disclaimer in plain text formart.
  337. @altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.txt --force-for-bad-html);
  338.  
  339. @disclaimer_options_bysender_maps = ({
  340. # Per-domain disclaimer setting: /etc/postfix/disclaimer/host1.iredmail.org.txt
  341. #'host1.iredmail.org' => 'host1.iredmail.org',
  342.  
  343. # Sub-domain disclaimer setting: /etc/postfix/disclaimer/iredmail.org.txt
  344. #'.iredmail.org' => 'iredmail.org',
  345.  
  346. # Per-user disclaimer setting: /etc/postfix/disclaimer/boss.iredmail.org.txt
  347. #'boss@iredmail.org' => 'boss.iredmail.org',
  348.  
  349. # Catch-all disclaimer setting: /etc/postfix/disclaimer/default.txt
  350. '.' => 'default',
  351. },);
  352. # ------------ End Disclaimer Setting ---------------
  353. @storage_sql_dsn = (
  354. ['DBI:mysql:database=amavisd;host=127.0.0.1;port=3306', 'amavisd', 'SoVptjBl7tSSWHzYwQSqWehDKH2ILV'],
  355. );
  356. # Uncomment below two lines to lookup virtual mail domains from MySQL database.
  357. #@lookup_sql_dsn = (
  358. # ['DBI:mysql:database=vmail;host=127.0.0.1;port=3306', 'vmail', 'xcceOhyEpJCs7t8pRwCpm3amFQFtmj'],
  359. #);
  360. # For Amavisd-new-2.7.0 and later versions. Placeholder '%d' is available in Amavisd-2.7.0+.
  361. #$sql_select_policy = "SELECT domain FROM domain WHERE domain='%d'";
  362.  
  363. # For Amavisd-new-2.6.x.
  364. # WARNING: IN() may cause MySQL lookup performance issue.
  365. #$sql_select_policy = "SELECT domain FROM domain WHERE CONCAT('@', domain) IN (%k)";
  366. delete $admin_maps_by_ccat{&CC_UNCHECKED};
  367.  
  368. # Num of pre-forked children.
  369. # WARNING: it must match (equal to or larger than) the number set in
  370. # /etc/postfix/master.cf "maxproc" column for the 'smtp-amavis' service.
  371. $max_servers = 10;
  372. $sa_tag_level_deflt = -9999; # always add spam info headers
  373. $sa_tag2_level_deflt = 5.0;
  374. $sa_spam_subject_tag = '***SPAM*** ';
  375. 1; # insure a defined return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement