recreate
This commit is contained in:
@@ -0,0 +1,663 @@
|
||||
use strict;
|
||||
|
||||
# controls running of anti-virus/spam code: 0 -> enabled, 1 -> disabled.
|
||||
@bypass_virus_checks_maps = (0);
|
||||
@bypass_spam_checks_maps = (0);
|
||||
# $bypass_decode_parts = 1; # controls running of decoders&dearchivers
|
||||
|
||||
$daemon_user = 'PH_SYS_USER_AMAVISD';
|
||||
$daemon_group = 'PH_SYS_GROUP_AMAVISD';
|
||||
|
||||
# Set hostname.
|
||||
$myhostname = 'PH_HOSTNAME';
|
||||
$mydomain = $myhostname;
|
||||
$localhost_name = $myhostname;
|
||||
|
||||
#
|
||||
# NOTE: $MYHOME/{tmp,var,db} must be created manually
|
||||
#
|
||||
$MYHOME = 'PH_AMAVISD_SPOOL_DIR';
|
||||
$TEMPBASE = 'PH_AMAVISD_TEMP_DIR'; # working directory, needs to exist, -T
|
||||
$ENV{TMPDIR} = $TEMPBASE; # environment variable TMPDIR, used by SA, etc.
|
||||
$db_home = 'PH_AMAVISD_DB_DIR'; # dir for bdb nanny/cache/snmp databases, -D
|
||||
$QUARANTINEDIR = 'PH_AMAVISD_QUARANTINE_DIR'; # -Q
|
||||
$quarantine_subdir_levels = 2; # add level of subdirs to disperse quarantine
|
||||
# $release_format = 'resend'; # 'attach', 'plain', 'resend'
|
||||
# $report_format = 'arf'; # 'attach', 'plain', 'resend', 'arf'
|
||||
# $daemon_chroot_dir = $MYHOME; # chroot directory or undef, -R
|
||||
# $helpers_home = "$MYHOME/var"; # working directory for SpamAssassin, -S
|
||||
|
||||
$lock_file = 'PH_AMAVISD_LOCK_FILE'; # -L
|
||||
$pid_file = 'PH_AMAVISD_PID_FILE'; # -P
|
||||
|
||||
@local_domains_maps = 1;
|
||||
@mynetworks = qw( 127.0.0.0/8 [::1] PH_LOCAL_ADDRESS );
|
||||
|
||||
# Socket file, used by amavisd-release or amavis-milter.
|
||||
$unix_socketname = 'PH_AMAVISD_SOCKET_FILE';
|
||||
|
||||
#
|
||||
# BDB
|
||||
#
|
||||
$enable_db = 0; # enable use of BerkeleyDB/libdb (SNMP and nanny)
|
||||
$nanny_details_level = 2; # nanny verbosity: 1: traditional, 2: detailed
|
||||
|
||||
$inet_socket_port = [PH_AMAVISD_SMTP_PORT, PH_AMAVISD_ORIGINATING_PORT, PH_AMAVISD_MLMMJ_PORT, PH_AMAVISD_QUARANTINE_PORT];
|
||||
|
||||
$policy_bank{'MYNETS'} = { # mail originating from @mynetworks
|
||||
originating => 1, # is true in MYNETS by default, but let's make it explicit
|
||||
os_fingerprint_method => undef, # don't query p0f for internal clients
|
||||
allow_disclaimers => 1, # enables disclaimer insertion if available
|
||||
enable_dkim_signing => 1,
|
||||
};
|
||||
|
||||
# Postfix will re-route mail from authenticated users to this port.
|
||||
$interface_policy{'PH_AMAVISD_ORIGINATING_PORT'} = 'ORIGINATING';
|
||||
$policy_bank{'ORIGINATING'} = {
|
||||
originating => 1, # declare that mail was submitted by our smtp client
|
||||
allow_disclaimers => 1, # enables disclaimer insertion if available
|
||||
enable_dkim_signing => 1,
|
||||
|
||||
# notify administrator of locally originating malware
|
||||
spam_admin_maps => ["root\@$mydomain"],
|
||||
# notify administrator of locally originating malware
|
||||
virus_admin_maps => ["root\@$mydomain"],
|
||||
spam_admin_maps => ["root\@$mydomain"],
|
||||
bad_header_admin_maps => ["root\@$mydomain"],
|
||||
banned_admin_maps => ["root\@$mydomain"],
|
||||
warnbadhsender => 0,
|
||||
warnbannedsender => 0,
|
||||
|
||||
# force MTA conversion to 7-bit (e.g. before DKIM signing)
|
||||
smtpd_discard_ehlo_keywords => ['8BITMIME'],
|
||||
terminate_dsn_on_notify_success => 0, # don't remove NOTIFY=SUCCESS option
|
||||
|
||||
# Bypass checks
|
||||
#bypass_spam_checks_maps => [1], # don't check spam
|
||||
#bypass_virus_checks_maps => [1], # don't check virus
|
||||
#bypass_banned_checks_maps => [1], # don't check banned file names and types
|
||||
#bypass_header_checks_maps => [1], # don't check bad header
|
||||
};
|
||||
|
||||
$interface_policy{'PH_AMAVISD_MLMMJ_PORT'} = 'MLMMJ';
|
||||
$policy_bank{'MLMMJ'} = {
|
||||
originating => 1, # declare that mail was submitted by our smtp client
|
||||
allow_disclaimers => 0, # we use 'mlmmj-amime-receive' program to handle disclaimer/footer
|
||||
enable_dkim_signing => 1, # enable DKIM signing for outbound
|
||||
virus_admin_maps => ["root\@$mydomain"],
|
||||
spam_admin_maps => ["root\@$mydomain"],
|
||||
smtpd_discard_ehlo_keywords => ['8BITMIME'],
|
||||
terminate_dsn_on_notify_success => 0, # don't remove NOTIFY=SUCCESS option
|
||||
# re-inject processed email to Postfix, with address mapping enabled.
|
||||
forward_method => 'smtp:[PH_LOCAL_ADDRESS]:PH_POSTFIX_MLMMJ_REINJECT_PORT',
|
||||
# Amavisd performs the checks for email sent to mailing list, so no need to
|
||||
# check again for outbound.
|
||||
bypass_spam_checks_maps => [1], # don't check spam
|
||||
bypass_virus_checks_maps => [1], # don't check virus
|
||||
bypass_banned_checks_maps => [1], # don't check banned file names and types
|
||||
bypass_header_checks_maps => [1], # don't check bad header
|
||||
};
|
||||
|
||||
$interface_policy{'SOCK'} = 'AM.PDP-SOCK'; # only applies with $unix_socketname
|
||||
|
||||
# Use with amavis-release over a socket or with Petr Rehor's amavis-milter.c
|
||||
# (with amavis-milter.c from this package or old amavis.c client use 'AM.CL'):
|
||||
$policy_bank{'AM.PDP-SOCK'} = {
|
||||
protocol => 'AM.PDP',
|
||||
auth_required_release => 0, # do not require secret_id for amavisd-release
|
||||
};
|
||||
|
||||
$sa_tag_level_deflt = 2.0; # add spam info headers if at, or above that level
|
||||
$sa_tag2_level_deflt = 6.2; # add 'spam detected' headers at that level
|
||||
$sa_kill_level_deflt = 6.9; # triggers spam evasive actions (e.g. blocks mail)
|
||||
$sa_dsn_cutoff_level = 10; # spam level beyond which a DSN is not sent
|
||||
$sa_crediblefrom_dsn_cutoff_level = 18; # likewise, but for a likely valid From
|
||||
#$sa_quarantine_cutoff_level = 25; # spam level beyond which quarantine is off
|
||||
|
||||
$sa_mail_body_size_limit = 400*1024; # don't waste time on SA if mail is larger
|
||||
$sa_local_tests_only = 0; # only tests which do not require internet access?
|
||||
|
||||
$virus_admin = undef; # notifications recip.
|
||||
|
||||
$mailfrom_notify_admin = undef; # notifications sender
|
||||
$mailfrom_notify_recip = undef; # notifications sender
|
||||
$mailfrom_notify_spamadmin = undef; # notifications sender
|
||||
$mailfrom_to_quarantine = ''; # null return path; uses original sender if undef
|
||||
|
||||
@addr_extension_virus_maps = ('virus');
|
||||
@addr_extension_banned_maps = ('banned');
|
||||
@addr_extension_spam_maps = ('spam');
|
||||
@addr_extension_bad_header_maps = ('badh');
|
||||
# $recipient_delimiter = '+'; # undef disables address extensions altogether
|
||||
# when enabling addr extensions do also Postfix/main.cf: recipient_delimiter=+
|
||||
|
||||
$path = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/sbin:/usr/bin:/bin';
|
||||
# $dspam = 'dspam';
|
||||
|
||||
$MAXLEVELS = 14;
|
||||
$MAXFILES = 3000;
|
||||
$MIN_EXPANSION_QUOTA = 100*1024; # bytes (default undef, not enforced)
|
||||
$MAX_EXPANSION_QUOTA = 500*1024*1024; # bytes (default undef, not enforced)
|
||||
|
||||
# Prepend '[SPAM] ' to subject of spam message.
|
||||
$sa_spam_modifies_subj = 1;
|
||||
$sa_spam_subject_tag = '[SPAM] ';
|
||||
|
||||
$defang_virus = 1; # MIME-wrap passed infected mail
|
||||
$defang_banned = 0; # MIME-wrap passed mail containing banned name
|
||||
# for defanging bad headers only turn on certain minor contents categories:
|
||||
$defang_by_ccat{CC_BADH.",3"} = 1; # NUL or CR character in header
|
||||
$defang_by_ccat{CC_BADH.",5"} = 1; # header line longer than 998 characters
|
||||
$defang_by_ccat{CC_BADH.",6"} = 1; # header field syntax error
|
||||
|
||||
@keep_decoded_original_maps = (new_RE(
|
||||
# let virus scanner (clamav) see full original message (can be slow)
|
||||
# this setting is required if we're going to use third-party clamav
|
||||
# signatures. for example, Sanesecurity signatures.
|
||||
# FYI: http://sanesecurity.com/support/signature-testing/
|
||||
#qr'^MAIL$',
|
||||
|
||||
qr'^MAIL-UNDECIPHERABLE$', # same as ^MAIL$ if mail is undecipherable
|
||||
qr'^(ASCII(?! cpio)|text|uuencoded|xxencoded|binhex)'i,
|
||||
#qr'^Zip archive data', # don't trust Archive::Zip
|
||||
));
|
||||
|
||||
$banned_filename_re = new_RE(
|
||||
|
||||
### BLOCKED ANYWHERE
|
||||
# qr'^UNDECIPHERABLE$', # is or contains any undecipherable components
|
||||
qr'^\.(exe-ms|dll)$', # banned file(1) types, rudimentary
|
||||
# qr'^\.(exe|lha|cab|dll)$', # banned file(1) types
|
||||
|
||||
### BLOCK THE FOLLOWING, EXCEPT WITHIN UNIX ARCHIVES:
|
||||
# [ qr'^\.(gz|bz2)$' => 0 ], # allow any in gzip or bzip2
|
||||
[ qr'^\.(rpm|cpio|tar)$' => 0 ], # allow any in Unix-type archives
|
||||
|
||||
qr'.\.(pif|scr)$'i, # banned extensions - rudimentary
|
||||
# qr'^\.zip$', # block zip type
|
||||
|
||||
### BLOCK THE FOLLOWING, EXCEPT WITHIN ARCHIVES:
|
||||
# [ qr'^\.(zip|rar|arc|arj|zoo)$'=> 0 ], # allow any within these archives
|
||||
|
||||
qr'^application/x-msdownload$'i, # block these MIME types
|
||||
qr'^application/x-msdos-program$'i,
|
||||
qr'^application/hta$'i,
|
||||
|
||||
# qr'^message/partial$'i, # rfc2046 MIME type
|
||||
# qr'^message/external-body$'i, # rfc2046 MIME type
|
||||
|
||||
# qr'^(application/x-msmetafile|image/x-wmf)$'i, # Windows Metafile MIME type
|
||||
# qr'^\.wmf$', # Windows Metafile file(1) type
|
||||
|
||||
# block certain double extensions in filenames
|
||||
qr'^(?!cid:).*\.[^./]*[A-Za-z][^./]*\.\s*(exe|vbs|pif|scr|bat|cmd|com|cpl|dll)[.\s]*$'i,
|
||||
|
||||
# qr'\{[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}\}?'i, # Class ID CLSID, strict
|
||||
# qr'\{[0-9a-z]{4,}(-[0-9a-z]{4,}){0,7}\}?'i, # Class ID extension CLSID, loose
|
||||
|
||||
qr'.\.(exe|vbs|pif|scr|cpl)$'i, # banned extension - basic
|
||||
# qr'.\.(exe|vbs|pif|scr|cpl|bat|cmd|com)$'i, # banned extension - basic+cmd
|
||||
# qr'.\.(ade|adp|app|bas|bat|chm|cmd|com|cpl|crt|emf|exe|fxp|grp|hlp|hta|
|
||||
# inf|ini|ins|isp|js|jse|lib|lnk|mda|mdb|mde|mdt|mdw|mdz|msc|msi|
|
||||
# msp|mst|ocx|ops|pcd|pif|prg|reg|scr|sct|shb|shs|sys|vb|vbe|vbs|vxd|
|
||||
# wmf|wsc|wsf|wsh)$'ix, # banned extensions - long
|
||||
# qr'.\.(asd|asf|asx|url|vcs|wmd|wmz)$'i, # consider also
|
||||
# qr'.\.(ani|cur|ico)$'i, # banned cursors and icons filename
|
||||
# qr'^\.ani$', # banned animated cursor file(1) type
|
||||
# qr'.\.(mim|b64|bhx|hqx|xxe|uu|uue)$'i, # banned extension - WinZip vulnerab.
|
||||
);
|
||||
# See http://support.microsoft.com/default.aspx?scid=kb;EN-US;q262631
|
||||
# and http://www.cknow.com/vtutor/vtextensions.htm
|
||||
|
||||
|
||||
# ENVELOPE SENDER SOFT-WHITELISTING / SOFT-BLACKLISTING
|
||||
|
||||
@score_sender_maps = ({ # a by-recipient hash lookup table,
|
||||
# results from all matching recipient tables are summed
|
||||
|
||||
# ## per-recipient personal tables (NOTE: positive: black, negative: white)
|
||||
# 'user1@example.com' => [{'bla-mobile.press@example.com' => 10.0}],
|
||||
# 'user3@example.com' => [{'.ebay.com' => -3.0}],
|
||||
# 'user4@example.com' => [{'cleargreen@cleargreen.com' => -7.0,
|
||||
# '.cleargreen.com' => -5.0}],
|
||||
|
||||
## site-wide opinions about senders (the '.' matches any recipient)
|
||||
'.' => [ # the _first_ matching sender determines the score boost
|
||||
|
||||
new_RE( # regexp-type lookup table, just happens to be all soft-blacklist
|
||||
[qr'^(bulkmail|offers|cheapbenefits|earnmoney|foryou)@'i => 5.0],
|
||||
[qr'^(greatcasino|investments|lose_weight_today|market\.alert)@'i=> 5.0],
|
||||
[qr'^(money2you|MyGreenCard|new\.tld\.registry|opt-out|opt-in)@'i=> 5.0],
|
||||
[qr'^(optin|saveonlsmoking2002k|specialoffer|specialoffers)@'i => 5.0],
|
||||
[qr'^(stockalert|stopsnoring|wantsome|workathome|yesitsfree)@'i => 5.0],
|
||||
[qr'^(your_friend|greatoffers)@'i => 5.0],
|
||||
[qr'^(inkjetplanet|marketopt|MakeMoney)\d*@'i => 5.0],
|
||||
),
|
||||
|
||||
#read_hash("/var/amavis/sender_scores_sitewide"),
|
||||
|
||||
{ # a hash-type lookup table (associative array)
|
||||
'nobody@cert.org' => -3.0,
|
||||
'cert-advisory@us-cert.gov' => -3.0,
|
||||
'owner-alert@iss.net' => -3.0,
|
||||
'slashdot@slashdot.org' => -3.0,
|
||||
'securityfocus.com' => -3.0,
|
||||
'ntbugtraq@listserv.ntbugtraq.com' => -3.0,
|
||||
'security-alerts@linuxsecurity.com' => -3.0,
|
||||
'mailman-announce-admin@python.org' => -3.0,
|
||||
'amavis-user-admin@lists.sourceforge.net'=> -3.0,
|
||||
'amavis-user-bounces@lists.sourceforge.net' => -3.0,
|
||||
'spamassassin.apache.org' => -3.0,
|
||||
'notification-return@lists.sophos.com' => -3.0,
|
||||
'owner-postfix-users@postfix.org' => -3.0,
|
||||
'owner-postfix-announce@postfix.org' => -3.0,
|
||||
'owner-sendmail-announce@lists.sendmail.org' => -3.0,
|
||||
'sendmail-announce-request@lists.sendmail.org' => -3.0,
|
||||
'donotreply@sendmail.org' => -3.0,
|
||||
'ca+envelope@sendmail.org' => -3.0,
|
||||
'noreply@freshmeat.net' => -3.0,
|
||||
'owner-technews@postel.acm.org' => -3.0,
|
||||
'ietf-123-owner@loki.ietf.org' => -3.0,
|
||||
'cvs-commits-list-admin@gnome.org' => -3.0,
|
||||
'rt-users-admin@lists.fsck.com' => -3.0,
|
||||
'clp-request@comp.nus.edu.sg' => -3.0,
|
||||
'surveys-errors@lists.nua.ie' => -3.0,
|
||||
'emailnews@genomeweb.com' => -5.0,
|
||||
'yahoo-dev-null@yahoo-inc.com' => -3.0,
|
||||
'returns.groups.yahoo.com' => -3.0,
|
||||
'clusternews@linuxnetworx.com' => -3.0,
|
||||
lc('lvs-users-admin@LinuxVirtualServer.org') => -3.0,
|
||||
lc('owner-textbreakingnews@CNNIMAIL12.CNN.COM') => -5.0,
|
||||
|
||||
# soft-blacklisting (positive score)
|
||||
'sender@example.net' => 3.0,
|
||||
'.example.net' => 1.0,
|
||||
|
||||
},
|
||||
], # end of site-wide tables
|
||||
});
|
||||
|
||||
|
||||
@decoders = (
|
||||
['mail', \&do_mime_decode],
|
||||
# [[qw(asc uue hqx ync)], \&do_ascii], # not safe
|
||||
['F', \&do_uncompress, ['unfreeze', 'freeze -d', 'melt', 'fcat'] ],
|
||||
['Z', \&do_uncompress, ['uncompress', 'gzip -d', 'zcat'] ],
|
||||
['gz', \&do_uncompress, 'gzip -d'],
|
||||
['gz', \&do_gunzip],
|
||||
['bz2', \&do_uncompress, 'bzip2 -d'],
|
||||
['xz', \&do_uncompress,
|
||||
['xzdec', 'xz -dc', 'unxz -c', 'xzcat'] ],
|
||||
['lzma', \&do_uncompress,
|
||||
['lzmadec', 'xz -dc --format=lzma',
|
||||
'lzma -dc', 'unlzma -c', 'lzcat', 'lzmadec'] ],
|
||||
['lrz', \&do_uncompress,
|
||||
['lrzip -q -k -d -o -', 'lrzcat -q -k'] ],
|
||||
['lzo', \&do_uncompress, 'lzop -d'],
|
||||
['lz4', \&do_uncompress, ['lz4c -d'] ],
|
||||
['rpm', \&do_uncompress, ['rpm2cpio.pl', 'rpm2cpio'] ],
|
||||
[['cpio','tar'], \&do_pax_cpio, ['pax', 'gcpio', 'cpio'] ],
|
||||
# ['/usr/local/heirloom/usr/5bin/pax', 'pax', 'gcpio', 'cpio']
|
||||
['deb', \&do_ar, 'ar'],
|
||||
# ['a', \&do_ar, 'ar'], # unpacking .a seems an overkill
|
||||
['rar', \&do_unrar, ['unrar', 'rar'] ],
|
||||
['arj', \&do_unarj, ['unarj', 'arj'] ],
|
||||
['arc', \&do_arc, ['nomarch', 'arc'] ],
|
||||
['zoo', \&do_zoo, ['zoo', 'unzoo'] ],
|
||||
# ['doc', \&do_ole, 'ripole'], # no ripole package so far
|
||||
['cab', \&do_cabextract, 'cabextract'],
|
||||
# ['tnef', \&do_tnef_ext, 'tnef'], # use internal do_tnef() instead
|
||||
['tnef', \&do_tnef],
|
||||
# ['lha', \&do_lha, 'lha'], # not safe, use 7z instead
|
||||
# ['sit', \&do_unstuff, 'unstuff'], # not safe
|
||||
[['zip','kmz'], \&do_7zip, ['7za', '7z'] ],
|
||||
[['zip','kmz'], \&do_unzip],
|
||||
['7z', \&do_7zip, ['7zr', '7za', '7z'] ],
|
||||
[[qw(gz bz2 Z tar)],
|
||||
\&do_7zip, ['7za', '7z'] ],
|
||||
[[qw(xz lzma jar cpio arj rar swf lha iso cab deb rpm)],
|
||||
\&do_7zip, '7z' ],
|
||||
['exe', \&do_executable, ['unrar','rar'], 'lha', ['unarj','arj'] ],
|
||||
);
|
||||
|
||||
$notify_method = 'smtp:[PH_LOCAL_ADDRESS]:PH_POSTFIX_MAIL_REINJECT_PORT';
|
||||
$forward_method = 'smtp:[PH_LOCAL_ADDRESS]:PH_POSTFIX_MAIL_REINJECT_PORT';
|
||||
|
||||
# Mark Spam/Virus with third-party clamav signatures: SaneSecurity.
|
||||
# *) The order matters, first match wins. Set to 'undef' to keep as infected
|
||||
# *) Anything declared as undefined will be marked as a virus
|
||||
@virus_name_to_spam_score_maps =(new_RE(
|
||||
# SaneSecurity + Foxhole
|
||||
[ qr'^Sanesecurity\.(Malware|Badmacro|Foxhole|Rogue|Trojan)\.' => undef ],
|
||||
[ qr'^Sanesecurity\.MalwareHash\.' => undef ],
|
||||
[ qr'^Sanesecurity.TestSig_' => undef ],
|
||||
[ qr'^Sanesecurity\.' => 0.1 ],
|
||||
|
||||
# winnow
|
||||
[ qr'^winnow\.(Exploit|Trojan|malware)\.' => undef ],
|
||||
[ qr'^winnow\.(botnet|compromised|trojan)' => undef ],
|
||||
[ qr'^winnow\.(exe|ms|JS)\.' => undef ],
|
||||
[ qr'^winnow\.phish\.' => 3.0 ],
|
||||
[ qr'^winnow\.' => 0.1 ],
|
||||
|
||||
# bofhland
|
||||
[ qr'^Bofhland\.Malware\.' => undef ],
|
||||
[ qr'^BofhlandMWFile' => undef ],
|
||||
[ qr'^Bofhland\.Phishing\.' => 3.0 ],
|
||||
[ qr'^Bofhland\.' => 0.1 ],
|
||||
|
||||
# porcupine.ndb
|
||||
[ qr'^Porcupine\.(Malware|Trojan)\.' => undef ],
|
||||
[ qr'^Porcupine\.(Junk|Spammer)\.' => 3.0 ],
|
||||
[ qr'^Porcupine\.Phishing\.' => 3.0 ],
|
||||
[ qr'^Porcupine\.' => 0.01 ],
|
||||
|
||||
# phishtank.ndb
|
||||
[ qr'^PhishTank\.Phishing\.' => 3.0 ],
|
||||
|
||||
# SecuriteInfo
|
||||
[ qr'^SecuriteInfo\.com\.Spammer\.' => 3.0 ],
|
||||
|
||||
# Others
|
||||
[ qr'^Structured\.(SSN|CreditCardNumber)\b' => 0.1 ],
|
||||
[ qr'^(Heuristics\.)?Phishing\.' => 0.1 ],
|
||||
[ qr'^(Email|HTML)\.Phishing\.(?!.*Sanesecurity)' => 0.1 ],
|
||||
[ qr'^Email\.Spam\.Bounce(\.[^., ]*)*\.Sanesecurity\.' => 0 ],
|
||||
[ qr'^Email\.Spammail\b' => 0.1 ],
|
||||
[ qr'^MSRBL-(Images|SPAM)\b' => 0.1 ],
|
||||
[ qr'^VX\.Honeypot-SecuriteInfo\.com\.Joke' => 0.1 ],
|
||||
[ qr'^VX\.not-virus_(Hoax|Joke)\..*-SecuriteInfo\.com(\.|\z)' => 0.1 ],
|
||||
[ qr'^Email\.Spam.*-SecuriteInfo\.com(\.|\z)' => 0.1 ],
|
||||
[ qr'^Safebrowsing\.' => 0.1 ],
|
||||
[ qr'^INetMsg\.SpamDomain' => 0.1 ],
|
||||
[ qr'^Doppelstern\.(Spam|Scam|Phishing|Junk|Lott|Loan)'=> 0.1 ],
|
||||
[ qr'^ScamNailer\.' => 0.1 ],
|
||||
[ qr'^HTML/Bankish' => 0.1 ],
|
||||
[ qr'(-)?SecuriteInfo\.com(\.|\z)' => undef ],
|
||||
[ qr'^MBL_NA\.UNOFFICIAL' => 0.1 ],
|
||||
[ qr'^MBL_' => undef ],
|
||||
));
|
||||
|
||||
@av_scanners = (
|
||||
['clamav-socket',
|
||||
\&ask_daemon, ["CONTSCAN {}\n", 'PH_CLAMD_LOCAL_SOCKET'],
|
||||
qr/\bOK$/, qr/\bFOUND$/,
|
||||
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
|
||||
);
|
||||
|
||||
@av_scanners_backup = (
|
||||
['clamav-clamscan', 'clamscan',
|
||||
"--stdout --disable-summary -r --tempdir=$TEMPBASE {}", [0], [1],
|
||||
qr/^.*?: (?!Infected Archive)(.*) FOUND$/ ],
|
||||
);
|
||||
|
||||
#
|
||||
# Port used to release quarantined mails.
|
||||
#
|
||||
$interface_policy{'PH_AMAVISD_QUARANTINE_PORT'} = 'AM.PDP-INET';
|
||||
$policy_bank{'AM.PDP-INET'} = {
|
||||
protocol => 'AM.PDP', # select Amavis policy delegation protocol
|
||||
auth_required_release => 1, # 0 - don't require secret_id for amavisd-release
|
||||
#log_level => 4,
|
||||
#always_bcc_by_ccat => {CC_CLEAN, 'admin@example.com'},
|
||||
};
|
||||
|
||||
#########################
|
||||
# Default action applied to detected spam/virus/banned/bad-header, and how to
|
||||
# quarantine them
|
||||
#
|
||||
# Available actions:
|
||||
#
|
||||
# - D_PASS: Mail will pass to recipients, regardless of bad contents.
|
||||
# If a quarantine is configured, a copy of the mail will go there.
|
||||
# Note that including a recipient in a @*_lovers_maps is
|
||||
# functionally equivalent to setting '*_destiny = D_PASS;'
|
||||
# for that recipient.
|
||||
#
|
||||
# - D_BOUNCE: Mail will not be delivered to its recipients. A non-delivery
|
||||
# notification (bounce) will be created and sent to the sender.
|
||||
#
|
||||
# - D_REJECT: Mail will not be delivered to its recipients. Amavisd will
|
||||
# send the typical 55x reject response to the upstream MTA and
|
||||
# that MTA may create a reject notice (bounce) and return it to
|
||||
# the sender.
|
||||
# This notice is not as informative as the one created using
|
||||
# D_BOUNCE, so usually D_BOUNCE is preferred over D_REJECT.
|
||||
# If a quarantine is configured, a copy of the mail will go
|
||||
# there, if not mail message will be lost, but the sender should
|
||||
# be notified their message was rejected.
|
||||
#
|
||||
# - D_DISCARD: Mail will not be delivered to its recipients and the sender
|
||||
# normally will NOT be notified.
|
||||
# If a quarantine is configured, a copy of the mail will go
|
||||
# there, if not mail message will be lost. Note that there are
|
||||
# additional settings available that can send notifications to
|
||||
# persons that normally may not be notified when an undesirable
|
||||
# message is found, so it is possible to notify the sender even
|
||||
# when using D_DISCARD.
|
||||
#
|
||||
# Where to store quarantined mail message:
|
||||
#
|
||||
# - 'local:spam-%i-%m', quarantine mail on local file system.
|
||||
# - 'sql:', quarantine mail in SQL server specified in @storage_sql_dsn.
|
||||
# - undef, do not quarantine mail.
|
||||
|
||||
# SPAM.
|
||||
$final_spam_destiny = D_DISCARD;
|
||||
$spam_quarantine_method = 'sql:';
|
||||
$spam_quarantine_to = 'spam-quarantine';
|
||||
|
||||
# Virus
|
||||
$final_virus_destiny = D_DISCARD;
|
||||
$virus_quarantine_method = 'sql:';
|
||||
$virus_quarantine_to = 'virus-quarantine';
|
||||
|
||||
# Banned
|
||||
$final_banned_destiny = D_DISCARD;
|
||||
$banned_files_quarantine_method = 'sql:';
|
||||
$banned_quarantine_to = 'banned-quarantine';
|
||||
|
||||
# Bad header.
|
||||
$final_bad_header_destiny = D_DISCARD;
|
||||
$bad_header_quarantine_method = 'sql:';
|
||||
$bad_header_quarantine_to = 'bad-header-quarantine';
|
||||
|
||||
#########################
|
||||
# Quarantine CLEAN mails.
|
||||
# Don't forget to enable clean quarantine in policy bank 'MYUSERS'.
|
||||
#
|
||||
#$clean_quarantine_method = 'sql:';
|
||||
#$clean_quarantine_to = 'clean-quarantine';
|
||||
|
||||
# a string to prepend to Subject (for local recipients only) if mail could
|
||||
# not be decoded or checked entirely, e.g. due to password-protected archives
|
||||
#$undecipherable_subject_tag = '***UNCHECKED*** '; # undef disables it
|
||||
$undecipherable_subject_tag = undef;
|
||||
|
||||
# Hope to fix 'nested MAIL command' issue on high load server.
|
||||
$smtp_connection_cache_enable = 0;
|
||||
|
||||
# The default set of header fields to be signed can be controlled
|
||||
# by setting %signed_header_fields elements to true (to sign) or
|
||||
# to false (not to sign). Keys must be in lowercase, e.g.:
|
||||
# 0 -> off
|
||||
# 1 -> on
|
||||
$signed_header_fields{'received'} = 0;
|
||||
$signed_header_fields{'to'} = 1;
|
||||
$signed_header_fields{'from'} = 1;
|
||||
$signed_header_fields{'subject'} = 1;
|
||||
$signed_header_fields{'message-id'} = 1;
|
||||
$signed_header_fields{'content-type'} = 1;
|
||||
$signed_header_fields{'date'} = 1;
|
||||
$signed_header_fields{'mime-version'} = 1;
|
||||
|
||||
#
|
||||
# DKIM
|
||||
#
|
||||
# Enable DKIM verification globally.
|
||||
$enable_dkim_verification = 1;
|
||||
|
||||
# Disable DKIM signing globally, because it's controlled per policy bank.
|
||||
#$enable_dkim_signing = 1;
|
||||
|
||||
# Add dkim_key here.
|
||||
dkim_key('PH_FIRST_DOMAIN', 'dkim', 'PH_AMAVISD_FIRST_DOMAIN_DKIM_KEY');
|
||||
|
||||
@dkim_signature_options_bysender_maps = ({
|
||||
# 'd' defaults to a domain of an author/sender address,
|
||||
# 's' defaults to whatever selector is offered by a matching key
|
||||
|
||||
# Per-domain dkim key
|
||||
#"domain.com" => { d => "domain.com", a => 'rsa-sha256', ttl => 10*24*3600 },
|
||||
|
||||
# catch-all (one dkim key for all domains)
|
||||
'.' => {d => 'PH_FIRST_DOMAIN',
|
||||
a => 'rsa-sha256',
|
||||
c => 'relaxed/simple',
|
||||
ttl => 30*24*3600 },
|
||||
});
|
||||
|
||||
#
|
||||
# Disclaimer settings
|
||||
#
|
||||
# Uncomment below line to enable singing disclaimer in outgoing mails.
|
||||
#$defang_maps_by_ccat{+CC_CATCHALL} = [ 'disclaimer' ];
|
||||
|
||||
# Program used to signing disclaimer in outgoing mails.
|
||||
$altermime = 'PH_CMD_ALTERMIME';
|
||||
|
||||
# Disclaimer in plain text formart.
|
||||
@altermime_args_disclaimer = qw(--disclaimer=/etc/postfix/disclaimer/_OPTION_.txt --disclaimer-html=/etc/postfix/disclaimer/_OPTION_.txt --force-for-bad-html);
|
||||
|
||||
@disclaimer_options_bysender_maps = ({
|
||||
# Per-domain, per-user disclaimer setting:
|
||||
# '<domain>' => /path/to/disclaimer.txt,
|
||||
# '<email>' => /path/to/disclaimer.txt,
|
||||
|
||||
# Catch-all disclaimer setting: /etc/postfix/disclaimer/default.txt
|
||||
'.' => 'default',
|
||||
},);
|
||||
|
||||
$sql_allow_8bit_address = 1;
|
||||
$timestamp_fmt_mysql = 1; # if using MySQL *and* msgs.time_iso is TIMESTAMP;
|
||||
|
||||
# Reporting and quarantining.
|
||||
@storage_sql_dsn = (['DBI:PH_AMAVISD_PERL_SQL_DBI:database=PH_AMAVISD_DB_NAME;host=PH_SQL_SERVER_ADDRESS;port=PH_SQL_SERVER_PORT', 'PH_AMAVISD_DB_USER', 'PH_AMAVISD_DB_PASSWD']);
|
||||
|
||||
# Lookup for per-recipient, per-domain and global policy.
|
||||
@lookup_sql_dsn = @storage_sql_dsn;
|
||||
|
||||
# Don't send email with subject "UNCHECKED contents in mail FROM xxx".
|
||||
delete $admin_maps_by_ccat{&CC_UNCHECKED};
|
||||
|
||||
# Do not notify administrator about SPAM/VIRUS from remote servers.
|
||||
$virus_admin = undef;
|
||||
$spam_admin = undef;
|
||||
$banned_admin = undef;
|
||||
$bad_header_admin = undef;
|
||||
|
||||
#
|
||||
# Pre-define some policy banks.
|
||||
#
|
||||
# You can assign certain policy banks to clients/senders you want to whitelist
|
||||
# with parameter `@client_ipaddr_policy` and @author_to_policy_bank_maps.
|
||||
$policy_bank{'FULL_WHITELIST'} = {
|
||||
bypass_spam_checks_maps => [1],
|
||||
spam_lovers_maps => [1],
|
||||
bypass_decode_parts => 1,
|
||||
bypass_virus_checks_maps => [1],
|
||||
virus_lovers_maps => [1],
|
||||
bypass_banned_checks_maps => [1],
|
||||
banned_files_lovers_maps => [1],
|
||||
bypass_header_checks_maps => [1],
|
||||
bad_header_lovers_maps => [1],
|
||||
};
|
||||
|
||||
$policy_bank{'NO_SPAM_CHECK'} = {
|
||||
bypass_spam_checks_maps => [1],
|
||||
spam_lovers_maps => [1],
|
||||
};
|
||||
|
||||
$policy_bank{'NO_VIRUS_CHECK'} = {
|
||||
bypass_decode_parts => 1,
|
||||
bypass_virus_checks_maps => [1],
|
||||
virus_lovers_maps => [1],
|
||||
};
|
||||
|
||||
$policy_bank{'NO_BANNED_CHECK'} = {
|
||||
bypass_banned_checks_maps => [1],
|
||||
banned_files_lovers_maps => [1],
|
||||
};
|
||||
|
||||
$policy_bank{'NO_BAD_HEADER_CHECK'} = {
|
||||
bypass_header_checks_maps => [1],
|
||||
bad_header_lovers_maps => [1],
|
||||
};
|
||||
|
||||
#$policy_bank{'MILD_WHITELIST'} = {
|
||||
# score_sender_maps => [ { '.' => [-1.8] } ],
|
||||
#};
|
||||
|
||||
#
|
||||
# Logging
|
||||
#
|
||||
$do_syslog = 1; # log via syslogd (preferred)
|
||||
$syslog_facility = 'mail'; # Syslog facility as a string
|
||||
$log_level = 0; # Amavisd log level.
|
||||
# Verbosity: 0, 1, 2, 3, 4, 5.
|
||||
$sa_debug = 0; # SpamAssassin debugging (require $log_level).
|
||||
# Default if off (0).
|
||||
|
||||
# Amavisd on some Linux/BSD distribution use $banned_namepath_re instead of
|
||||
# $banned_filename_re, so we define some blocked file types here.
|
||||
#
|
||||
# Sample input for $banned_namepath_re:
|
||||
#
|
||||
# P=p003\tL=1\tM=multipart/mixed\nP=p002\tL=1/2\tM=application/octet-stream\tT=dat\tN=my_docum.zip
|
||||
# P=p003,L=1,M=multipart/mixed | P=p002,L=1/2,M=application/zip,T=zip,N=FedEx_00628727.zip | P=p005,L=1/2/2,T=asc,N=FedEx_00628727.doc.wsf
|
||||
#
|
||||
# What it means:
|
||||
# - T: type. e.g. zip archive.
|
||||
# - M: MIME type. e.g. application/octet-stream.
|
||||
# - N: suggested (MIME) name. e.g. my_docum.zip.
|
||||
|
||||
$banned_namepath_re = new_RE(
|
||||
#[qr'T=(rar|arc|arj|zoo|gz|bz2)(,|\t)'xmi => 'DISCARD'], # Compressed file types
|
||||
[qr'T=x-(msdownload|msdos-program|msmetafile)(,|\t)'xmi => 'DISCARD'],
|
||||
[qr'T=(hta)(,|\t)'xmi => 'DISCARD'],
|
||||
|
||||
# Dangerous mime types
|
||||
[qr'T=(9|386|LeChiffre|aaa|abc|aepl|ani|aru|atm|aut|b64|bat|bhx|bkd|blf|bll|bmw|boo|bps|bqf|breaking_bad|buk|bup|bxz|cc|ccc|ce0|ceo|cfxxe|chm|cih|cla|class|cmd|com|cpl|crinf|crjoker|crypt|cryptolocker|cryptowall|ctbl|cxq|cyw|dbd|delf|dev|dlb|dli|dll|dllx|dom|drv|dx|dxz|dyv|dyz|ecc|exe|exe-ms|exe1|exe_renamed|exx|ezt|ezz|fag|fjl|fnr|fuj|good|gzquar|hlp|hlw|hqx|hsq|hts|iva|iws|jar|js|kcd|keybtc@inbox_com|let|lik|lkh|lnk|locky|lok|lol!|lpaq5|magic|mfu|micro|mim|mjg|mjz|nls|oar|ocx|osa|ozd|pcx|pgm|php2|php3|pid|pif|plc|pr|pzdc|qit|qrn|r5a|rhk|rna|rsc_tmp|s7p|scr|shs|ska|smm|smtmp|sop|spam|ssy|swf|sys|tko|tps|tsa|tti|ttt|txs|upa|uu|uue|uzy|vb|vba|vbe|vbs|vbx|vexe|vxd|vzr|wlpginstall|ws|wsc|wsf|wsh|wss|xdu|xir|xlm|xlv|xnt|xnxx|xtbl|xxe|xxx|xyz|zix|zvz|zzz)(,|\t)'xmi => 'DISCARD'],
|
||||
|
||||
# Dangerous file name extensions
|
||||
[qr'N=.*\.(9|386|LeChiffre|aaa|abc|aepl|ani|aru|atm|aut|b64|bat|bhx|bkd|blf|bll|bmw|boo|bps|bqf|breaking_bad|buk|bup|bxz|cc|ccc|ce0|ceo|cfxxe|chm|cih|cla|class|cmd|com|cpl|crinf|crjoker|crypt|cryptolocker|cryptowall|ctbl|cxq|cyw|dbd|delf|dev|dlb|dli|dll|dllx|dom|drv|dx|dxz|dyv|dyz|ecc|exe|exe-ms|exe1|exe_renamed|exx|ezt|ezz|fag|fjl|fnr|fuj|good|gzquar|hlp|hlw|hqx|hsq|hts|iva|iws|jar|js|kcd|keybtc@inbox_com|let|lik|lkh|lnk|locky|lok|lol!|lpaq5|magic|mfu|micro|mim|mjg|mjz|nls|oar|ocx|osa|ozd|pcx|pgm|php2|php3|pid|pif|plc|pr|pzdc|qit|qrn|r5a|rhk|rna|rsc_tmp|s7p|scr|shs|ska|smm|smtmp|sop|spam|ssy|swf|sys|tko|tps|tsa|tti|ttt|txs|upa|uu|uue|uzy|vb|vba|vbe|vbs|vbx|vexe|vxd|vzr|wlpginstall|ws|wsc|wsf|wsh|wss|xdu|xir|xlm|xlv|xnt|xnxx|xtbl|xxe|xxx|xyz|zix|zvz|zzz)$'xmi => 'DISCARD'],
|
||||
);
|
||||
|
||||
# Log verbose.
|
||||
$log_templ = $log_verbose_templ;
|
||||
|
||||
# $bounce_killer_score defaults to 100, it will cause quota exceed notification
|
||||
# email sent by Dovecot quarantined by Amavisd.
|
||||
$penpals_bonus_score = undef;
|
||||
$bounce_killer_score = 0;
|
||||
|
||||
# Selectively disable some of the header checks
|
||||
#
|
||||
# Duplicate or multiple occurrence of a header field
|
||||
$allowed_header_tests{'multiple'} = 0;
|
||||
|
||||
# Missing some headers. e.g. 'Date:'
|
||||
$allowed_header_tests{'missing'} = 0;
|
||||
|
||||
# Listen on specified addresses.
|
||||
$inet_socket_bind = ['PH_LOCAL_ADDRESS'];
|
||||
|
||||
# Set ACL
|
||||
@inet_acl = qw(127.0.0.1 [::1] PH_LOCAL_ADDRESS);
|
||||
|
||||
# Num of pre-forked children.
|
||||
# WARNING: it must match (equal to or larger than) the number set in
|
||||
# `maxproc` column in Postfix master.cf for the `smtp-amavis` transport.
|
||||
$max_servers = PH_AMAVISD_MAX_SERVERS;
|
||||
|
||||
1; # insure a defined return
|
||||
@@ -0,0 +1,278 @@
|
||||
-- MySQL template for Amavisd-new-2.7.0 and later releases.
|
||||
-- Extracted from Amavisd docs/README.sql-mysql.
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
-- local users
|
||||
CREATE TABLE users (
|
||||
id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY, -- unique id
|
||||
priority integer NOT NULL DEFAULT '7', -- sort field, 0 is low prior.
|
||||
policy_id integer unsigned NOT NULL DEFAULT '1', -- JOINs with policy.id
|
||||
email varbinary(255) NOT NULL UNIQUE,
|
||||
fullname varchar(255) DEFAULT NULL -- not used by amavisd-new
|
||||
-- local char(1) -- Y/N (optional field, see note further down)
|
||||
);
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
-- any e-mail address (non- rfc2822-quoted), external or local,
|
||||
-- used as senders in wblist
|
||||
CREATE TABLE mailaddr (
|
||||
id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
priority integer NOT NULL DEFAULT '7', -- 0 is low priority
|
||||
email varbinary(255) NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
-- per-recipient whitelist and/or blacklist,
|
||||
-- puts sender and recipient in relation wb (white or blacklisted sender)
|
||||
-- White/blacklist for inbound message
|
||||
CREATE TABLE wblist (
|
||||
rid integer unsigned NOT NULL, -- recipient: users.id
|
||||
sid integer unsigned NOT NULL, -- sender: mailaddr.id
|
||||
wb varchar(10) NOT NULL, -- W or Y / B or N / space=neutral / score
|
||||
PRIMARY KEY (rid,sid)
|
||||
);
|
||||
|
||||
-- White/blacklist for outbound message
|
||||
-- Note: it's used by iRedAPD plugin `amavisd_wblist`, not by Amavisd.
|
||||
CREATE TABLE outbound_wblist (
|
||||
rid integer unsigned NOT NULL, -- recipient: mailaddr.id
|
||||
sid integer unsigned NOT NULL, -- sender: users.id
|
||||
wb varchar(10) NOT NULL, -- W or Y / B or N / space=neutral / score
|
||||
PRIMARY KEY (rid,sid)
|
||||
);
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
CREATE TABLE policy (
|
||||
id int unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
-- 'id' this is the _only_ required field
|
||||
policy_name varchar(32), -- not used by amavisd-new, a comment
|
||||
|
||||
virus_lover char(1) default NULL, -- Y/N
|
||||
spam_lover char(1) default NULL, -- Y/N
|
||||
unchecked_lover char(1) default NULL, -- Y/N
|
||||
banned_files_lover char(1) default NULL, -- Y/N
|
||||
bad_header_lover char(1) default NULL, -- Y/N
|
||||
|
||||
bypass_virus_checks char(1) default NULL, -- Y/N
|
||||
bypass_spam_checks char(1) default NULL, -- Y/N
|
||||
bypass_banned_checks char(1) default NULL, -- Y/N
|
||||
bypass_header_checks char(1) default NULL, -- Y/N
|
||||
|
||||
virus_quarantine_to varchar(64) default NULL,
|
||||
spam_quarantine_to varchar(64) default NULL,
|
||||
banned_quarantine_to varchar(64) default NULL,
|
||||
unchecked_quarantine_to varchar(64) default NULL,
|
||||
bad_header_quarantine_to varchar(64) default NULL,
|
||||
clean_quarantine_to varchar(64) default NULL,
|
||||
archive_quarantine_to varchar(64) default NULL,
|
||||
|
||||
spam_tag_level float default NULL, -- higher score inserts spam info headers
|
||||
spam_tag2_level float default NULL, -- inserts 'declared spam' header fields
|
||||
spam_tag3_level float default NULL, -- inserts 'blatant spam' header fields
|
||||
spam_kill_level float default NULL, -- higher score triggers evasive actions
|
||||
-- e.g. reject/drop, quarantine, ...
|
||||
-- (subject to final_spam_destiny setting)
|
||||
spam_dsn_cutoff_level float default NULL,
|
||||
spam_quarantine_cutoff_level float default NULL,
|
||||
|
||||
addr_extension_virus varchar(64) default NULL,
|
||||
addr_extension_spam varchar(64) default NULL,
|
||||
addr_extension_banned varchar(64) default NULL,
|
||||
addr_extension_bad_header varchar(64) default NULL,
|
||||
|
||||
warnvirusrecip char(1) default NULL, -- Y/N
|
||||
warnbannedrecip char(1) default NULL, -- Y/N
|
||||
warnbadhrecip char(1) default NULL, -- Y/N
|
||||
newvirus_admin varchar(64) default NULL,
|
||||
virus_admin varchar(64) default NULL,
|
||||
banned_admin varchar(64) default NULL,
|
||||
bad_header_admin varchar(64) default NULL,
|
||||
spam_admin varchar(64) default NULL,
|
||||
spam_subject_tag varchar(64) default NULL,
|
||||
spam_subject_tag2 varchar(64) default NULL,
|
||||
spam_subject_tag3 varchar(64) default NULL,
|
||||
message_size_limit integer default NULL, -- max size in bytes, 0 disable
|
||||
banned_rulenames varchar(64) default NULL, -- comma-separated list of ...
|
||||
-- names mapped through %banned_rules to actual banned_filename tables
|
||||
disclaimer_options varchar(64) default NULL,
|
||||
forward_method varchar(64) default NULL,
|
||||
sa_userconf varchar(64) default NULL,
|
||||
sa_username varchar(64) default NULL
|
||||
);
|
||||
|
||||
-- Required by iRedMail
|
||||
ALTER TABLE policy MODIFY COLUMN policy_name VARCHAR(255) NOT NULL DEFAULT '';
|
||||
CREATE UNIQUE INDEX policy_idx_policy_name ON policy (policy_name);
|
||||
|
||||
-- Read-write part of the dataset (optional) - @storage_sql_dsn.
|
||||
-- May reside in the same or in a separate database as lookups database;
|
||||
-- REQUIRES SUPPORT FOR TRANSACTIONS; specified in @storage_sql_dsn
|
||||
--
|
||||
-- MySQL note ( http://dev.mysql.com/doc/mysql/en/storage-engines.html ):
|
||||
-- ENGINE is the preferred term, but cannot be used before MySQL 4.0.18.
|
||||
-- TYPE is available beginning with MySQL 3.23.0, the first version of
|
||||
-- MySQL for which multiple storage engines were available. If you omit
|
||||
-- the ENGINE or TYPE option, the default storage engine is used.
|
||||
-- By default this is MyISAM.
|
||||
--
|
||||
-- Please create additional indexes on keys when needed, or drop suggested
|
||||
-- ones as appropriate to optimize queries needed by a management application.
|
||||
-- See your database documentation for further optimization hints. With MySQL
|
||||
-- see Chapter 15 of the reference manual. For example the chapter 15.17 says:
|
||||
-- InnoDB does not keep an internal count of rows in a table. To process a
|
||||
-- SELECT COUNT(*) FROM T statement, InnoDB must scan an index of the table,
|
||||
-- which takes some time if the index is not entirely in the buffer pool.
|
||||
--
|
||||
-- Wayne Smith adds: When using MySQL with InnoDB one might want to
|
||||
-- increase buffer size for both pool and log, and might also want
|
||||
-- to change flush settings for a little better performance. Example:
|
||||
-- innodb_buffer_pool_size = 384M
|
||||
-- innodb_log_buffer_size = 8M
|
||||
-- innodb_flush_log_at_trx_commit = 0
|
||||
-- The big performance increase is the first two, the third just helps with
|
||||
-- lowering disk activity. Consider also adjusting the key_buffer_size.
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- provide unique id for each e-mail address, avoids storing copies
|
||||
CREATE TABLE maddr (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
id bigint unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
email varbinary(255) NOT NULL, -- full mail address
|
||||
-- mail address without address extension: user+abc@domain.com -> user@domain.com
|
||||
email_raw varbinary(255) NOT NULL DEFAULT '',
|
||||
domain varchar(255) NOT NULL, -- only domain part of the email address
|
||||
-- with subdomain fields in reverse
|
||||
CONSTRAINT part_email UNIQUE (partition_tag,email)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE INDEX maddr_idx_email ON maddr (email);
|
||||
CREATE INDEX maddr_idx_email_raw ON maddr (email_raw);
|
||||
CREATE INDEX maddr_idx_domain ON maddr (domain);
|
||||
|
||||
-- Create trigger to save email address withou address extension
|
||||
-- user+abc@domain.com -> user@domain.com
|
||||
DELIMITER //
|
||||
CREATE TRIGGER `maddr_email_raw`
|
||||
BEFORE INSERT
|
||||
ON `maddr`
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
IF (NEW.email LIKE '%+%') THEN
|
||||
SET NEW.email_raw = CONCAT(SUBSTRING_INDEX(NEW.email, '+', 1), '@', SUBSTRING_INDEX(new.email, '@', -1));
|
||||
ELSE
|
||||
SET NEW.email_raw = NEW.email;
|
||||
END IF;
|
||||
END;
|
||||
//
|
||||
DELIMITER ;
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- information pertaining to each processed message as a whole;
|
||||
-- NOTE: records with NULL msgs.content should be ignored by utilities,
|
||||
-- as such records correspond to messages just being processes, or were lost
|
||||
-- NOTE: instead of a character field time_iso, one might prefer:
|
||||
-- time_iso TIMESTAMP NOT NULL DEFAULT 0,
|
||||
-- but the following MUST then be set in amavisd.conf: $timestamp_fmt_mysql=1
|
||||
CREATE TABLE msgs (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
mail_id varbinary(16) NOT NULL, -- long-term unique mail id, dflt 12 ch
|
||||
secret_id varbinary(16) DEFAULT '', -- authorizes release of mail_id, 12 ch
|
||||
am_id varchar(20) NOT NULL, -- id used in the log
|
||||
time_num integer unsigned NOT NULL, -- rx_time: seconds since Unix epoch
|
||||
time_iso char(16) NOT NULL, -- rx_time: ISO8601 UTC ascii time
|
||||
sid bigint unsigned NOT NULL, -- sender: maddr.id
|
||||
policy varchar(255) DEFAULT '', -- policy bank path (like macro %p)
|
||||
client_addr varchar(255) DEFAULT '', -- SMTP client IP address (IPv4 or v6)
|
||||
size integer unsigned NOT NULL, -- message size in bytes
|
||||
originating char(1) DEFAULT ' ' NOT NULL, -- sender from inside or auth'd
|
||||
content char(1),
|
||||
-- V: virus
|
||||
-- B: banned
|
||||
-- U: unchecked
|
||||
-- S: spam(kill)
|
||||
-- Y: spammy(tag2)
|
||||
-- M: bad-mime
|
||||
-- H: bad-header
|
||||
-- O: oversized
|
||||
-- O: mta-err
|
||||
-- C: clean
|
||||
-- is NULL on partially processed mail
|
||||
-- (prior to 2.7.0 the CC_SPAMMY was logged as 's', now 'Y' is used;
|
||||
-- to avoid a need for case-insenstivity in queries)
|
||||
quar_type char(1), -- quarantined as: ' '/F/Z/B/Q/M/L
|
||||
-- none/file/zipfile/bsmtp/sql/
|
||||
-- /mailbox(smtp)/mailbox(lmtp)
|
||||
quar_loc varbinary(255) DEFAULT '', -- quarantine location (e.g. file)
|
||||
dsn_sent char(1), -- was DSN sent? Y/N/q (q=quenched)
|
||||
spam_level float, -- SA spam level (no boosts)
|
||||
message_id varchar(255) DEFAULT '', -- mail Message-ID header field
|
||||
from_addr varchar(255) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT '',
|
||||
-- mail From header field, UTF8
|
||||
subject VARBINARY(255) NOT NULL DEFAULT '',
|
||||
-- mail Subject header field, UTF8
|
||||
host varchar(255) NOT NULL, -- hostname where amavisd is running
|
||||
PRIMARY KEY (partition_tag,mail_id)
|
||||
-- FOREIGN KEY (sid) REFERENCES maddr(id) ON DELETE RESTRICT
|
||||
) ENGINE=InnoDB;
|
||||
CREATE INDEX msgs_idx_sid ON msgs (sid);
|
||||
CREATE INDEX msgs_idx_mess_id ON msgs (message_id); -- useful with pen pals
|
||||
CREATE INDEX msgs_idx_time_num ON msgs (time_num);
|
||||
|
||||
CREATE INDEX msgs_idx_mail_id ON msgs (mail_id);
|
||||
CREATE INDEX msgs_idx_content ON msgs (content);
|
||||
CREATE INDEX msgs_idx_quar_type ON msgs (quar_type);
|
||||
CREATE INDEX msgs_idx_content_time_num ON msgs (content, time_num);
|
||||
CREATE INDEX msgs_idx_spam_level ON msgs (spam_level);
|
||||
|
||||
-- alternatively when purging based on time_iso (instead of msgs_idx_time_num):
|
||||
CREATE INDEX msgs_idx_time_iso ON msgs (time_iso);
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- per-recipient information related to each processed message;
|
||||
-- NOTE: records in msgrcpt without corresponding msgs.mail_id record are
|
||||
-- orphaned and should be ignored and eventually deleted by external utilities
|
||||
CREATE TABLE msgrcpt (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
mail_id varbinary(16) NOT NULL, -- (must allow duplicates)
|
||||
rseqnum integer DEFAULT 0 NOT NULL, -- recip's enumeration within msg
|
||||
rid bigint unsigned NOT NULL, -- recipient: maddr.id (dupl. allowed)
|
||||
is_local char(1) DEFAULT ' ' NOT NULL, -- recip is: Y=local, N=foreign
|
||||
content char(1) DEFAULT ' ' NOT NULL, -- content type V/B/U/S/Y/M/H/O/T/C
|
||||
ds char(1) NOT NULL, -- delivery status: P/R/B/D/T
|
||||
-- pass/reject/bounce/discard/tempfail
|
||||
rs char(1) NOT NULL, -- release status: initialized to ' '
|
||||
bl char(1) DEFAULT ' ', -- sender blacklisted by this recip
|
||||
wl char(1) DEFAULT ' ', -- sender whitelisted by this recip
|
||||
bspam_level float, -- per-recipient (total) spam level
|
||||
smtp_resp varchar(255) DEFAULT '', -- SMTP response given to MTA
|
||||
PRIMARY KEY (partition_tag,mail_id,rseqnum)
|
||||
-- FOREIGN KEY (rid) REFERENCES maddr(id) ON DELETE RESTRICT,
|
||||
-- FOREIGN KEY (mail_id) REFERENCES msgs(mail_id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
CREATE INDEX msgrcpt_idx_mail_id ON msgrcpt (mail_id);
|
||||
CREATE INDEX msgrcpt_idx_rid ON msgrcpt (rid);
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- mail quarantine in SQL, enabled by $*_quarantine_method='sql:'
|
||||
-- NOTE: records in quarantine without corresponding msgs.mail_id record are
|
||||
-- orphaned and should be ignored and eventually deleted by external utilities
|
||||
CREATE TABLE quarantine (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
mail_id varbinary(16) NOT NULL, -- long-term unique mail id
|
||||
chunk_ind integer unsigned NOT NULL, -- chunk number, starting with 1
|
||||
mail_text blob NOT NULL, -- store mail as chunks of octets
|
||||
PRIMARY KEY (partition_tag,mail_id,chunk_ind)
|
||||
-- FOREIGN KEY (mail_id) REFERENCES msgs(mail_id) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE INDEX quar_idx_mail_id ON quarantine (mail_id);
|
||||
|
||||
-- field msgrcpt.rs is primarily intended for use by quarantine management
|
||||
-- software; the value assigned by amavisd is a space;
|
||||
-- a short _preliminary_ list of possible values:
|
||||
-- 'V' => viewed (marked as read)
|
||||
-- 'R' => released (delivered) to this recipient
|
||||
-- 'p' => pending (a status given to messages when the admin received the
|
||||
-- request but not yet released; targeted to banned parts)
|
||||
-- 'D' => marked for deletion; a cleanup script may delete it
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
-- MySQL template for Amavisd-new-2.7.0 and later releases.
|
||||
-- Read-only part of the dataset (@lookup_sql_dsn)
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
-- local users
|
||||
CREATE TABLE users (
|
||||
id serial PRIMARY KEY, -- unique id
|
||||
priority integer NOT NULL DEFAULT '7', -- sort field, 0 is low prior.
|
||||
policy_id integer NOT NULL DEFAULT '1' CHECK (policy_id >= 0),
|
||||
-- JOINs with policy.id
|
||||
email bytea NOT NULL UNIQUE, -- email address, non-rfc2822-quoted
|
||||
fullname varchar(255) DEFAULT NULL -- not used by amavisd-new
|
||||
-- local char(1) -- Y/N (optional field, see note further down)
|
||||
);
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
-- any e-mail address (non- rfc2822-quoted), external or local,
|
||||
-- used as senders in wblist
|
||||
CREATE TABLE mailaddr (
|
||||
id serial PRIMARY KEY,
|
||||
priority integer NOT NULL DEFAULT '7', -- 0 is low priority
|
||||
email bytea NOT NULL UNIQUE
|
||||
);
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
-- per-recipient whitelist and/or blacklist,
|
||||
-- puts sender and recipient in relation wb (white or blacklisted sender)
|
||||
-- White/blacklist for inbound message
|
||||
CREATE TABLE wblist (
|
||||
rid integer NOT NULL CHECK (rid >= 0), -- recipient: users.id
|
||||
sid integer NOT NULL CHECK (sid >= 0), -- sender: mailaddr.id
|
||||
wb varchar(10) NOT NULL, -- W or Y / B or N / space=neutral / score
|
||||
PRIMARY KEY (rid,sid)
|
||||
);
|
||||
|
||||
-- White/blacklist for outbound message
|
||||
-- Note: it's used by iRedAPD plugin `amavisd_wblist`, not by Amavisd.
|
||||
CREATE TABLE outbound_wblist (
|
||||
rid integer NOT NULL CHECK (rid >= 0), -- recipient: mailaddr.id
|
||||
sid integer NOT NULL CHECK (sid >= 0), -- sender: users.id
|
||||
wb varchar(10) NOT NULL, -- W or Y / B or N / space=neutral / score
|
||||
PRIMARY KEY (rid,sid)
|
||||
);
|
||||
|
||||
-- used in @lookup_sql_dsn
|
||||
CREATE TABLE policy (
|
||||
id serial PRIMARY KEY, -- 'id' this is the _only_ required field
|
||||
policy_name varchar(32), -- not used by amavisd-new, a comment
|
||||
|
||||
virus_lover char(1) default NULL, -- Y/N
|
||||
spam_lover char(1) default NULL, -- Y/N
|
||||
unchecked_lover char(1) default NULL, -- Y/N
|
||||
banned_files_lover char(1) default NULL, -- Y/N
|
||||
bad_header_lover char(1) default NULL, -- Y/N
|
||||
|
||||
bypass_virus_checks char(1) default NULL, -- Y/N
|
||||
bypass_spam_checks char(1) default NULL, -- Y/N
|
||||
bypass_banned_checks char(1) default NULL, -- Y/N
|
||||
bypass_header_checks char(1) default NULL, -- Y/N
|
||||
|
||||
virus_quarantine_to varchar(64) default NULL,
|
||||
spam_quarantine_to varchar(64) default NULL,
|
||||
banned_quarantine_to varchar(64) default NULL,
|
||||
unchecked_quarantine_to varchar(64) default NULL,
|
||||
bad_header_quarantine_to varchar(64) default NULL,
|
||||
clean_quarantine_to varchar(64) default NULL,
|
||||
archive_quarantine_to varchar(64) default NULL,
|
||||
|
||||
spam_tag_level real default NULL, -- higher score inserts spam info headers
|
||||
spam_tag2_level real default NULL, -- inserts 'declared spam' header fields
|
||||
spam_tag3_level real default NULL, -- inserts 'blatant spam' header fields
|
||||
spam_kill_level real default NULL, -- higher score triggers evasive actions
|
||||
-- e.g. reject/drop, quarantine, ...
|
||||
-- (subject to final_spam_destiny setting)
|
||||
spam_dsn_cutoff_level real default NULL,
|
||||
spam_quarantine_cutoff_level real default NULL,
|
||||
|
||||
addr_extension_virus varchar(64) default NULL,
|
||||
addr_extension_spam varchar(64) default NULL,
|
||||
addr_extension_banned varchar(64) default NULL,
|
||||
addr_extension_bad_header varchar(64) default NULL,
|
||||
|
||||
warnvirusrecip char(1) default NULL, -- Y/N
|
||||
warnbannedrecip char(1) default NULL, -- Y/N
|
||||
warnbadhrecip char(1) default NULL, -- Y/N
|
||||
newvirus_admin varchar(64) default NULL,
|
||||
virus_admin varchar(64) default NULL,
|
||||
banned_admin varchar(64) default NULL,
|
||||
bad_header_admin varchar(64) default NULL,
|
||||
spam_admin varchar(64) default NULL,
|
||||
spam_subject_tag varchar(64) default NULL,
|
||||
spam_subject_tag2 varchar(64) default NULL,
|
||||
spam_subject_tag3 varchar(64) default NULL,
|
||||
message_size_limit integer default NULL, -- max size in bytes, 0 disable
|
||||
banned_rulenames varchar(64) default NULL, -- comma-separated list of ...
|
||||
-- names mapped through %banned_rules to actual banned_filename tables
|
||||
disclaimer_options varchar(64) default NULL,
|
||||
forward_method varchar(64) default NULL,
|
||||
sa_userconf varchar(64) default NULL,
|
||||
sa_username varchar(64) default NULL
|
||||
);
|
||||
|
||||
-- Required by iRedMail
|
||||
ALTER TABLE policy ALTER COLUMN policy_name TYPE varchar(255);
|
||||
CREATE UNIQUE INDEX policy_idx_policy_name ON policy (policy_name);
|
||||
|
||||
-- Read-write part of the dataset (optional) - @storage_sql_dsn.
|
||||
-- May reside in the same or in a separate database as lookups database;
|
||||
-- REQUIRES SUPPORT FOR TRANSACTIONS; specified in @storage_sql_dsn
|
||||
--
|
||||
-- Please create additional indexes on keys when needed, or drop suggested
|
||||
-- ones as appropriate to optimize queries needed by a management application.
|
||||
-- See your database documentation for further optimization hints.
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- provide unique id for each e-mail address, avoids storing copies
|
||||
CREATE TABLE maddr (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
id serial PRIMARY KEY,
|
||||
-- full e-mail address
|
||||
email bytea NOT NULL, -- long-term unique mail id, dflt 12 ch
|
||||
-- mail address without address extension: user+abc@domain.com -> user@domain.com
|
||||
email_raw VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain bytea NOT NULL, -- only domain part of the email address
|
||||
-- with subdomain fields in reverse
|
||||
CONSTRAINT part_email UNIQUE (partition_tag,email)
|
||||
);
|
||||
|
||||
CREATE INDEX maddr_idx_email ON maddr (email);
|
||||
CREATE INDEX maddr_idx_email_raw ON maddr (email_raw);
|
||||
CREATE INDEX maddr_idx_domain ON maddr (domain);
|
||||
|
||||
-- Create trigger to save email address withou address extension
|
||||
-- user+abc@domain.com -> user@domain.com
|
||||
-- CREATE OR REPLACE FUNCTION strip_addr_extension(bytea, varchar, integer) RETURNS TRIGGER AS $$
|
||||
CREATE OR REPLACE FUNCTION strip_addr_extension()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF (NEW.email LIKE '%+%') THEN
|
||||
NEW.email_raw := split_part(convert_from(NEW.email, 'UTF8'), '+', 1) || '@' || split_part(convert_from(NEW.email, 'UTF8'), '@', 2);
|
||||
ELSE
|
||||
NEW.email_raw := convert_from(NEW.email, 'UTF8');
|
||||
END IF;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER maddr_email_raw
|
||||
BEFORE INSERT ON maddr
|
||||
FOR EACH ROW
|
||||
EXECUTE PROCEDURE strip_addr_extension();
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- information pertaining to each processed message as a whole;
|
||||
-- NOTE: records with NULL msgs.content should be ignored by utilities,
|
||||
-- as such records correspond to messages just being processes, or were lost
|
||||
CREATE TABLE msgs (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
mail_id bytea NOT NULL, -- long-term unique mail id, dflt 12 ch
|
||||
secret_id bytea DEFAULT '', -- authorizes release of mail_id, 12 ch
|
||||
am_id varchar(20) NOT NULL, -- id used in the log
|
||||
time_num integer NOT NULL CHECK (time_num >= 0),
|
||||
-- rx_time: seconds since Unix epoch
|
||||
time_iso timestamp WITH TIME ZONE NOT NULL,-- rx_time: ISO8601 UTC ascii time
|
||||
sid integer NOT NULL CHECK (sid >= 0), -- sender: maddr.id
|
||||
policy varchar(255) DEFAULT '', -- policy bank path (like macro %p)
|
||||
client_addr varchar(255) DEFAULT '', -- SMTP client IP address (IPv4 or v6)
|
||||
size integer NOT NULL CHECK (size >= 0), -- message size in bytes
|
||||
originating char(1) DEFAULT ' ' NOT NULL, -- sender from inside or auth'd
|
||||
content char(1),
|
||||
-- V: virus
|
||||
-- B: banned
|
||||
-- U: unchecked
|
||||
-- S: spam(kill)
|
||||
-- Y: spammy(tag2)
|
||||
-- M: bad-mime
|
||||
-- H: bad-header
|
||||
-- O: oversized
|
||||
-- O: mta-err
|
||||
-- C: clean
|
||||
-- is NULL on partially processed mail
|
||||
-- (prior to 2.7.0 the CC_SPAMMY was logged as 's', now 'Y' is used;
|
||||
-- to avoid a need for case-insenstivity in queries)
|
||||
quar_type char(1), -- quarantined as: ' '/F/Z/B/Q/M/L
|
||||
-- none/file/zipfile/bsmtp/sql/
|
||||
-- /mailbox(smtp)/mailbox(lmtp)
|
||||
quar_loc varchar(255) DEFAULT '', -- quarantine location (e.g. file)
|
||||
dsn_sent char(1), -- was DSN sent? Y/N/q (q=quenched)
|
||||
spam_level real, -- SA spam level (no boosts)
|
||||
message_id varchar(255) DEFAULT '', -- mail Message-ID header field
|
||||
from_addr bytea DEFAULT '', -- mail From header field, UTF8
|
||||
subject bytea DEFAULT '', -- mail Subject header field, UTF8
|
||||
host varchar(255) NOT NULL, -- hostname where amavisd is running
|
||||
PRIMARY KEY (partition_tag,mail_id)
|
||||
--FOREIGN KEY (sid) REFERENCES maddr(id) ON DELETE RESTRICT
|
||||
);
|
||||
CREATE INDEX msgs_idx_sid ON msgs (sid);
|
||||
CREATE INDEX msgs_idx_mess_id ON msgs (message_id); -- useful with pen pals
|
||||
CREATE INDEX msgs_idx_time_iso ON msgs (time_iso);
|
||||
CREATE INDEX msgs_idx_time_num ON msgs (time_num); -- optional
|
||||
|
||||
CREATE INDEX msgs_idx_mail_id ON msgs (mail_id);
|
||||
CREATE INDEX msgs_idx_content ON msgs (content);
|
||||
CREATE INDEX msgs_idx_quar_type ON msgs (quar_type);
|
||||
-- CREATE INDEX msgs_idx_content_time_num ON msgs (content, time_num);
|
||||
CREATE INDEX msgs_idx_spam_level ON msgs (spam_level);
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- per-recipient information related to each processed message;
|
||||
-- NOTE: records in msgrcpt without corresponding msgs.mail_id record are
|
||||
-- orphaned and should be ignored and eventually deleted by external utilities
|
||||
CREATE TABLE msgrcpt (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
mail_id bytea NOT NULL, -- (must allow duplicates)
|
||||
rseqnum integer DEFAULT 0 NOT NULL, -- recip's enumeration within msg
|
||||
rid integer NOT NULL, -- recipient: maddr.id (duplicates allowed)
|
||||
is_local char(1) DEFAULT ' ' NOT NULL, -- recip is: Y=local, N=foreign
|
||||
content char(1) DEFAULT ' ' NOT NULL, -- content type V/B/U/S/Y/M/H/O/T/C
|
||||
ds char(1) NOT NULL, -- delivery status: P/R/B/D/T
|
||||
-- pass/reject/bounce/discard/tempfail
|
||||
rs char(1) NOT NULL, -- release status: initialized to ' '
|
||||
bl char(1) DEFAULT ' ', -- sender blacklisted by this recip
|
||||
wl char(1) DEFAULT ' ', -- sender whitelisted by this recip
|
||||
bspam_level real, -- per-recipient (total) spam level
|
||||
smtp_resp varchar(255) DEFAULT '', -- SMTP response given to MTA
|
||||
PRIMARY KEY (partition_tag,mail_id,rseqnum)
|
||||
--FOREIGN KEY (rid) REFERENCES maddr(id) ON DELETE RESTRICT,
|
||||
--FOREIGN KEY (mail_id) REFERENCES msgs(mail_id) ON DELETE CASCADE
|
||||
);
|
||||
CREATE INDEX msgrcpt_idx_mail_id ON msgrcpt (mail_id);
|
||||
CREATE INDEX msgrcpt_idx_rid ON msgrcpt (rid);
|
||||
|
||||
-- used in @storage_sql_dsn
|
||||
-- mail quarantine in SQL, enabled by $*_quarantine_method='sql:'
|
||||
-- NOTE: records in quarantine without corresponding msgs.mail_id record are
|
||||
-- orphaned and should be ignored and eventually deleted by external utilities
|
||||
CREATE TABLE quarantine (
|
||||
partition_tag integer DEFAULT 0, -- see $partition_tag
|
||||
mail_id bytea NOT NULL, -- long-term unique mail id
|
||||
chunk_ind integer NOT NULL CHECK (chunk_ind >= 0), -- chunk number, 1..
|
||||
mail_text bytea NOT NULL, -- store mail as chunks of octects
|
||||
PRIMARY KEY (partition_tag,mail_id,chunk_ind)
|
||||
--FOREIGN KEY (mail_id) REFERENCES msgs(mail_id) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- field msgrcpt.rs is primarily intended for use by quarantine management
|
||||
-- software; the value assigned by amavisd is a space;
|
||||
-- a short _preliminary_ list of possible values:
|
||||
-- 'V' => viewed (marked as read)
|
||||
-- 'R' => released (delivered) to this recipient
|
||||
-- 'p' => pending (a status given to messages when the admin received the
|
||||
-- request but not yet released; targeted to banned parts)
|
||||
-- 'D' => marked for deletion; a cleanup script may delete it
|
||||
@@ -0,0 +1,942 @@
|
||||
#--------------------------------------------------------------------------
|
||||
# LDAP Schema for amavisd-new Jacques Supcik, PhD
|
||||
#----------------------------- IP-Plus Internet Services
|
||||
# Release 1.2.2 Swisscom Enterprise Solutions Ltd
|
||||
# 30 May 2004 3050 Bern - Switzerland
|
||||
#--------------------------------------------------------------------------
|
||||
# Copyright (c) 2004 Jacques Supcik, Swisscom Enterprise Solutions Ltd.
|
||||
# Permission is granted to copy, distribute and/or modify this document
|
||||
# under the terms of the GNU Free Documentation License, Version 1.2
|
||||
# or any later version published by the Free Software Foundation;
|
||||
# with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
# A copy of the license is included in the section entitled "GNU
|
||||
# Free Documentation License".
|
||||
#--------------------------------------------------------------------------
|
||||
# Changes made to LDAP Schema to make it import and play nicely with
|
||||
# Novell NDS - Michael Tracey, SONOPRESS USA, LLC April 07 2005
|
||||
# ( uncomment each dn:, changetype:, add:, add X-NDS-NAME attribute, replace
|
||||
# "attributetype" by "attributetypes:" and "objectclasse" by "objectclasses:"
|
||||
# (plural,colon), and unwrap each attributetypes: and objectclasses: )
|
||||
#--------------------------------------------------------------------------
|
||||
# 1.3.6.1.4.1.15312 Jozef Stefan Institute's OID
|
||||
# 1.3.6.1.4.1.15312.2 amavisd-new
|
||||
# 1.3.6.1.4.1.15312.2.2 amavisd-new LDAP Elements
|
||||
# 1.3.6.1.4.1.15312.2.2.1 AttributeTypes
|
||||
# 1.3.6.1.4.1.15312.2.2.2 ObjectClasses
|
||||
# 1.3.6.1.4.1.15312.2.2.3 Syntax Definitions
|
||||
#--------------------------------------------------------------------------
|
||||
|
||||
# Attribute Types
|
||||
#-----------------
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.1
|
||||
NAME 'amavisVirusLover'
|
||||
DESC 'Virus Lover'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.2
|
||||
NAME 'amavisBannedFilesLover'
|
||||
DESC 'Banned Files Lover'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.3
|
||||
NAME 'amavisBypassVirusChecks'
|
||||
DESC 'Bypass Virus Check'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.4
|
||||
NAME 'amavisBypassSpamChecks'
|
||||
DESC 'Bypass Spam Check'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.5
|
||||
NAME 'amavisSpamTagLevel'
|
||||
DESC 'Spam Tag Level'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.6
|
||||
NAME 'amavisSpamTag2Level'
|
||||
DESC 'Spam Tag2 Level'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.7
|
||||
NAME 'amavisSpamKillLevel'
|
||||
DESC 'Spam Kill Level'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.8
|
||||
NAME 'amavisSpamModifiesSubj'
|
||||
DESC 'Modifies Subject on spam - no longer in use since 2.7.0'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.9
|
||||
NAME 'amavisWhitelistSender'
|
||||
DESC 'White List Sender'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.10
|
||||
NAME 'amavisBlacklistSender'
|
||||
DESC 'Black List Sender'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.11
|
||||
NAME 'amavisSpamQuarantineTo'
|
||||
DESC 'Spam Quarantine to'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.12
|
||||
NAME 'amavisSpamLover'
|
||||
DESC 'Spam Lover'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.13
|
||||
NAME 'amavisBadHeaderLover'
|
||||
DESC 'Bad Header Lover'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.14
|
||||
NAME 'amavisBypassBannedChecks'
|
||||
DESC 'Bypass Banned Files Check'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.15
|
||||
NAME 'amavisBypassHeaderChecks'
|
||||
DESC 'Bypass Header Check'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.16
|
||||
NAME 'amavisVirusQuarantineTo'
|
||||
DESC 'Virus quarantine location'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.17
|
||||
NAME 'amavisBannedQuarantineTo'
|
||||
DESC 'Banned Files quarantine location'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.18
|
||||
NAME 'amavisBadHeaderQuarantineTo'
|
||||
DESC 'Bad Header quarantine location'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.19
|
||||
NAME 'amavisLocal'
|
||||
DESC 'Is user considered local'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.20
|
||||
NAME 'amavisMessageSizeLimit'
|
||||
DESC 'Message size limit'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.21
|
||||
NAME 'amavisWarnVirusRecip'
|
||||
DESC 'Notify virus recipients'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.22
|
||||
NAME 'amavisWarnBannedRecip'
|
||||
DESC 'Notify banned file recipients'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.23
|
||||
NAME 'amavisWarnBadHeaderRecip'
|
||||
DESC 'Notify bad header recipients'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.24
|
||||
NAME 'amavisVirusAdmin'
|
||||
DESC 'Virus admin'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.25
|
||||
NAME 'amavisNewVirusAdmin'
|
||||
DESC 'New virus admin'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.26
|
||||
NAME 'amavisSpamAdmin'
|
||||
DESC 'Spam admin'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.27
|
||||
NAME 'amavisBannedAdmin'
|
||||
DESC 'Banned file admin'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.28
|
||||
NAME 'amavisBadHeaderAdmin'
|
||||
DESC 'Bad header admin'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.29
|
||||
NAME 'amavisBannedRuleNames'
|
||||
DESC 'Banned rule names'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.30
|
||||
NAME 'amavisSpamDsnCutoffLevel'
|
||||
DESC 'Spam DSN Cutoff Level'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.31
|
||||
NAME 'amavisSpamQuarantineCutoffLevel'
|
||||
DESC 'Spam Quarantine Cutoff Level'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.32
|
||||
NAME 'amavisSpamSubjectTag'
|
||||
DESC 'Spam Subject Tag'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.33
|
||||
NAME 'amavisSpamSubjectTag2'
|
||||
DESC 'Spam Subject Tag2'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.34
|
||||
NAME 'amavisArchiveQuarantineTo'
|
||||
DESC 'Archive quarantine location'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.35
|
||||
NAME 'amavisAddrExtensionVirus'
|
||||
DESC 'Address Extension for Virus'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.36
|
||||
NAME 'amavisAddrExtensionSpam'
|
||||
DESC 'Address Extension for Spam'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.37
|
||||
NAME 'amavisAddrExtensionBanned'
|
||||
DESC 'Address Extension for Banned'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.38
|
||||
NAME 'amavisAddrExtensionBadHeader'
|
||||
DESC 'Address Extension for Bad Header'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
# NEW since 2.7.0:
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.39
|
||||
NAME 'amavisSpamTag3Level'
|
||||
DESC 'Spam Tag3 Level'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.40
|
||||
NAME 'amavisSpamSubjectTag3'
|
||||
DESC 'Spam Subject Tag3'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.41
|
||||
NAME 'amavisUncheckedQuarantineTo'
|
||||
DESC 'Virus quarantine location'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.42
|
||||
NAME 'amavisCleanQuarantineTo'
|
||||
DESC 'Clean quarantine location'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.43
|
||||
NAME 'amavisUncheckedLover'
|
||||
DESC 'Unchecked Files Lover'
|
||||
EQUALITY booleanMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.44
|
||||
NAME 'amavisForwardMethod'
|
||||
DESC 'Forward / next hop destination'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.45
|
||||
NAME 'amavisSaUserConf'
|
||||
DESC 'SpamAssassin user preferences configuration filename'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.46
|
||||
NAME 'amavisSaUserName'
|
||||
DESC 'SpamAssassin username (for Bayes and AWL lookups)'
|
||||
EQUALITY caseExactIA5Match
|
||||
SUBSTR caseExactSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: attributetypes
|
||||
attributetype ( 1.3.6.1.4.1.15312.2.2.1.47
|
||||
NAME 'amavisDisclaimerOptions'
|
||||
DESC 'Altermime disclaimer map data'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
|
||||
SINGLE-VALUE )
|
||||
|
||||
|
||||
# Classes
|
||||
#---------
|
||||
|
||||
# amavisAccount
|
||||
# This class is an auxiliary class, this mean that the class will be added
|
||||
# to a structural class. Usually, the structural class is the class that
|
||||
# represent the mail account itself (e.g. an inetOrgPerson)
|
||||
|
||||
#dn: cn=schema
|
||||
#changetype: modify
|
||||
#add: objectclasses
|
||||
objectclass ( 1.3.6.1.4.1.15312.2.2.2.1
|
||||
NAME 'amavisAccount' AUXILIARY
|
||||
DESC 'Amavisd Account'
|
||||
SUP top
|
||||
MAY ( amavisVirusLover $ amavisBypassVirusChecks $
|
||||
amavisSpamLover $ amavisBypassSpamChecks $
|
||||
amavisBannedFilesLover $ amavisBypassBannedChecks $
|
||||
amavisBadHeaderLover $ amavisBypassHeaderChecks $
|
||||
amavisSpamTagLevel $ amavisSpamTag2Level $ amavisSpamKillLevel $
|
||||
amavisWhitelistSender $ amavisBlacklistSender $
|
||||
amavisSpamQuarantineTo $ amavisVirusQuarantineTo $
|
||||
amavisBannedQuarantineTo $ amavisBadHeaderQuarantineTo $
|
||||
amavisArchiveQuarantineTo $
|
||||
amavisSpamModifiesSubj $ amavisLocal $ amavisMessageSizeLimit $
|
||||
amavisWarnVirusRecip $ amavisWarnBannedRecip $
|
||||
amavisWarnBadHeaderRecip $ amavisVirusAdmin $ amavisNewVirusAdmin $
|
||||
amavisSpamAdmin $ amavisBannedAdmin $ amavisBadHeaderAdmin $
|
||||
amavisBannedRuleNames $
|
||||
amavisSpamDsnCutoffLevel $ amavisSpamQuarantineCutoffLevel $
|
||||
amavisSpamSubjectTag $ amavisSpamSubjectTag2 $
|
||||
amavisAddrExtensionVirus $ amavisAddrExtensionSpam $
|
||||
amavisAddrExtensionBanned $ amavisAddrExtensionBadHeader $
|
||||
amavisSpamTag3Level $ amavisSpamSubjectTag3 $
|
||||
amavisUncheckedQuarantineTo $ amavisCleanQuarantineTo $
|
||||
amavisUncheckedLover $ amavisForwardMethod $
|
||||
amavisSaUserConf $ amavisSaUserName $ amavisDisclaimerOptions $
|
||||
cn $ description ) )
|
||||
|
||||
#--------------------------------------------------------------------------
|
||||
#
|
||||
# GNU Free Documentation License
|
||||
# Version 1.2, November 2002
|
||||
#
|
||||
#
|
||||
# Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
# Everyone is permitted to copy and distribute verbatim copies
|
||||
# of this license document, but changing it is not allowed.
|
||||
#
|
||||
#
|
||||
# 0. PREAMBLE
|
||||
#
|
||||
# The purpose of this License is to make a manual, textbook, or other
|
||||
# functional and useful document "free" in the sense of freedom: to
|
||||
# assure everyone the effective freedom to copy and redistribute it,
|
||||
# with or without modifying it, either commercially or noncommercially.
|
||||
# Secondarily, this License preserves for the author and publisher a way
|
||||
# to get credit for their work, while not being considered responsible
|
||||
# for modifications made by others.
|
||||
#
|
||||
# This License is a kind of "copyleft", which means that derivative
|
||||
# works of the document must themselves be free in the same sense. It
|
||||
# complements the GNU General Public License, which is a copyleft
|
||||
# license designed for free software.
|
||||
#
|
||||
# We have designed this License in order to use it for manuals for free
|
||||
# software, because free software needs free documentation: a free
|
||||
# program should come with manuals providing the same freedoms that the
|
||||
# software does. But this License is not limited to software manuals;
|
||||
# it can be used for any textual work, regardless of subject matter or
|
||||
# whether it is published as a printed book. We recommend this License
|
||||
# principally for works whose purpose is instruction or reference.
|
||||
#
|
||||
#
|
||||
# 1. APPLICABILITY AND DEFINITIONS
|
||||
#
|
||||
# This License applies to any manual or other work, in any medium, that
|
||||
# contains a notice placed by the copyright holder saying it can be
|
||||
# distributed under the terms of this License. Such a notice grants a
|
||||
# world-wide, royalty-free license, unlimited in duration, to use that
|
||||
# work under the conditions stated herein. The "Document", below,
|
||||
# refers to any such manual or work. Any member of the public is a
|
||||
# licensee, and is addressed as "you". You accept the license if you
|
||||
# copy, modify or distribute the work in a way requiring permission
|
||||
# under copyright law.
|
||||
#
|
||||
# A "Modified Version" of the Document means any work containing the
|
||||
# Document or a portion of it, either copied verbatim, or with
|
||||
# modifications and/or translated into another language.
|
||||
#
|
||||
# A "Secondary Section" is a named appendix or a front-matter section of
|
||||
# the Document that deals exclusively with the relationship of the
|
||||
# publishers or authors of the Document to the Document's overall subject
|
||||
# (or to related matters) and contains nothing that could fall directly
|
||||
# within that overall subject. (Thus, if the Document is in part a
|
||||
# textbook of mathematics, a Secondary Section may not explain any
|
||||
# mathematics.) The relationship could be a matter of historical
|
||||
# connection with the subject or with related matters, or of legal,
|
||||
# commercial, philosophical, ethical or political position regarding
|
||||
# them.
|
||||
#
|
||||
# The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
# are designated, as being those of Invariant Sections, in the notice
|
||||
# that says that the Document is released under this License. If a
|
||||
# section does not fit the above definition of Secondary then it is not
|
||||
# allowed to be designated as Invariant. The Document may contain zero
|
||||
# Invariant Sections. If the Document does not identify any Invariant
|
||||
# Sections then there are none.
|
||||
#
|
||||
# The "Cover Texts" are certain short passages of text that are listed,
|
||||
# as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
# the Document is released under this License. A Front-Cover Text may
|
||||
# be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
#
|
||||
# A "Transparent" copy of the Document means a machine-readable copy,
|
||||
# represented in a format whose specification is available to the
|
||||
# general public, that is suitable for revising the document
|
||||
# straightforwardly with generic text editors or (for images composed of
|
||||
# pixels) generic paint programs or (for drawings) some widely available
|
||||
# drawing editor, and that is suitable for input to text formatters or
|
||||
# for automatic translation to a variety of formats suitable for input
|
||||
# to text formatters. A copy made in an otherwise Transparent file
|
||||
# format whose markup, or absence of markup, has been arranged to thwart
|
||||
# or discourage subsequent modification by readers is not Transparent.
|
||||
# An image format is not Transparent if used for any substantial amount
|
||||
# of text. A copy that is not "Transparent" is called "Opaque".
|
||||
#
|
||||
# Examples of suitable formats for Transparent copies include plain
|
||||
# ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
# or XML using a publicly available DTD, and standard-conforming simple
|
||||
# HTML, PostScript or PDF designed for human modification. Examples of
|
||||
# transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
# include proprietary formats that can be read and edited only by
|
||||
# proprietary word processors, SGML or XML for which the DTD and/or
|
||||
# processing tools are not generally available, and the
|
||||
# machine-generated HTML, PostScript or PDF produced by some word
|
||||
# processors for output purposes only.
|
||||
#
|
||||
# The "Title Page" means, for a printed book, the title page itself,
|
||||
# plus such following pages as are needed to hold, legibly, the material
|
||||
# this License requires to appear in the title page. For works in
|
||||
# formats which do not have any title page as such, "Title Page" means
|
||||
# the text near the most prominent appearance of the work's title,
|
||||
# preceding the beginning of the body of the text.
|
||||
#
|
||||
# A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
# title either is precisely XYZ or contains XYZ in parentheses following
|
||||
# text that translates XYZ in another language. (Here XYZ stands for a
|
||||
# specific section name mentioned below, such as "Acknowledgements",
|
||||
# "Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
# of such a section when you modify the Document means that it remains a
|
||||
# section "Entitled XYZ" according to this definition.
|
||||
#
|
||||
# The Document may include Warranty Disclaimers next to the notice which
|
||||
# states that this License applies to the Document. These Warranty
|
||||
# Disclaimers are considered to be included by reference in this
|
||||
# License, but only as regards disclaiming warranties: any other
|
||||
# implication that these Warranty Disclaimers may have is void and has
|
||||
# no effect on the meaning of this License.
|
||||
#
|
||||
#
|
||||
# 2. VERBATIM COPYING
|
||||
#
|
||||
# You may copy and distribute the Document in any medium, either
|
||||
# commercially or noncommercially, provided that this License, the
|
||||
# copyright notices, and the license notice saying this License applies
|
||||
# to the Document are reproduced in all copies, and that you add no other
|
||||
# conditions whatsoever to those of this License. You may not use
|
||||
# technical measures to obstruct or control the reading or further
|
||||
# copying of the copies you make or distribute. However, you may accept
|
||||
# compensation in exchange for copies. If you distribute a large enough
|
||||
# number of copies you must also follow the conditions in section 3.
|
||||
#
|
||||
# You may also lend copies, under the same conditions stated above, and
|
||||
# you may publicly display copies.
|
||||
#
|
||||
#
|
||||
# 3. COPYING IN QUANTITY
|
||||
#
|
||||
# If you publish printed copies (or copies in media that commonly have
|
||||
# printed covers) of the Document, numbering more than 100, and the
|
||||
# Document's license notice requires Cover Texts, you must enclose the
|
||||
# copies in covers that carry, clearly and legibly, all these Cover
|
||||
# Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
# the back cover. Both covers must also clearly and legibly identify
|
||||
# you as the publisher of these copies. The front cover must present
|
||||
# the full title with all words of the title equally prominent and
|
||||
# visible. You may add other material on the covers in addition.
|
||||
# Copying with changes limited to the covers, as long as they preserve
|
||||
# the title of the Document and satisfy these conditions, can be treated
|
||||
# as verbatim copying in other respects.
|
||||
#
|
||||
# If the required texts for either cover are too voluminous to fit
|
||||
# legibly, you should put the first ones listed (as many as fit
|
||||
# reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
# pages.
|
||||
#
|
||||
# If you publish or distribute Opaque copies of the Document numbering
|
||||
# more than 100, you must either include a machine-readable Transparent
|
||||
# copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
# a computer-network location from which the general network-using
|
||||
# public has access to download using public-standard network protocols
|
||||
# a complete Transparent copy of the Document, free of added material.
|
||||
# If you use the latter option, you must take reasonably prudent steps,
|
||||
# when you begin distribution of Opaque copies in quantity, to ensure
|
||||
# that this Transparent copy will remain thus accessible at the stated
|
||||
# location until at least one year after the last time you distribute an
|
||||
# Opaque copy (directly or through your agents or retailers) of that
|
||||
# edition to the public.
|
||||
#
|
||||
# It is requested, but not required, that you contact the authors of the
|
||||
# Document well before redistributing any large number of copies, to give
|
||||
# them a chance to provide you with an updated version of the Document.
|
||||
#
|
||||
#
|
||||
# 4. MODIFICATIONS
|
||||
#
|
||||
# You may copy and distribute a Modified Version of the Document under
|
||||
# the conditions of sections 2 and 3 above, provided that you release
|
||||
# the Modified Version under precisely this License, with the Modified
|
||||
# Version filling the role of the Document, thus licensing distribution
|
||||
# and modification of the Modified Version to whoever possesses a copy
|
||||
# of it. In addition, you must do these things in the Modified Version:
|
||||
#
|
||||
# A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
# from that of the Document, and from those of previous versions
|
||||
# (which should, if there were any, be listed in the History section
|
||||
# of the Document). You may use the same title as a previous version
|
||||
# if the original publisher of that version gives permission.
|
||||
# B. List on the Title Page, as authors, one or more persons or entities
|
||||
# responsible for authorship of the modifications in the Modified
|
||||
# Version, together with at least five of the principal authors of the
|
||||
# Document (all of its principal authors, if it has fewer than five),
|
||||
# unless they release you from this requirement.
|
||||
# C. State on the Title page the name of the publisher of the
|
||||
# Modified Version, as the publisher.
|
||||
# D. Preserve all the copyright notices of the Document.
|
||||
# E. Add an appropriate copyright notice for your modifications
|
||||
# adjacent to the other copyright notices.
|
||||
# F. Include, immediately after the copyright notices, a license notice
|
||||
# giving the public permission to use the Modified Version under the
|
||||
# terms of this License, in the form shown in the Addendum below.
|
||||
# G. Preserve in that license notice the full lists of Invariant Sections
|
||||
# and required Cover Texts given in the Document's license notice.
|
||||
# H. Include an unaltered copy of this License.
|
||||
# I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||
# to it an item stating at least the title, year, new authors, and
|
||||
# publisher of the Modified Version as given on the Title Page. If
|
||||
# there is no section Entitled "History" in the Document, create one
|
||||
# stating the title, year, authors, and publisher of the Document as
|
||||
# given on its Title Page, then add an item describing the Modified
|
||||
# Version as stated in the previous sentence.
|
||||
# J. Preserve the network location, if any, given in the Document for
|
||||
# public access to a Transparent copy of the Document, and likewise
|
||||
# the network locations given in the Document for previous versions
|
||||
# it was based on. These may be placed in the "History" section.
|
||||
# You may omit a network location for a work that was published at
|
||||
# least four years before the Document itself, or if the original
|
||||
# publisher of the version it refers to gives permission.
|
||||
# K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
# Preserve the Title of the section, and preserve in the section all
|
||||
# the substance and tone of each of the contributor acknowledgements
|
||||
# and/or dedications given therein.
|
||||
# L. Preserve all the Invariant Sections of the Document,
|
||||
# unaltered in their text and in their titles. Section numbers
|
||||
# or the equivalent are not considered part of the section titles.
|
||||
# M. Delete any section Entitled "Endorsements". Such a section
|
||||
# may not be included in the Modified Version.
|
||||
# N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||
# or to conflict in title with any Invariant Section.
|
||||
# O. Preserve any Warranty Disclaimers.
|
||||
#
|
||||
# If the Modified Version includes new front-matter sections or
|
||||
# appendices that qualify as Secondary Sections and contain no material
|
||||
# copied from the Document, you may at your option designate some or all
|
||||
# of these sections as invariant. To do this, add their titles to the
|
||||
# list of Invariant Sections in the Modified Version's license notice.
|
||||
# These titles must be distinct from any other section titles.
|
||||
#
|
||||
# You may add a section Entitled "Endorsements", provided it contains
|
||||
# nothing but endorsements of your Modified Version by various
|
||||
# parties--for example, statements of peer review or that the text has
|
||||
# been approved by an organization as the authoritative definition of a
|
||||
# standard.
|
||||
#
|
||||
# You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
# passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
# of Cover Texts in the Modified Version. Only one passage of
|
||||
# Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
# through arrangements made by) any one entity. If the Document already
|
||||
# includes a cover text for the same cover, previously added by you or
|
||||
# by arrangement made by the same entity you are acting on behalf of,
|
||||
# you may not add another; but you may replace the old one, on explicit
|
||||
# permission from the previous publisher that added the old one.
|
||||
#
|
||||
# The author(s) and publisher(s) of the Document do not by this License
|
||||
# give permission to use their names for publicity for or to assert or
|
||||
# imply endorsement of any Modified Version.
|
||||
#
|
||||
#
|
||||
# 5. COMBINING DOCUMENTS
|
||||
#
|
||||
# You may combine the Document with other documents released under this
|
||||
# License, under the terms defined in section 4 above for modified
|
||||
# versions, provided that you include in the combination all of the
|
||||
# Invariant Sections of all of the original documents, unmodified, and
|
||||
# list them all as Invariant Sections of your combined work in its
|
||||
# license notice, and that you preserve all their Warranty Disclaimers.
|
||||
#
|
||||
# The combined work need only contain one copy of this License, and
|
||||
# multiple identical Invariant Sections may be replaced with a single
|
||||
# copy. If there are multiple Invariant Sections with the same name but
|
||||
# different contents, make the title of each such section unique by
|
||||
# adding at the end of it, in parentheses, the name of the original
|
||||
# author or publisher of that section if known, or else a unique number.
|
||||
# Make the same adjustment to the section titles in the list of
|
||||
# Invariant Sections in the license notice of the combined work.
|
||||
#
|
||||
# In the combination, you must combine any sections Entitled "History"
|
||||
# in the various original documents, forming one section Entitled
|
||||
# "History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
# and any sections Entitled "Dedications". You must delete all sections
|
||||
# Entitled "Endorsements".
|
||||
#
|
||||
#
|
||||
# 6. COLLECTIONS OF DOCUMENTS
|
||||
#
|
||||
# You may make a collection consisting of the Document and other documents
|
||||
# released under this License, and replace the individual copies of this
|
||||
# License in the various documents with a single copy that is included in
|
||||
# the collection, provided that you follow the rules of this License for
|
||||
# verbatim copying of each of the documents in all other respects.
|
||||
#
|
||||
# You may extract a single document from such a collection, and distribute
|
||||
# it individually under this License, provided you insert a copy of this
|
||||
# License into the extracted document, and follow this License in all
|
||||
# other respects regarding verbatim copying of that document.
|
||||
#
|
||||
#
|
||||
# 7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
#
|
||||
# A compilation of the Document or its derivatives with other separate
|
||||
# and independent documents or works, in or on a volume of a storage or
|
||||
# distribution medium, is called an "aggregate" if the copyright
|
||||
# resulting from the compilation is not used to limit the legal rights
|
||||
# of the compilation's users beyond what the individual works permit.
|
||||
# When the Document is included in an aggregate, this License does not
|
||||
# apply to the other works in the aggregate which are not themselves
|
||||
# derivative works of the Document.
|
||||
#
|
||||
# If the Cover Text requirement of section 3 is applicable to these
|
||||
# copies of the Document, then if the Document is less than one half of
|
||||
# the entire aggregate, the Document's Cover Texts may be placed on
|
||||
# covers that bracket the Document within the aggregate, or the
|
||||
# electronic equivalent of covers if the Document is in electronic form.
|
||||
# Otherwise they must appear on printed covers that bracket the whole
|
||||
# aggregate.
|
||||
#
|
||||
#
|
||||
# 8. TRANSLATION
|
||||
#
|
||||
# Translation is considered a kind of modification, so you may
|
||||
# distribute translations of the Document under the terms of section 4.
|
||||
# Replacing Invariant Sections with translations requires special
|
||||
# permission from their copyright holders, but you may include
|
||||
# translations of some or all Invariant Sections in addition to the
|
||||
# original versions of these Invariant Sections. You may include a
|
||||
# translation of this License, and all the license notices in the
|
||||
# Document, and any Warranty Disclaimers, provided that you also include
|
||||
# the original English version of this License and the original versions
|
||||
# of those notices and disclaimers. In case of a disagreement between
|
||||
# the translation and the original version of this License or a notice
|
||||
# or disclaimer, the original version will prevail.
|
||||
#
|
||||
# If a section in the Document is Entitled "Acknowledgements",
|
||||
# "Dedications", or "History", the requirement (section 4) to Preserve
|
||||
# its Title (section 1) will typically require changing the actual
|
||||
# title.
|
||||
#
|
||||
#
|
||||
# 9. TERMINATION
|
||||
#
|
||||
# You may not copy, modify, sublicense, or distribute the Document except
|
||||
# as expressly provided for under this License. Any other attempt to
|
||||
# copy, modify, sublicense or distribute the Document is void, and will
|
||||
# automatically terminate your rights under this License. However,
|
||||
# parties who have received copies, or rights, from you under this
|
||||
# License will not have their licenses terminated so long as such
|
||||
# parties remain in full compliance.
|
||||
#
|
||||
#
|
||||
# 10. FUTURE REVISIONS OF THIS LICENSE
|
||||
#
|
||||
# The Free Software Foundation may publish new, revised versions
|
||||
# of the GNU Free Documentation License from time to time. Such new
|
||||
# versions will be similar in spirit to the present version, but may
|
||||
# differ in detail to address new problems or concerns. See
|
||||
# http://www.gnu.org/copyleft/.
|
||||
#
|
||||
# Each version of the License is given a distinguishing version number.
|
||||
# If the Document specifies that a particular numbered version of this
|
||||
# License "or any later version" applies to it, you have the option of
|
||||
# following the terms and conditions either of that specified version or
|
||||
# of any later version that has been published (not as a draft) by the
|
||||
# Free Software Foundation. If the Document does not specify a version
|
||||
# number of this License, you may choose any version ever published (not
|
||||
# as a draft) by the Free Software Foundation.
|
||||
@@ -0,0 +1,46 @@
|
||||
-- Default server-wide spam policy
|
||||
--
|
||||
-- *) with 'spam_lover=Y' and:
|
||||
--
|
||||
-- - with 'spam_quarantine_to=spam-quarantine', spam will be delivered
|
||||
-- to mailbox and a copy will be quarantined
|
||||
-- - with 'spam_quarantine_to=' (empty value), spam will be delivered to
|
||||
-- mailbox, no copy will be quarantined
|
||||
--
|
||||
-- *) with 'spam_lover=N' and
|
||||
--
|
||||
-- - with 'spam_quarantine_to=spam-quarantine', spam will be quarantined,
|
||||
-- no copy will be delivered to mailbox.
|
||||
-- - with 'spam_quarantine_to=' (empty value), spam won't be quarantined,
|
||||
-- a copy will be delivered to mailbox.
|
||||
--
|
||||
|
||||
INSERT INTO policy (policy_name,
|
||||
spam_lover,
|
||||
virus_lover,
|
||||
banned_files_lover,
|
||||
bad_header_lover,
|
||||
bypass_spam_checks,
|
||||
bypass_virus_checks,
|
||||
bypass_banned_checks,
|
||||
bypass_header_checks,
|
||||
spam_quarantine_to,
|
||||
virus_quarantine_to,
|
||||
banned_quarantine_to,
|
||||
bad_header_quarantine_to)
|
||||
VALUES ('@.',
|
||||
'Y',
|
||||
'N',
|
||||
'N',
|
||||
'Y',
|
||||
'N',
|
||||
'N',
|
||||
'N',
|
||||
'N',
|
||||
'',
|
||||
'virus-quarantine',
|
||||
'banned-quarantine',
|
||||
'');
|
||||
|
||||
INSERT INTO users (priority, email) VALUES (0, '@.');
|
||||
UPDATE users SET policy_id = (SELECT id FROM policy WHERE policy.policy_name='@.' LIMIT 1);
|
||||
@@ -0,0 +1,50 @@
|
||||
connect = host=PH_SQL_SERVER_ADDRESS port=PH_SQL_SERVER_PORT dbname=PH_REALTIME_QUOTA_DB_NAME user=PH_REALTIME_QUOTA_DB_USER password=PH_REALTIME_QUOTA_DB_PASSWORD
|
||||
|
||||
map {
|
||||
pattern = shared/last-login/imap/$user/$domain
|
||||
table = last_login
|
||||
value_field = imap
|
||||
value_type = uint
|
||||
|
||||
fields {
|
||||
username = $user
|
||||
domain = $domain
|
||||
}
|
||||
}
|
||||
|
||||
map {
|
||||
pattern = shared/last-login/pop3/$user/$domain
|
||||
table = last_login
|
||||
value_field = pop3
|
||||
value_type = uint
|
||||
|
||||
fields {
|
||||
username = $user
|
||||
domain = $domain
|
||||
}
|
||||
}
|
||||
|
||||
map {
|
||||
pattern = shared/last-login/lda/$user/$domain
|
||||
table = last_login
|
||||
value_field = lda
|
||||
value_type = uint
|
||||
|
||||
fields {
|
||||
username = $user
|
||||
domain = $domain
|
||||
}
|
||||
}
|
||||
|
||||
# Treat lmtp as lda.
|
||||
map {
|
||||
pattern = shared/last-login/lmtp/$user/$domain
|
||||
table = last_login
|
||||
value_field = lda
|
||||
value_type = uint
|
||||
|
||||
fields {
|
||||
username = $user
|
||||
domain = $domain
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
hosts = PH_LDAP_SERVER_HOST:PH_LDAP_SERVER_PORT
|
||||
ldap_version = PH_LDAP_BIND_VERSION
|
||||
auth_bind = yes
|
||||
dn = PH_LDAP_BINDDN
|
||||
dnpass = PH_LDAP_BINDPW
|
||||
base = PH_LDAP_BASEDN
|
||||
scope = subtree
|
||||
deref = never
|
||||
|
||||
# Below two are required by command 'doveadm mailbox ...'
|
||||
#iterate_attrs = mail=user
|
||||
#iterate_filter = (&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail))
|
||||
|
||||
user_filter = (&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
|
||||
user_attrs = mail=master_user,mail=user,=home=%L{ldap:homeDirectory},=mail=%{ldap:mailboxFormat:maildir}:~/%{ldap:mailboxFolder:Maildir}/,mailQuota=quota_rule=*:bytes=%$
|
||||
|
||||
# Used for dn lookup
|
||||
pass_filter = (&(objectClass=mailUser)(accountStatus=active)(!(domainStatus=disabled))(enabledService=mail)(enabledService=%Ls%Lc)(|(mail=%u)(&(enabledService=shadowaddress)(shadowAddress=%u))))
|
||||
pass_attrs = mail=user,userPassword=password,allowNets=allow_nets
|
||||
default_pass_scheme = CRYPT
|
||||
@@ -0,0 +1,22 @@
|
||||
connect = host=PH_SQL_SERVER_ADDRESS port=PH_SQL_SERVER_PORT dbname=PH_DOVECOT_SHARE_FOLDER_DB_NAME user=PH_DOVECOT_SHARE_FOLDER_DB_USER password=PH_DOVECOT_SHARE_FOLDER_DB_PASSWORD
|
||||
map {
|
||||
pattern = shared/shared-boxes/user/$to/$from
|
||||
table = PH_DOVECOT_SHARE_FOLDER_DB_TABLE
|
||||
value_field = dummy
|
||||
|
||||
fields {
|
||||
from_user = $from
|
||||
to_user = $to
|
||||
}
|
||||
}
|
||||
|
||||
# To share mailbox to anyone, please uncomment 'acl_anyone = allow' in
|
||||
# dovecot.conf
|
||||
map {
|
||||
pattern = shared/shared-boxes/anyone/$from
|
||||
table = PH_DOVECOT_SHARE_FOLDER_ANYONE_DB_TABLE
|
||||
value_field = dummy
|
||||
fields {
|
||||
from_user = $from
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
driver = PH_SQL_DRIVER
|
||||
default_pass_scheme = CRYPT
|
||||
connect = host=PH_SQL_SERVER_ADDRESS port=PH_SQL_SERVER_PORT dbname=PH_VMAIL_DB_NAME user=PH_VMAIL_DB_BIND_USER password=PH_VMAIL_DB_BIND_PASSWD
|
||||
|
||||
# Required by doveadm tools which require to list all mail users.
|
||||
iterate_query = SELECT username AS user FROM mailbox
|
||||
|
||||
password_query = SELECT mailbox.password, mailbox.allow_nets \
|
||||
FROM mailbox,domain \
|
||||
WHERE mailbox.username='%u' \
|
||||
AND mailbox.enable%Ls%Lc=1 \
|
||||
AND mailbox.active=1 \
|
||||
AND mailbox.domain=domain.domain \
|
||||
AND domain.backupmx=0 \
|
||||
AND domain.active=1
|
||||
|
||||
user_query = SELECT \
|
||||
LOWER('%u') AS master_user, \
|
||||
LOWER(CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir)) AS home, \
|
||||
CONCAT(mailbox.mailboxformat, ':~/', mailbox.mailboxfolder) AS mail, \
|
||||
CONCAT('*:bytes=', mailbox.quota*1048576) AS quota_rule \
|
||||
FROM mailbox,domain \
|
||||
WHERE mailbox.username='%u' \
|
||||
AND mailbox.enable%Ls%Lc=1 \
|
||||
AND mailbox.active=1 \
|
||||
AND mailbox.domain=domain.domain \
|
||||
AND domain.backupmx=0 \
|
||||
AND domain.active=1
|
||||
@@ -0,0 +1,13 @@
|
||||
connect = host=PH_SQL_SERVER_ADDRESS port=PH_SQL_SERVER_PORT dbname=PH_REALTIME_QUOTA_DB_NAME user=PH_REALTIME_QUOTA_DB_USER password=PH_REALTIME_QUOTA_DB_PASSWORD
|
||||
map {
|
||||
pattern = priv/quota/storage
|
||||
table = PH_DOVECOT_REALTIME_QUOTA_TABLE
|
||||
username_field = username
|
||||
value_field = bytes
|
||||
}
|
||||
map {
|
||||
pattern = priv/quota/messages
|
||||
table = PH_DOVECOT_REALTIME_QUOTA_TABLE
|
||||
username_field = username
|
||||
value_field = messages
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
require ["fileinto"];
|
||||
|
||||
# rule:[Move Spam to Junk Folder]
|
||||
if header :is "X-Spam-Flag" "YES"
|
||||
{
|
||||
fileinto "Junk";
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Purpose: Mail to user when his/her quota exceeds specified percentage.
|
||||
# Reference: http://wiki2.dovecot.org/Quota/Configuration#Quota_warnings
|
||||
|
||||
PERCENT=${1}
|
||||
USER=${2}
|
||||
|
||||
# Use "plugin/quota=maildir:User quota:noenforcing" for maildir quota.
|
||||
cat << EOF | PH_DOVECOT_DELIVER_BIN -d ${USER} -o "plugin/quota=dict:User quota::noenforcing:proxy::quotadict"
|
||||
From: no-reply@$(hostname -f)
|
||||
Subject: Warning: Your mailbox is now ${PERCENT}% full.
|
||||
|
||||
Your mailbox is now ${PERCENT}% full, please clean up some mails for further incoming mails.
|
||||
EOF
|
||||
|
||||
# Send a copy to postmaster@ if mailbox is greater than or equal to 95% full.
|
||||
if [ ${PERCENT} -ge 95 ]; then
|
||||
DOMAIN="$(echo ${USER} | awk -F'@' '{print $2}')"
|
||||
cat << EOF | PH_DOVECOT_DELIVER_BIN -d postmaster@${DOMAIN} -o "plugin/quota=dict:User quota::noenforcing:proxy::quotadict"
|
||||
From: no-reply@$(hostname -f)
|
||||
Subject: Mailbox Quota Warning: ${PERCENT}% full, ${USER}
|
||||
|
||||
Mailbox (${USER}) is now ${PERCENT}% full, please clean up some mails for
|
||||
further incoming mails.
|
||||
EOF
|
||||
fi
|
||||
@@ -0,0 +1,506 @@
|
||||
# More details about Dovecot settings:
|
||||
# - http://wiki2.dovecot.org/
|
||||
# - http://wiki2.dovecot.org/Variables
|
||||
|
||||
# Listen addresses.
|
||||
# - '*' means all available IPv4 addresses.
|
||||
# - '[::]' means all available IPv6 addresses.
|
||||
# Listen on all available addresses by default
|
||||
listen = * [::]
|
||||
|
||||
#base_dir = PH_BASE_DIR
|
||||
mail_plugins = quota mailbox_alias acl mail_log notify stats
|
||||
|
||||
# Enabled mail protocols.
|
||||
protocols = PH_PROTOCOLS
|
||||
|
||||
# User/group who owns the message files:
|
||||
mail_uid = PH_MAIL_UID
|
||||
mail_gid = PH_MAIL_GID
|
||||
|
||||
# Assign uid to virtual users.
|
||||
first_valid_uid = PH_FIRST_VALID_UID
|
||||
last_valid_uid = PH_LAST_VALID_UID
|
||||
|
||||
# Logging. Reference: http://wiki2.dovecot.org/Logging
|
||||
#
|
||||
# Use syslog
|
||||
syslog_facility = PH_IREDMAIL_SYSLOG_FACILITY
|
||||
# Log file path if we use internal log system
|
||||
#log_path = PH_LOG_PATH
|
||||
|
||||
# Debug
|
||||
#mail_debug = yes
|
||||
#auth_verbose = yes
|
||||
#auth_debug = yes
|
||||
#auth_debug_passwords = yes
|
||||
# Possible values: no, plain, sha1.
|
||||
#auth_verbose_passwords = no
|
||||
|
||||
# SSL: Global settings.
|
||||
# Refer to wiki site for per protocol, ip, server name SSL settings:
|
||||
# http://wiki.dovecot.org/SSL/DovecotConfiguration
|
||||
ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1
|
||||
ssl = required
|
||||
verbose_ssl = no
|
||||
#ssl_ca = </path/to/ca
|
||||
ssl_cert = <PH_SSL_CERT
|
||||
ssl_key = <PH_SSL_KEY
|
||||
|
||||
# Fix 'The Logjam Attack'
|
||||
ssl_cipher_list = PH_SSL_CIPHERS
|
||||
ssl_prefer_server_ciphers = yes
|
||||
|
||||
# With disable_plaintext_auth=yes AND ssl=required, STARTTLS is mandatory.
|
||||
# Set disable_plaintext_auth=no AND ssl=yes to allow plain password transmitted
|
||||
# insecurely.
|
||||
disable_plaintext_auth = yes
|
||||
|
||||
# Allow plain text password per IP address/net
|
||||
#remote 192.168.0.0/24 {
|
||||
# disable_plaintext_auth = no
|
||||
#}
|
||||
|
||||
# Mail location and mailbox format.
|
||||
mail_location = maildir:%Lh/Maildir/:INDEX=%Lh/Maildir/
|
||||
|
||||
# Authentication related settings.
|
||||
# Append this domain name if client gives empty realm.
|
||||
#auth_default_realm = PH_AUTH_DEFAULT_REALM
|
||||
|
||||
# Authentication mechanisms.
|
||||
auth_mechanisms = PLAIN LOGIN
|
||||
|
||||
# Limits the number of users that can be logging in at the same time.
|
||||
# Default is 100. This can be overridden by `process_limit =` in
|
||||
# `service [protocol]` block.
|
||||
# e.g.
|
||||
# protocol imap-login {
|
||||
# ...
|
||||
# process_limit = 500
|
||||
# }
|
||||
#default_process_limit = 100
|
||||
|
||||
# Login log elements.
|
||||
# Add '%k' for detailed SSL protocol and cipher information.
|
||||
# e.g. "TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)"
|
||||
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c %k session=<%{session}>
|
||||
|
||||
# Mail delivery log format
|
||||
deliver_log_format = from=%{from}, envelope_sender=%{from_envelope}, subject=%{subject}, msgid=%m, size=%{size}, delivery_time=%{delivery_time}ms, %$
|
||||
|
||||
service auth {
|
||||
unix_listener PH_POSTFIX_CHROOT_DIR/private/dovecot-auth {
|
||||
user = PH_DOVECOT_AUTH_USER
|
||||
group = PH_DOVECOT_AUTH_GROUP
|
||||
mode = 0666
|
||||
}
|
||||
unix_listener auth-master {
|
||||
user = PH_AUTH_MASTER_USER
|
||||
group = PH_AUTH_MASTER_GROUP
|
||||
mode = 0666
|
||||
}
|
||||
unix_listener auth-userdb {
|
||||
user = PH_AUTH_MASTER_USER
|
||||
group = PH_AUTH_MASTER_GROUP
|
||||
mode = 0660
|
||||
}
|
||||
}
|
||||
|
||||
# LMTP server (Local Mail Transfer Protocol).
|
||||
# Reference: http://wiki2.dovecot.org/LMTP
|
||||
service lmtp {
|
||||
user = PH_AUTH_MASTER_USER
|
||||
|
||||
# For higher volume sites, it may be desirable to increase the number of
|
||||
# active listener processes. A range of 5 to 20 is probably good for most
|
||||
# sites.
|
||||
process_min_avail = 5
|
||||
|
||||
# Logging.
|
||||
# Require 'log_path =' in 'protocol lmtp {}' block.
|
||||
executable = lmtp -L
|
||||
|
||||
# Listening on socket file and TCP
|
||||
unix_listener PH_POSTFIX_CHROOT_DIR/private/dovecot-lmtp {
|
||||
user = PH_DOVECOT_AUTH_USER
|
||||
group = PH_DOVECOT_AUTH_GROUP
|
||||
mode = 0600
|
||||
}
|
||||
|
||||
inet_listener lmtp {
|
||||
# Listen on localhost (ipv4)
|
||||
address = PH_LMTP_BIND_ADDRESS
|
||||
port = PH_LMTP_BIND_PORT
|
||||
}
|
||||
}
|
||||
|
||||
# Virtual mail accounts.
|
||||
userdb {
|
||||
args = PH_USERDB_ARGS
|
||||
driver = PH_USERDB_DRIVER
|
||||
}
|
||||
passdb {
|
||||
args = PH_PASSDB_ARGS
|
||||
driver = PH_PASSDB_DRIVER
|
||||
}
|
||||
|
||||
# Master user.
|
||||
# Master users are able to log in as other users. It's also possible to
|
||||
# directly log in as any user using a master password, although this isn't
|
||||
# recommended.
|
||||
# Reference: http://wiki2.dovecot.org/Authentication/MasterUsers
|
||||
auth_master_user_separator = *
|
||||
passdb {
|
||||
driver = passwd-file
|
||||
args = PH_DOVECOT_MASTER_USER_PASSWORD_FILE
|
||||
master = yes
|
||||
}
|
||||
|
||||
plugin {
|
||||
# Quota configuration.
|
||||
# Reference: http://wiki2.dovecot.org/Quota/Configuration
|
||||
quota = PH_QUOTA_TYPE
|
||||
|
||||
# Set default quota rule if no quota returned from SQL/LDAP query.
|
||||
#quota_rule = *:storage=1G
|
||||
#quota_rule2 = *:messages=0
|
||||
#quota_rule3 = Trash:storage=1G
|
||||
#quota_rule4 = Junk:ignore
|
||||
|
||||
# Quota warning.
|
||||
#
|
||||
# If user suddenly receives a huge mail and the quota jumps from
|
||||
# 85% to 95%, only the 95% script is executed.
|
||||
#
|
||||
# Only the command for the first exceeded limit is executed, so configure
|
||||
# the highest limit first.
|
||||
quota_warning = storage=100%% quota-warning 100 %u
|
||||
quota_warning2 = storage=95%% quota-warning 95 %u
|
||||
quota_warning3 = storage=90%% quota-warning 90 %u
|
||||
quota_warning4 = storage=85%% quota-warning 85 %u
|
||||
|
||||
# allow user to become max 10% (or 50 MB) over quota
|
||||
quota_grace = 10%%
|
||||
#quota_grace = 50 M
|
||||
|
||||
# Custom Quota Exceeded Message.
|
||||
# You can specify the message directly or read the message from a file.
|
||||
#quota_exceeded_message = Quota exceeded, please try again later.
|
||||
#quota_exceeded_message = </path/to/quota_exceeded_message.txt
|
||||
|
||||
# Used by quota-status service.
|
||||
quota_status_success = DUNNO
|
||||
quota_status_nouser = DUNNO
|
||||
quota_status_overquota = "552 5.2.2 Mailbox is full"
|
||||
|
||||
# Plugin: expire.
|
||||
#expire = Trash 7 Trash/* 7 Junk 30
|
||||
#expire_dict = proxy::expire
|
||||
|
||||
# ACL and share folder
|
||||
acl = vfile
|
||||
acl_shared_dict = proxy::acl
|
||||
|
||||
# By default Dovecot doesn't allow using the IMAP "anyone" or
|
||||
# "authenticated" identifier, because it would be an easy way to spam
|
||||
# other users in the system. If you wish to allow it,
|
||||
#acl_anyone = allow
|
||||
|
||||
# Pigeonhole managesieve service.
|
||||
# Reference: http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
|
||||
# Per-user sieve settings.
|
||||
sieve_dir = ~/sieve
|
||||
sieve = ~/sieve/PH_SIEVE_RULE_FILENAME
|
||||
|
||||
# Global sieve settings.
|
||||
sieve_global_dir = PH_SIEVE_DIR
|
||||
# Note: if user has personal sieve script, global sieve rules defined in
|
||||
# sieve_default will be ignored. Please use sieve_before or
|
||||
# sieve_after instead.
|
||||
#sieve_default =
|
||||
|
||||
sieve_before = PH_GLOBAL_SIEVE_FILE
|
||||
#sieve_after =
|
||||
|
||||
# The maximum number of redirect actions that can be performed during a
|
||||
# single script execution.
|
||||
# The meaning of 0 differs based on your version. For pigeonhole-0.3.0 and
|
||||
# beyond this means that redirect is prohibited. For older versions,
|
||||
# however, this means that the number of redirects is unlimited.
|
||||
sieve_max_redirects = 30
|
||||
|
||||
# Use recipient as vacation message sender instead of null sender (<>).
|
||||
sieve_vacation_send_from_recipient = yes
|
||||
|
||||
# Reference: http://wiki2.dovecot.org/Plugins/MailboxAlias
|
||||
mailbox_alias_old = Sent
|
||||
mailbox_alias_new = Sent Messages
|
||||
mailbox_alias_old2 = Sent
|
||||
mailbox_alias_new2 = Sent Items
|
||||
|
||||
# Events to log. `autoexpunge` is included in `expunge`
|
||||
# Defined in https://github.com/dovecot/core/blob/master/src/plugins/mail-log/mail-log-plugin.c
|
||||
mail_log_events = delete undelete expunge copy mailbox_create mailbox_delete mailbox_rename
|
||||
mail_log_fields = uid box msgid size from subject flags
|
||||
|
||||
# stats
|
||||
#
|
||||
# how often to session statistics (must be set)
|
||||
stats_refresh = 30 secs
|
||||
# track per-IMAP command statistics (optional)
|
||||
stats_track_cmds = yes
|
||||
|
||||
# Track user last login
|
||||
last_login_dict = proxy::lastlogin
|
||||
last_login_key = last-login/%s/%u/%d
|
||||
}
|
||||
|
||||
service stats {
|
||||
fifo_listener stats-mail {
|
||||
user = PH_DOVECOT_SERVICE_STATS_USER
|
||||
group = PH_DOVECOT_SERVICE_STATS_GROUP
|
||||
mode = 0644
|
||||
}
|
||||
|
||||
unix_listener stats-writer {
|
||||
user = PH_DOVECOT_SERVICE_STATS_USER
|
||||
group = PH_DOVECOT_SERVICE_STATS_GROUP
|
||||
mode = 0660
|
||||
}
|
||||
|
||||
inet_listener {
|
||||
address = 127.0.0.1
|
||||
port = PH_DOVECOT_SERVICE_STATS_PORT
|
||||
}
|
||||
}
|
||||
|
||||
service quota-warning {
|
||||
executable = script PH_QUOTA_WARNING_SCRIPT
|
||||
unix_listener quota-warning {
|
||||
user = PH_QUOTA_WARNING_USER
|
||||
group = PH_QUOTA_WARNING_GROUP
|
||||
mode = 0660
|
||||
}
|
||||
}
|
||||
|
||||
service quota-status {
|
||||
# '-p <protocol>'. Currently only 'postfix' protocol is supported.
|
||||
executable = quota-status -p postfix
|
||||
client_limit = 1
|
||||
inet_listener {
|
||||
address = PH_DOVECOT_SERVICE_QUOTA_STATUS_BIND_ADDRESS
|
||||
port = PH_DOVECOT_SERVICE_QUOTA_STATUS_PORT
|
||||
}
|
||||
}
|
||||
|
||||
service dict {
|
||||
unix_listener dict {
|
||||
mode = 0660
|
||||
user = PH_SERVICE_DICT_USER
|
||||
group = PH_SERVICE_DICT_GROUP
|
||||
}
|
||||
}
|
||||
|
||||
dict {
|
||||
#expire = db:/var/lib/dovecot/expire/expire.db
|
||||
quotadict = PH_DOVECOT_SQL_DBN:PH_DOVECOT_REALTIME_QUOTA_CONF
|
||||
acl = PH_DOVECOT_SQL_DBN:PH_DOVECOT_SHARE_FOLDER_CONF
|
||||
lastlogin = PH_DOVECOT_SQL_DBN:PH_DOVECOT_LAST_LOGIN_CONF
|
||||
}
|
||||
|
||||
protocol lda {
|
||||
# Reference: http://wiki2.dovecot.org/LDA
|
||||
mail_plugins = $mail_plugins sieve
|
||||
lda_mailbox_autocreate = yes
|
||||
lda_mailbox_autosubscribe = yes
|
||||
|
||||
# Log file path if we use internal log system
|
||||
#log_path = PH_DOVECOT_SIEVE_LOG_FILE
|
||||
}
|
||||
|
||||
protocol lmtp {
|
||||
# Log file path if we use internal log system
|
||||
#log_path = PH_DOVECOT_LMTP_LOG_FILE
|
||||
|
||||
# Plugins
|
||||
mail_plugins = $mail_plugins sieve
|
||||
|
||||
# Address extension delivery
|
||||
lmtp_save_to_detail_mailbox = yes
|
||||
recipient_delimiter = +
|
||||
}
|
||||
|
||||
protocol imap {
|
||||
mail_plugins = $mail_plugins imap_quota imap_acl imap_stats last_login
|
||||
imap_client_workarounds = tb-extra-mailbox-sep
|
||||
|
||||
# Maximum number of IMAP connections allowed for a user from each IP address.
|
||||
# NOTE: The username is compared case-sensitively.
|
||||
# Default is 10.
|
||||
# Increase it to avoid issue like below:
|
||||
# "Maximum number of concurrent IMAP connections exceeded"
|
||||
mail_max_userip_connections = 30
|
||||
}
|
||||
|
||||
protocol pop3 {
|
||||
mail_plugins = $mail_plugins last_login
|
||||
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
|
||||
pop3_uidl_format = %08Xu%08Xv
|
||||
|
||||
# Maximum number of IMAP connections allowed for a user from each IP address.
|
||||
# NOTE: The username is compared case-sensitively.
|
||||
# Default is 10.
|
||||
mail_max_userip_connections = 30
|
||||
|
||||
# POP3 logout format string:
|
||||
# %i - total number of bytes read from client
|
||||
# %o - total number of bytes sent to client
|
||||
# %t - number of TOP commands
|
||||
# %p - number of bytes sent to client as a result of TOP command
|
||||
# %r - number of RETR commands
|
||||
# %b - number of bytes sent to client as a result of RETR command
|
||||
# %d - number of deleted messages
|
||||
# %m - number of messages (before deletion)
|
||||
# %s - mailbox size in bytes (before deletion)
|
||||
# Default format doesn't have 'in=%i, out=%o'.
|
||||
#pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s, in=%i, out=%o
|
||||
}
|
||||
|
||||
# Login processes. Refer to Dovecot wiki for more details:
|
||||
# http://wiki2.dovecot.org/LoginProcess
|
||||
service imap-login {
|
||||
#inet_listener imap {
|
||||
# port = 143
|
||||
#}
|
||||
#inet_listener imaps {
|
||||
# port = 993
|
||||
# ssl = yes
|
||||
#}
|
||||
|
||||
service_count = 1
|
||||
|
||||
# To avoid startup latency for new client connections, set process_min_avail
|
||||
# to higher than zero. That many idling processes are always kept around
|
||||
# waiting for new connections.
|
||||
#process_min_avail = 0
|
||||
|
||||
# number of simultaneous IMAP connections
|
||||
process_limit = 500
|
||||
|
||||
# vsz_limit should be fine at its default 64MB value
|
||||
#vsz_limit = 64M
|
||||
}
|
||||
|
||||
service pop3-login {
|
||||
#inet_listener pop3 {
|
||||
# port = 110
|
||||
#}
|
||||
#inet_listener pop3s {
|
||||
# port = 995
|
||||
# ssl = yes
|
||||
#}
|
||||
|
||||
service_count = 1
|
||||
|
||||
# number of simultaneous POP3 connections
|
||||
#process_limit = 500
|
||||
}
|
||||
|
||||
service managesieve-login {
|
||||
inet_listener sieve {
|
||||
# Listen on localhost (ipv4)
|
||||
address = PH_MANAGESIEVE_BIND_HOST
|
||||
port = PH_MANAGESIEVE_BIND_PORT
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
type = private
|
||||
separator = /
|
||||
prefix =
|
||||
inbox = yes
|
||||
|
||||
# Refer to document for more details about alias mailbox:
|
||||
# http://wiki2.dovecot.org/MailboxSettings
|
||||
#
|
||||
# Sent
|
||||
mailbox Sent {
|
||||
auto = subscribe
|
||||
special_use = \Sent
|
||||
}
|
||||
mailbox "Sent Messages" {
|
||||
auto = no
|
||||
special_use = \Sent
|
||||
}
|
||||
mailbox "Sent Items" {
|
||||
auto = no
|
||||
special_use = \Sent
|
||||
}
|
||||
|
||||
mailbox Drafts {
|
||||
auto = subscribe
|
||||
special_use = \Drafts
|
||||
}
|
||||
|
||||
# Trash
|
||||
mailbox Trash {
|
||||
auto = subscribe
|
||||
special_use = \Trash
|
||||
}
|
||||
|
||||
mailbox "Deleted Messages" {
|
||||
auto = no
|
||||
special_use = \Trash
|
||||
}
|
||||
|
||||
# Junk
|
||||
mailbox Junk {
|
||||
auto = subscribe
|
||||
special_use = \Junk
|
||||
}
|
||||
mailbox Spam {
|
||||
auto = no
|
||||
special_use = \Junk
|
||||
}
|
||||
mailbox "Junk E-mail" {
|
||||
auto = no
|
||||
special_use = \Junk
|
||||
}
|
||||
|
||||
# Archive
|
||||
mailbox Archive {
|
||||
auto = no
|
||||
special_use = \Archive
|
||||
}
|
||||
mailbox Archives {
|
||||
auto = no
|
||||
special_use = \Archive
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
type = shared
|
||||
separator = /
|
||||
prefix = Shared/%%u/
|
||||
location = maildir:%%Lh/Maildir/:INDEX=%%Lh/Maildir/Shared/%%Ld/%%Ln
|
||||
|
||||
# this namespace should handle its own subscriptions or not.
|
||||
subscriptions = yes
|
||||
list = children
|
||||
}
|
||||
|
||||
# Public mailboxes.
|
||||
# Refer to Dovecot wiki page for more details:
|
||||
# http://wiki2.dovecot.org/SharedMailboxes/Public
|
||||
#namespace {
|
||||
# type = public
|
||||
# separator = /
|
||||
# prefix = Public/
|
||||
# location = maildir:PH_PUBLIC_MAILBOX_DIR:CONTROL=%Lh/Maildir/public:INDEXPVT=%Lh/Maildir/public
|
||||
#
|
||||
# # Allow users to subscribe to the public folders.
|
||||
# subscriptions = yes
|
||||
#}
|
||||
|
||||
!include_try PH_DOVECOT_CONF_INCLUDE_DIR/*.conf
|
||||
@@ -0,0 +1,496 @@
|
||||
# More details about Dovecot settings:
|
||||
# - http://wiki2.dovecot.org/
|
||||
# - http://wiki2.dovecot.org/Variables
|
||||
|
||||
# Listen addresses.
|
||||
# - '*' means all available IPv4 addresses.
|
||||
# - '[::]' means all available IPv6 addresses.
|
||||
# Listen on all available addresses by default
|
||||
listen = * [::]
|
||||
|
||||
#base_dir = PH_BASE_DIR
|
||||
mail_plugins = quota mailbox_alias acl mail_log notify
|
||||
|
||||
# Enabled mail protocols.
|
||||
protocols = PH_PROTOCOLS
|
||||
|
||||
# User/group who owns the message files:
|
||||
mail_uid = PH_MAIL_UID
|
||||
mail_gid = PH_MAIL_GID
|
||||
|
||||
# Assign uid to virtual users.
|
||||
first_valid_uid = PH_FIRST_VALID_UID
|
||||
last_valid_uid = PH_LAST_VALID_UID
|
||||
|
||||
# Logging. Reference: http://wiki2.dovecot.org/Logging
|
||||
#
|
||||
# Use syslog
|
||||
syslog_facility = PH_IREDMAIL_SYSLOG_FACILITY
|
||||
# Log file path if we use internal log system
|
||||
#log_path = PH_LOG_PATH
|
||||
|
||||
# Debug
|
||||
#mail_debug = yes
|
||||
#auth_verbose = yes
|
||||
#auth_debug = yes
|
||||
#auth_debug_passwords = yes
|
||||
# Possible values: no, plain, sha1.
|
||||
#auth_verbose_passwords = no
|
||||
|
||||
# SSL: Global settings.
|
||||
# Refer to wiki site for per protocol, ip, server name SSL settings:
|
||||
# http://wiki2.dovecot.org/SSL/DovecotConfiguration
|
||||
ssl_min_protocol = TLSv1.2
|
||||
ssl = required
|
||||
verbose_ssl = no
|
||||
#ssl_ca = </path/to/ca
|
||||
ssl_cert = <PH_SSL_CERT
|
||||
ssl_key = <PH_SSL_KEY
|
||||
ssl_dh = <PH_SSL_DH1024_PARAM_FILE
|
||||
|
||||
# Fix 'The Logjam Attack'
|
||||
ssl_cipher_list = PH_SSL_CIPHERS
|
||||
ssl_prefer_server_ciphers = yes
|
||||
|
||||
# With disable_plaintext_auth=yes AND ssl=required, STARTTLS is mandatory.
|
||||
# Set disable_plaintext_auth=no AND ssl=yes to allow plain password transmitted
|
||||
# insecurely.
|
||||
disable_plaintext_auth = yes
|
||||
|
||||
# Allow plain text password per IP address/net
|
||||
#remote 192.168.0.0/24 {
|
||||
# disable_plaintext_auth = no
|
||||
#}
|
||||
|
||||
# Mail location and mailbox format.
|
||||
mail_location = maildir:%Lh/Maildir/:INDEX=%Lh/Maildir/
|
||||
|
||||
# Authentication related settings.
|
||||
# Append this domain name if client gives empty realm.
|
||||
#auth_default_realm = PH_AUTH_DEFAULT_REALM
|
||||
|
||||
# Authentication mechanisms.
|
||||
auth_mechanisms = PLAIN LOGIN
|
||||
|
||||
# Limits the number of users that can be logging in at the same time.
|
||||
# Default is 100. This can be overridden by `process_limit =` in
|
||||
# `service [protocol]` block.
|
||||
# e.g.
|
||||
# protocol imap-login {
|
||||
# ...
|
||||
# process_limit = 500
|
||||
# }
|
||||
#default_process_limit = 100
|
||||
|
||||
# Login log elements.
|
||||
# Add '%k' for detailed SSL protocol and cipher information.
|
||||
# e.g. "TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)"
|
||||
login_log_format_elements = user=<%u> method=%m rip=%r lip=%l mpid=%e %c %k session=<%{session}>
|
||||
|
||||
# Mail delivery log format
|
||||
deliver_log_format = from=%{from}, envelope_sender=%{from_envelope}, subject=%{subject}, msgid=%m, size=%{size}, delivery_time=%{delivery_time}ms, %$
|
||||
|
||||
service auth {
|
||||
unix_listener PH_POSTFIX_CHROOT_DIR/private/dovecot-auth {
|
||||
user = PH_DOVECOT_AUTH_USER
|
||||
group = PH_DOVECOT_AUTH_GROUP
|
||||
mode = 0666
|
||||
}
|
||||
unix_listener auth-master {
|
||||
user = PH_AUTH_MASTER_USER
|
||||
group = PH_AUTH_MASTER_GROUP
|
||||
mode = 0666
|
||||
}
|
||||
unix_listener auth-userdb {
|
||||
user = PH_AUTH_MASTER_USER
|
||||
group = PH_AUTH_MASTER_GROUP
|
||||
mode = 0660
|
||||
}
|
||||
}
|
||||
|
||||
# LMTP server (Local Mail Transfer Protocol).
|
||||
# Reference: http://wiki2.dovecot.org/LMTP
|
||||
service lmtp {
|
||||
user = PH_AUTH_MASTER_USER
|
||||
|
||||
# For higher volume sites, it may be desirable to increase the number of
|
||||
# active listener processes. A range of 5 to 20 is probably good for most
|
||||
# sites.
|
||||
process_min_avail = 5
|
||||
|
||||
# Logging.
|
||||
# Require 'log_path =' in 'protocol lmtp {}' block.
|
||||
executable = lmtp -L
|
||||
|
||||
# Listening on socket file and TCP
|
||||
unix_listener PH_POSTFIX_CHROOT_DIR/private/dovecot-lmtp {
|
||||
user = PH_DOVECOT_AUTH_USER
|
||||
group = PH_DOVECOT_AUTH_GROUP
|
||||
mode = 0600
|
||||
}
|
||||
|
||||
inet_listener lmtp {
|
||||
# Listen on localhost (ipv4)
|
||||
address = PH_LMTP_BIND_ADDRESS
|
||||
port = PH_LMTP_BIND_PORT
|
||||
}
|
||||
}
|
||||
|
||||
# Virtual mail accounts.
|
||||
userdb {
|
||||
args = PH_USERDB_ARGS
|
||||
driver = PH_USERDB_DRIVER
|
||||
}
|
||||
passdb {
|
||||
args = PH_PASSDB_ARGS
|
||||
driver = PH_PASSDB_DRIVER
|
||||
}
|
||||
|
||||
# Master user.
|
||||
# Master users are able to log in as other users. It's also possible to
|
||||
# directly log in as any user using a master password, although this isn't
|
||||
# recommended.
|
||||
# Reference: http://wiki2.dovecot.org/Authentication/MasterUsers
|
||||
auth_master_user_separator = *
|
||||
passdb {
|
||||
driver = passwd-file
|
||||
args = PH_DOVECOT_MASTER_USER_PASSWORD_FILE
|
||||
master = yes
|
||||
}
|
||||
|
||||
plugin {
|
||||
# Quota configuration.
|
||||
# Reference: http://wiki2.dovecot.org/Quota/Configuration
|
||||
quota = PH_QUOTA_TYPE
|
||||
|
||||
# Set default quota rule if no quota returned from SQL/LDAP query.
|
||||
#quota_rule = *:storage=1G
|
||||
#quota_rule2 = *:messages=0
|
||||
#quota_rule3 = Trash:storage=1G
|
||||
#quota_rule4 = Junk:ignore
|
||||
|
||||
# Quota warning.
|
||||
#
|
||||
# If user suddenly receives a huge mail and the quota jumps from
|
||||
# 85% to 95%, only the 95% script is executed.
|
||||
#
|
||||
# Only the command for the first exceeded limit is executed, so configure
|
||||
# the highest limit first.
|
||||
quota_warning = storage=100%% quota-warning 100 %u
|
||||
quota_warning2 = storage=95%% quota-warning 95 %u
|
||||
quota_warning3 = storage=90%% quota-warning 90 %u
|
||||
quota_warning4 = storage=85%% quota-warning 85 %u
|
||||
|
||||
# allow user to become max 10% (or 50 MB) over quota
|
||||
quota_grace = 10%%
|
||||
#quota_grace = 50 M
|
||||
|
||||
# Custom Quota Exceeded Message.
|
||||
# You can specify the message directly or read the message from a file.
|
||||
#quota_exceeded_message = Quota exceeded, please try again later.
|
||||
#quota_exceeded_message = </path/to/quota_exceeded_message.txt
|
||||
|
||||
# Used by quota-status service.
|
||||
quota_status_success = DUNNO
|
||||
quota_status_nouser = DUNNO
|
||||
quota_status_overquota = "552 5.2.2 Mailbox is full"
|
||||
|
||||
# Plugin: expire.
|
||||
#expire = Trash 7 Trash/* 7 Junk 30
|
||||
#expire_dict = proxy::expire
|
||||
|
||||
# ACL and share folder
|
||||
acl = vfile
|
||||
acl_shared_dict = proxy::acl
|
||||
|
||||
# By default Dovecot doesn't allow using the IMAP "anyone" or
|
||||
# "authenticated" identifier, because it would be an easy way to spam
|
||||
# other users in the system. If you wish to allow it,
|
||||
#acl_anyone = allow
|
||||
|
||||
# Pigeonhole managesieve service.
|
||||
# Reference: http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration
|
||||
# Per-user sieve settings.
|
||||
sieve_dir = ~/sieve
|
||||
sieve = ~/sieve/PH_SIEVE_RULE_FILENAME
|
||||
|
||||
# Global sieve settings.
|
||||
sieve_global_dir = PH_SIEVE_DIR
|
||||
# Note: if user has personal sieve script, global sieve rules defined in
|
||||
# sieve_default will be ignored. Please use sieve_before or
|
||||
# sieve_after instead.
|
||||
#sieve_default =
|
||||
|
||||
sieve_before = PH_GLOBAL_SIEVE_FILE
|
||||
#sieve_after =
|
||||
|
||||
# The maximum number of redirect actions that can be performed during a
|
||||
# single script execution.
|
||||
# The meaning of 0 differs based on your version. For pigeonhole-0.3.0 and
|
||||
# beyond this means that redirect is prohibited. For older versions,
|
||||
# however, this means that the number of redirects is unlimited.
|
||||
sieve_max_redirects = 30
|
||||
|
||||
# Use recipient as vacation message sender instead of null sender (<>).
|
||||
sieve_vacation_send_from_recipient = yes
|
||||
|
||||
# Reference: http://wiki2.dovecot.org/Plugins/MailboxAlias
|
||||
mailbox_alias_old = Sent
|
||||
mailbox_alias_new = Sent Messages
|
||||
mailbox_alias_old2 = Sent
|
||||
mailbox_alias_new2 = Sent Items
|
||||
|
||||
# Events to log. `autoexpunge` is included in `expunge`
|
||||
# Defined in https://github.com/dovecot/core/blob/master/src/plugins/mail-log/mail-log-plugin.c
|
||||
mail_log_events = delete undelete expunge copy mailbox_create mailbox_delete mailbox_rename
|
||||
mail_log_fields = uid box msgid size from subject flags
|
||||
|
||||
# Track user last login
|
||||
last_login_dict = proxy::lastlogin
|
||||
last_login_key = last-login/%s/%u/%d
|
||||
}
|
||||
|
||||
service stats {
|
||||
fifo_listener stats-mail {
|
||||
user = PH_DOVECOT_SERVICE_STATS_USER
|
||||
mode = 0644
|
||||
}
|
||||
|
||||
unix_listener stats-writer {
|
||||
user = PH_DOVECOT_SERVICE_STATS_USER
|
||||
group = PH_DOVECOT_SERVICE_STATS_GROUP
|
||||
mode = 0660
|
||||
}
|
||||
|
||||
inet_listener {
|
||||
address = 127.0.0.1
|
||||
port = PH_DOVECOT_SERVICE_STATS_PORT
|
||||
}
|
||||
}
|
||||
|
||||
service quota-warning {
|
||||
executable = script PH_QUOTA_WARNING_SCRIPT
|
||||
unix_listener quota-warning {
|
||||
user = PH_QUOTA_WARNING_USER
|
||||
group = PH_QUOTA_WARNING_GROUP
|
||||
mode = 0660
|
||||
}
|
||||
}
|
||||
|
||||
service quota-status {
|
||||
# '-p <protocol>'. Currently only 'postfix' protocol is supported.
|
||||
executable = quota-status -p postfix
|
||||
client_limit = 1
|
||||
inet_listener {
|
||||
address = PH_DOVECOT_SERVICE_QUOTA_STATUS_BIND_ADDRESS
|
||||
port = PH_DOVECOT_SERVICE_QUOTA_STATUS_PORT
|
||||
}
|
||||
}
|
||||
|
||||
service dict {
|
||||
unix_listener dict {
|
||||
mode = 0660
|
||||
user = PH_SERVICE_DICT_USER
|
||||
group = PH_SERVICE_DICT_GROUP
|
||||
}
|
||||
}
|
||||
|
||||
dict {
|
||||
#expire = db:/var/lib/dovecot/expire/expire.db
|
||||
quotadict = PH_DOVECOT_SQL_DBN:PH_DOVECOT_REALTIME_QUOTA_CONF
|
||||
acl = PH_DOVECOT_SQL_DBN:PH_DOVECOT_SHARE_FOLDER_CONF
|
||||
lastlogin = PH_DOVECOT_SQL_DBN:PH_DOVECOT_LAST_LOGIN_CONF
|
||||
}
|
||||
|
||||
protocol lda {
|
||||
mail_plugins = $mail_plugins sieve
|
||||
lda_mailbox_autocreate = yes
|
||||
lda_mailbox_autosubscribe = yes
|
||||
}
|
||||
|
||||
protocol lmtp {
|
||||
# Plugins
|
||||
mail_plugins = $mail_plugins sieve
|
||||
|
||||
# Address extension delivery
|
||||
lmtp_save_to_detail_mailbox = yes
|
||||
recipient_delimiter = +
|
||||
}
|
||||
|
||||
protocol imap {
|
||||
mail_plugins = $mail_plugins imap_quota imap_acl last_login
|
||||
imap_client_workarounds = tb-extra-mailbox-sep
|
||||
|
||||
# Maximum number of IMAP connections allowed for a user from each IP address.
|
||||
# NOTE: The username is compared case-sensitively.
|
||||
# Default is 10.
|
||||
# Increase it to avoid issue like below:
|
||||
# "Maximum number of concurrent IMAP connections exceeded"
|
||||
mail_max_userip_connections = 30
|
||||
}
|
||||
|
||||
protocol pop3 {
|
||||
mail_plugins = $mail_plugins last_login
|
||||
pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
|
||||
pop3_uidl_format = %08Xu%08Xv
|
||||
|
||||
# Maximum number of IMAP connections allowed for a user from each IP address.
|
||||
# NOTE: The username is compared case-sensitively.
|
||||
# Default is 10.
|
||||
mail_max_userip_connections = 30
|
||||
|
||||
# POP3 logout format string:
|
||||
# %i - total number of bytes read from client
|
||||
# %o - total number of bytes sent to client
|
||||
# %t - number of TOP commands
|
||||
# %p - number of bytes sent to client as a result of TOP command
|
||||
# %r - number of RETR commands
|
||||
# %b - number of bytes sent to client as a result of RETR command
|
||||
# %d - number of deleted messages
|
||||
# %m - number of messages (before deletion)
|
||||
# %s - mailbox size in bytes (before deletion)
|
||||
# Default format doesn't have 'in=%i, out=%o'.
|
||||
#pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s, in=%i, out=%o
|
||||
}
|
||||
|
||||
# Login processes. Refer to Dovecot wiki for more details:
|
||||
# http://wiki2.dovecot.org/LoginProcess
|
||||
service imap-login {
|
||||
#inet_listener imap {
|
||||
# port = 143
|
||||
#}
|
||||
#inet_listener imaps {
|
||||
# port = 993
|
||||
# ssl = yes
|
||||
#}
|
||||
|
||||
service_count = 1
|
||||
|
||||
# To avoid startup latency for new client connections, set process_min_avail
|
||||
# to higher than zero. That many idling processes are always kept around
|
||||
# waiting for new connections.
|
||||
#process_min_avail = 0
|
||||
|
||||
# number of simultaneous IMAP connections
|
||||
process_limit = 500
|
||||
|
||||
# vsz_limit should be fine at its default 64MB value
|
||||
#vsz_limit = 64M
|
||||
}
|
||||
|
||||
service pop3-login {
|
||||
#inet_listener pop3 {
|
||||
# port = 110
|
||||
#}
|
||||
#inet_listener pop3s {
|
||||
# port = 995
|
||||
# ssl = yes
|
||||
#}
|
||||
|
||||
service_count = 1
|
||||
|
||||
# number of simultaneous POP3 connections
|
||||
#process_limit = 500
|
||||
}
|
||||
|
||||
service managesieve-login {
|
||||
inet_listener sieve {
|
||||
# Listen on localhost (ipv4)
|
||||
address = PH_MANAGESIEVE_BIND_HOST
|
||||
port = PH_MANAGESIEVE_BIND_PORT
|
||||
}
|
||||
}
|
||||
|
||||
metric imap_command_finished {
|
||||
event_name = imap_command_finished
|
||||
}
|
||||
|
||||
namespace {
|
||||
type = private
|
||||
separator = /
|
||||
prefix =
|
||||
inbox = yes
|
||||
|
||||
# Refer to document for more details about alias mailbox:
|
||||
# http://wiki2.dovecot.org/MailboxSettings
|
||||
#
|
||||
# Sent
|
||||
mailbox Sent {
|
||||
auto = subscribe
|
||||
special_use = \Sent
|
||||
}
|
||||
mailbox "Sent Messages" {
|
||||
auto = no
|
||||
special_use = \Sent
|
||||
}
|
||||
mailbox "Sent Items" {
|
||||
auto = no
|
||||
special_use = \Sent
|
||||
}
|
||||
|
||||
mailbox Drafts {
|
||||
auto = subscribe
|
||||
special_use = \Drafts
|
||||
}
|
||||
|
||||
# Trash
|
||||
mailbox Trash {
|
||||
auto = subscribe
|
||||
special_use = \Trash
|
||||
}
|
||||
|
||||
mailbox "Deleted Messages" {
|
||||
auto = no
|
||||
special_use = \Trash
|
||||
}
|
||||
|
||||
# Junk
|
||||
mailbox Junk {
|
||||
auto = subscribe
|
||||
special_use = \Junk
|
||||
}
|
||||
mailbox Spam {
|
||||
auto = no
|
||||
special_use = \Junk
|
||||
}
|
||||
mailbox "Junk E-mail" {
|
||||
auto = no
|
||||
special_use = \Junk
|
||||
}
|
||||
|
||||
# Archive
|
||||
mailbox Archive {
|
||||
auto = no
|
||||
special_use = \Archive
|
||||
}
|
||||
mailbox Archives {
|
||||
auto = no
|
||||
special_use = \Archive
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
type = shared
|
||||
separator = /
|
||||
prefix = Shared/%%u/
|
||||
location = maildir:%%Lh/Maildir/:INDEX=%%Lh/Maildir/Shared/%%Ld/%%Ln
|
||||
|
||||
# this namespace should handle its own subscriptions or not.
|
||||
subscriptions = yes
|
||||
list = children
|
||||
}
|
||||
|
||||
# Public mailboxes.
|
||||
# Refer to Dovecot wiki page for more details:
|
||||
# http://wiki2.dovecot.org/SharedMailboxes/Public
|
||||
#namespace {
|
||||
# type = public
|
||||
# separator = /
|
||||
# prefix = Public/
|
||||
# location = maildir:PH_PUBLIC_MAILBOX_DIR:CONTROL=%Lh/Maildir/public:INDEXPVT=%Lh/Maildir/public
|
||||
#
|
||||
# # Allow users to subscribe to the public folders.
|
||||
# subscriptions = yes
|
||||
#}
|
||||
|
||||
!include_try PH_DOVECOT_CONF_INCLUDE_DIR/*.conf
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# IMAP shared folders. User 'from_user' shares folders to user 'to_user'.
|
||||
# WARNING: Works only with Dovecot 1.2+.
|
||||
#
|
||||
CREATE TABLE IF NOT EXISTS share_folder (
|
||||
from_user VARCHAR(150) NOT NULL,
|
||||
to_user VARCHAR(150) NOT NULL,
|
||||
dummy CHAR(1),
|
||||
PRIMARY KEY (from_user, to_user)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS anyone_shares (
|
||||
from_user VARCHAR(255) NOT NULL,
|
||||
dummy CHAR(1) DEFAULT '1',
|
||||
PRIMARY KEY (from_user)
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE IF NOT EXISTS `last_login` (
|
||||
`username` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`domain` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`imap` INT(11) DEFAULT NULL,
|
||||
`pop3` INT(11) DEFAULT NULL,
|
||||
`lda` INT(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`username`),
|
||||
INDEX (`domain`),
|
||||
INDEX (`imap`),
|
||||
INDEX (`pop3`),
|
||||
INDEX (`lda`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@@ -0,0 +1,26 @@
|
||||
-- used_quota
|
||||
-- Used to store realtime mailbox quota in Dovecot.
|
||||
-- WARNING: Works only with Dovecot 1.2+.
|
||||
--
|
||||
-- Note: Don't touch this table, it will be updated by Dovecot automatically.
|
||||
CREATE TABLE IF NOT EXISTS `used_quota` (
|
||||
`username` VARCHAR(255) NOT NULL,
|
||||
`bytes` BIGINT NOT NULL DEFAULT 0,
|
||||
`messages` BIGINT NOT NULL DEFAULT 0,
|
||||
`domain` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`username`),
|
||||
INDEX (domain)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Trigger `used_quota_before_insert` is used to set `used_quota.domain`.
|
||||
-- NOTE: `used_quota.domain` is not used by Dovecot, but used in iRedAdmin to
|
||||
-- get better SQL query performance while calculating per-domain used
|
||||
-- quota.
|
||||
DELIMITER //
|
||||
CREATE TRIGGER `used_quota_before_insert`
|
||||
BEFORE INSERT ON `used_quota` FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.domain = SUBSTRING_INDEX(NEW.username, '@', -1);
|
||||
END;
|
||||
//
|
||||
DELIMITER ;
|
||||
@@ -0,0 +1,3 @@
|
||||
[Service]
|
||||
ProtectSystem=false
|
||||
#ProtectHome=false
|
||||
@@ -0,0 +1,10 @@
|
||||
# - Store banned IP in SQL db while it's banned.
|
||||
# - Remove banned IP from SQL db while it's unbanned.
|
||||
|
||||
[Definition]
|
||||
actionstart =
|
||||
actioncheck =
|
||||
|
||||
actionban = /usr/local/bin/fail2ban_banned_db ban <ip> <port> <protocol> <name> <ipjailfailures> <ipjailmatches>
|
||||
actionunban = /usr/local/bin/fail2ban_banned_db unban <ip>
|
||||
actionstop = /usr/local/bin/fail2ban_banned_db cleanup <name>
|
||||
@@ -0,0 +1,236 @@
|
||||
#!/usr/bin/env bash
|
||||
# Author: Zhang Huangbin <zhb@iredmail.org>
|
||||
# Puprpose:
|
||||
# - Store banned IP address in SQL db while it's banned by Fail2ban.
|
||||
# - Remove unbanned IP address from SQL db while it's unbanned by Fail2ban.
|
||||
# - Unban IP addresses which have column `remove=1`.
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# *) Store a banned IP address:
|
||||
#
|
||||
# banned_db ban <ip> <ports> <protocol> <jail> <failures> [loglines]
|
||||
#
|
||||
# - <ip>: One IP address each time.
|
||||
# - <ports>: Network ports. Multiple ports must be separated by comma.
|
||||
# - <protocol>: `tcp` or `udp`.
|
||||
# - <jail>: Fail2ban jail name.
|
||||
# - <failures>: number of times the failure occurred in the log file.
|
||||
# - [loglines]: matched log lines. OPTIONAL.
|
||||
#
|
||||
# *) Remove an one or multiple unbanned IP addresses. Notes:
|
||||
#
|
||||
# - it removes IP from all jails.
|
||||
# - multiple IP addresses must be separated by space.
|
||||
#
|
||||
# banned_db unban <ip> [ip] [ip]
|
||||
#
|
||||
# *) Cleanup a jail. When Fail2ban is stopping or restarting, `cleanup` will
|
||||
# be executed. Cleanup manually is supported too:
|
||||
#
|
||||
# banned_db cleanup <jail>
|
||||
#
|
||||
# *) Query SQL db and remove IP addresses which have `remove=1`.
|
||||
#
|
||||
# banned_db unban_db
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
# banned_db ban 192.168.0.1 110,143,993,995 tcp dovecot-iredmail 3
|
||||
# banned_db unban 192.168.0.1
|
||||
# banned_db cleanup dovecot-iredmail
|
||||
# banned_db unban_db
|
||||
|
||||
#
|
||||
# Sample Fail2ban jail config file (/etc/fail2ban/jail.d/xx.local):
|
||||
#
|
||||
# [jail-name]
|
||||
# ...
|
||||
# action = ...[your other actions here]...
|
||||
# banned_db[name=jail-name, port="80", protocol=tcp]
|
||||
#
|
||||
# WARNING: the name set in `banned_db[name=]` must be same as the jail name.
|
||||
|
||||
export PATH="/usr/bin:/usr/local/bin:$PATH"
|
||||
|
||||
export DB_NAME="fail2ban"
|
||||
export DB_TABLE="banned"
|
||||
export DB_USER="fail2ban"
|
||||
|
||||
# GeoIP
|
||||
export CMD_GEOIPLOOKUP="$(which geoiplookup 2>/dev/null)"
|
||||
export CMD_GEOIPLOOKUP6="$(which geoiplookup6 2>/dev/null)"
|
||||
|
||||
# `dig`. Used to query reverse hostname.
|
||||
export CMD_DIG="/usr/bin/dig"
|
||||
|
||||
if [ -f /root/.my.cnf-fail2ban ]; then
|
||||
export CMD_SQL="mysql --defaults-file=/root/.my.cnf-fail2ban ${DB_NAME}"
|
||||
export DB_TYPE="mysql"
|
||||
elif [ -f /root/.my.cnf ]; then
|
||||
export CMD_SQL="mysql --defaults-file=/root/.my.cnf ${DB_NAME}"
|
||||
export DB_TYPE="mysql"
|
||||
else
|
||||
# Absolute path to ~/.pgpass
|
||||
# - RHEL: /var/lib/pgsql/.pgpass
|
||||
# - Debian/Ubuntu: /var/lib/postgresql/.pgpass
|
||||
# - FreeBSD: /var/db/postgres/.pgpass
|
||||
# - OpenBSD: /var/postgresql/.pgpass
|
||||
for dir in \
|
||||
/var/lib/pgsql \
|
||||
/var/lib/postgresql \
|
||||
/var/db/postgres \
|
||||
/var/postgresql; do
|
||||
if [ -f ${dir}/.pgpass ]; then
|
||||
export PGPASSFILE="${dir}/.pgpass"
|
||||
export CMD_SQL="psql -U ${DB_USER} -d ${DB_NAME}"
|
||||
export DB_TYPE="pgsql"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ X"${CMD_SQL}" == X'' ]; then
|
||||
echo "No MySQL or PostgreSQL related config file found. Abort."
|
||||
echo " - MySQL: /root/.my.cnf-fail2ban (or /root/.my.cnf)"
|
||||
echo " - PostgreSQL: ~/.pgpass (under PostgreSQL daemon user's home directory)"
|
||||
exit 255
|
||||
fi
|
||||
|
||||
export _action="$1"
|
||||
|
||||
if [[ X"${_action}" == X"ban" ]]; then
|
||||
_ip="${2}"
|
||||
_ports="${3}"
|
||||
_protocol="${4}"
|
||||
_jail="${5}"
|
||||
_failures="${6}"
|
||||
|
||||
shift 6
|
||||
_rest="$@"
|
||||
# Avoid SQL injection.
|
||||
printf -v _loglines "${_rest}"
|
||||
|
||||
if [[ X"${_ip}" == X'' ]] || \
|
||||
[[ X"${_ports}" == X'' ]] || \
|
||||
[[ X"${_protocol}" == X'' ]] || \
|
||||
[[ X"${_jail}" == X'' ]]; then
|
||||
echo "IP, ports, protocol, or jail name is empty. Abort."
|
||||
exit 255
|
||||
fi
|
||||
|
||||
_hostname="$(hostname)"
|
||||
|
||||
# Lookup for country name.
|
||||
_country=''
|
||||
if echo ${_ip} | grep ':' &>/dev/null; then
|
||||
if [[ -x ${CMD_GEOIPLOOKUP6} ]]; then
|
||||
_country="$(${CMD_GEOIPLOOKUP6} ${_ip} | grep '^GeoIP Country Edition:' | awk -F': ' '{print $2}' | grep -iv 'not found')"
|
||||
fi
|
||||
else
|
||||
if [[ -x ${CMD_GEOIPLOOKUP} ]]; then
|
||||
_country="$(${CMD_GEOIPLOOKUP} ${_ip} | grep '^GeoIP Country Edition:' | awk -F': ' '{print $2}' | grep -iv 'not found')"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Lookup reverse DNS name.
|
||||
_rdns=''
|
||||
if [[ -x "${CMD_DIG}" ]]; then
|
||||
_rdns_orig="$(${CMD_DIG} +short +timeout=3 -x ${_ip} 2>/dev/null)"
|
||||
_rdns_strip="${_rdns_orig%\.}"
|
||||
printf -v _rdns "${_rdns_strip}"
|
||||
fi
|
||||
|
||||
if [ X"${DB_TYPE}" == X'mysql' ]; then
|
||||
# MySQL stores local time with time zone info, we expect UTC time.
|
||||
${CMD_SQL} <<EOF
|
||||
INSERT IGNORE INTO ${DB_TABLE} (
|
||||
ip, ports, protocol, jail,
|
||||
hostname, country, rdns, timestamp,
|
||||
failures, loglines)
|
||||
VALUES (
|
||||
'${_ip}', '${_ports}', '${_protocol}', '${_jail}',
|
||||
'${_hostname}', '${_country}', '${_rdns}', UTC_TIMESTAMP(),
|
||||
'${_failures}', '${_loglines}');
|
||||
EOF
|
||||
else
|
||||
# CentOS 7 ships PostgreSQL-9.2 which doesn't support `ON CONFLICT DO NOTHING`,
|
||||
# so we query it first, insert it if not existing.
|
||||
(${CMD_SQL} <<EOF
|
||||
SELECT id FROM ${DB_TABLE} WHERE ip='${_ip}' AND ports='${_ports}' AND protocol='${_protocol}' AND jail='${_jail}' LIMIT 1;
|
||||
EOF
|
||||
) | grep '1 row' &>/dev/null
|
||||
|
||||
if [[ X"$?" == X'0' ]]; then
|
||||
echo "Already banned."
|
||||
else
|
||||
${CMD_SQL} >/dev/null <<EOF
|
||||
INSERT INTO ${DB_TABLE} (
|
||||
ip, ports, protocol, jail,
|
||||
hostname, country, rdns,
|
||||
failures, loglines)
|
||||
VALUES (
|
||||
'${_ip}', '${_ports}', '${_protocol}', '${_jail}',
|
||||
'${_hostname}', '${_country}', '${_rdns}',
|
||||
'${_failures}', '${_loglines}');
|
||||
EOF
|
||||
echo "Stored."
|
||||
fi
|
||||
fi
|
||||
|
||||
elif [[ X"${_action}" == X"unban" ]]; then
|
||||
shift 1
|
||||
_ips="$@"
|
||||
|
||||
if [[ X"${_ips}" == X'' ]]; then
|
||||
echo "No IP address(es) specified."
|
||||
else
|
||||
for _ip in ${_ips}; do
|
||||
${CMD_SQL} <<EOF
|
||||
DELETE FROM ${DB_TABLE} WHERE ip='${_ip}';
|
||||
EOF
|
||||
done
|
||||
|
||||
[[ X"$?" == X'0' ]] && echo "Removed."
|
||||
fi
|
||||
|
||||
elif [[ X"${_action}" == X"cleanup" ]]; then
|
||||
_jail="$2"
|
||||
|
||||
if [[ X"${_jail}" != X'' ]]; then
|
||||
${CMD_SQL} <<EOF
|
||||
DELETE FROM ${DB_TABLE} WHERE jail='${_jail}';
|
||||
EOF
|
||||
fi
|
||||
|
||||
[[ X"$?" == X'0' ]] && echo "All IP addresses have been removed."
|
||||
elif [[ X"${_action}" == X"unban_db" ]]; then
|
||||
# Call fail2ban-client to unban given IP address(es).
|
||||
tmp_file="$(mktemp)"
|
||||
|
||||
# Exclude extra info on output, just leave jail/ip.
|
||||
(${CMD_SQL} <<EOF
|
||||
SELECT jail, ip FROM ${DB_TABLE} WHERE remove=1;
|
||||
EOF
|
||||
) | grep -Ev '(jail.*ip|\--|\(|^$)' | tr -d '|' >> ${tmp_file}
|
||||
|
||||
while read jail ip; do
|
||||
# Avoid SQL injection: don't allow whitespace, ';', quotes in
|
||||
# jail name and IP address.
|
||||
if echo ${jail} | grep "[ ;\"\']" &>/dev/null; then
|
||||
echo "[WARNING] Invalid jail name: '${jail}'."
|
||||
continue
|
||||
fi
|
||||
|
||||
if echo ${ip} | grep "[ ;\"\']" &>/dev/null; then
|
||||
echo "[WARNING] Invalid IP address: '${ip}'."
|
||||
continue
|
||||
fi
|
||||
|
||||
# fail2ban-client returns number of processed rows on command line,
|
||||
# let's discard it to avoid noise/confusion.
|
||||
fail2ban-client set ${jail} unbanip ${ip} >/dev/null
|
||||
[[ X"$?" == X'0' ]] && echo "Unbanned ${ip} from jail [${jail}]."
|
||||
done < ${tmp_file}
|
||||
rm -f ${tmp_file} &>/dev/null
|
||||
fi
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
[Definition]
|
||||
|
||||
# Option: loglevel. Default is ERROR
|
||||
# Available options: CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG
|
||||
loglevel = INFO
|
||||
|
||||
# Set the log target
|
||||
logtarget = SYSLOG
|
||||
|
||||
# Syslog socket. Required on FreeBSD and OpenBSD.
|
||||
#syslogsocket = PH_SYSLOG_SOCKET
|
||||
|
||||
# Fail2ban socket. Required on FreeBSD.
|
||||
#socket = /var/run/fail2ban/fail2ban.sock
|
||||
@@ -0,0 +1,5 @@
|
||||
[Definition]
|
||||
failregex = Authentication failure.* rip=<HOST>
|
||||
\(auth failed.* rip=<HOST>
|
||||
|
||||
ignoreregex =
|
||||
@@ -0,0 +1,16 @@
|
||||
[Definition]
|
||||
|
||||
# Block clients which cannot pass Postfix postscreen pregreet test.
|
||||
# FYI: http://www.postfix.org/POSTSCREEN_README.html#pregreet
|
||||
#
|
||||
# The SMTP protocol is a classic example of a protocol where the server speaks
|
||||
# before the client. postscreen(8) detects zombies that are in a hurry and that
|
||||
# speak before their turn.
|
||||
failregex = postscreen\[\d+\]: PREGREET .* from \[<HOST>\]:\d+:
|
||||
|
||||
# while setting up new account, Thunderbird doesn't wait for server connection
|
||||
# greeting/banner, this causes Thunderbird cannot pass the Postfix pregreet
|
||||
# test and caught by `failregex` rules listed above (the rule contains
|
||||
# 'PREGREET' line).
|
||||
# FYI: https://bugzilla.mozilla.org/show_bug.cgi?id=538809#c41
|
||||
ignoreregex = postscreen\[\d+\]: PREGREET .* from \[<HOST>\]:\d+: (EHLO|HELO) we-guess.mozilla.org
|
||||
@@ -0,0 +1,17 @@
|
||||
[Definition]
|
||||
# *) '554 5.7.1' is 'Helo command rejected: ACCESS DENIED'
|
||||
#
|
||||
# 'ACCESS DENIED' is string defined in postfix restriction rule `check_helo_access`.
|
||||
# no all rules contains 'ACCESS DENIED', so we use status code insead.
|
||||
|
||||
failregex = \[<HOST>\]: SASL (PLAIN|LOGIN) authentication failed
|
||||
lost connection after (AUTH|UNKNOWN) from (.*)\[<HOST>\]
|
||||
reject: RCPT from .*\[<HOST>\]: .*: Relay access denied
|
||||
reject: RCPT from .*\[<HOST>\]: .*: Sender address rejected: Domain not found
|
||||
reject: RCPT from .*\[<HOST>\]: .*: Helo command rejected: Host not found
|
||||
reject: RCPT from .*\[<HOST>\]: .*: Helo command rejected: need fully-qualified hostname
|
||||
reject: RCPT from .*\[<HOST>\]: 554 5.7.1
|
||||
reject: RCPT from .*\[<HOST>\]:\d+: 550 5.5.1 Protocol error
|
||||
warning: Illegal address syntax from (.*)\[<HOST>\] in RCPT command
|
||||
|
||||
ignoreregex =
|
||||
@@ -0,0 +1,9 @@
|
||||
# 'X-Forwarded-For:` appears when Roundcube is running behind HAProxy.
|
||||
|
||||
[Definition]
|
||||
failregex = roundcube.* Failed login for (.*) from <HOST>\. AUTHENTICATE LOGIN
|
||||
roundcube.* Failed login for (.*) from <HOST> in session
|
||||
roundcube.* Failed login .*\(X-Forwarded-For: <HOST>\) in session
|
||||
roundcube.* Error: Login failed for (.*) from <HOST>\. LOGIN: Authentication failed.
|
||||
|
||||
ignoreregex =
|
||||
@@ -0,0 +1,8 @@
|
||||
[dovecot]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = true
|
||||
filter = dovecot.iredmail
|
||||
logpath = PH_DOVECOT_LOG_FILE
|
||||
action = PH_FAIL2BAN_ACTION[name=dovecot, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
banned_db[name=dovecot, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
@@ -0,0 +1,8 @@
|
||||
[nginx-http-auth]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = false
|
||||
filter = nginx-http-auth
|
||||
logpath = PH_NGINX_LOG_ERRORLOG
|
||||
action = PH_FAIL2BAN_ACTION[name=nginx, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
banned_db[name=nginx, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
@@ -0,0 +1,9 @@
|
||||
[postfix-pregreet]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = true
|
||||
maxretry = 1
|
||||
filter = postfix-pregreet.iredmail
|
||||
logpath = PH_MAILLOG
|
||||
action = PH_FAIL2BAN_ACTION[name=postfix-pregreet, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
banned_db[name=postfix-pregreet, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
@@ -0,0 +1,8 @@
|
||||
[postfix]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = true
|
||||
filter = postfix.iredmail
|
||||
logpath = PH_MAILLOG
|
||||
action = PH_FAIL2BAN_ACTION[name=postfix, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
banned_db[name=postfix, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
@@ -0,0 +1,9 @@
|
||||
[roundcube]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = false
|
||||
findtime = 3600
|
||||
filter = roundcube.iredmail
|
||||
logpath = PH_RCM_LOGFILE
|
||||
action = PH_FAIL2BAN_ACTION[name=roundcube, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
banned_db[name=roundcube, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
@@ -0,0 +1,8 @@
|
||||
[sogo]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = false
|
||||
filter = sogo-auth
|
||||
logpath = PH_SOGO_LOG_FILE
|
||||
action = PH_FAIL2BAN_ACTION[name=sogo, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
banned_db[name=sogo, port="PH_FAIL2BAN_DISABLED_SERVICES", protocol=tcp]
|
||||
@@ -0,0 +1,8 @@
|
||||
[sshd]
|
||||
backend = polling
|
||||
journalmatch=
|
||||
enabled = true
|
||||
filter = sshd
|
||||
logpath = PH_SSHD_LOGFILE
|
||||
action = PH_FAIL2BAN_ACTION[name=sshd, port="PH_SSHD_PORT", protocol=tcp]
|
||||
banned_db[name=sshd, port="PH_SSHD_PORT", protocol=tcp]
|
||||
@@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
# time is in seconds. 3600 = 1 hour, 86400 = 24 hours (1 day)
|
||||
findtime = 3600
|
||||
bantime = 3600
|
||||
maxretry = 5
|
||||
ignoreip = PH_LOCAL_ADDRESS 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
daemon="/usr/local/bin/fail2ban-client"
|
||||
|
||||
. /etc/rc.d/rc.subr
|
||||
|
||||
rc_bg=YES
|
||||
rc_reload=NO
|
||||
|
||||
rc_pre() {
|
||||
install -d -o root -m 0700 /var/run/fail2ban
|
||||
}
|
||||
|
||||
rc_start() {
|
||||
${rcexec} "${daemon} start ${daemon_flags} ${_bg}"
|
||||
}
|
||||
|
||||
rc_check() {
|
||||
pgrep -q -f "fail2ban-server"
|
||||
}
|
||||
|
||||
rc_stop() {
|
||||
${rcexec} "${daemon} stop"
|
||||
}
|
||||
|
||||
rc_cmd $1
|
||||
@@ -0,0 +1,37 @@
|
||||
--
|
||||
-- Used to store banned/unbanned clients
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS `banned` (
|
||||
`id` BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
-- Banned client IP address
|
||||
`ip` VARCHAR(46) NOT NULL DEFAULT '',
|
||||
-- A list of banned network ports, separated by comma
|
||||
`ports` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- protocol: tcp, udp, ...
|
||||
`protocol` VARCHAR(10) NOT NULL DEFAULT 'tcp',
|
||||
-- Fail2ban jail name
|
||||
`jail` VARCHAR(50) NOT NULL DEFAULT '',
|
||||
-- The server hostname which the ban/unban happens
|
||||
`hostname` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`country` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- reverse DNS name of banned IP address.
|
||||
`rdns` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- number of times the failure occurred in the log file.
|
||||
-- we use Fail2ban action tag `ipjailfailures` here.
|
||||
`failures` INT(2) NOT NULL DEFAULT 0,
|
||||
-- matched log lines.
|
||||
-- we use Fail2ban action tag `ipjailmatches` here.
|
||||
`loglines` TEXT,
|
||||
-- When the ban happens
|
||||
`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
-- if `remove=1`, `ip` will be removed by cron job.
|
||||
`remove` TINYINT(1) DEFAULT 0,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE INDEX (`ip`, `ports`, `protocol`),
|
||||
INDEX (`hostname`),
|
||||
INDEX (`rdns`),
|
||||
INDEX (`jail`),
|
||||
INDEX (`country`),
|
||||
INDEX (`timestamp`),
|
||||
INDEX (`remove`)
|
||||
) ENGINE=InnoDB;
|
||||
@@ -0,0 +1,37 @@
|
||||
--
|
||||
-- Used to store banned/unbanned clients
|
||||
--
|
||||
CREATE TABLE banned (
|
||||
id SERIAL PRIMARY KEY,
|
||||
-- Banned client IP address
|
||||
ip VARCHAR(46) NOT NULL DEFAULT '',
|
||||
-- A list of banned network ports, separated by comma
|
||||
ports VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- protocol: tcp, udp, ...
|
||||
protocol VARCHAR(10) NOT NULL DEFAULT 'tcp',
|
||||
-- Fail2ban jail name
|
||||
jail VARCHAR(50) NOT NULL DEFAULT '',
|
||||
-- The server hostname which the ban/unban happens
|
||||
hostname VARCHAR(255) NOT NULL DEFAULT '',
|
||||
country VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- reverse DNS name of banned IP address.
|
||||
rdns VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- number of times the failure occurred in the log file.
|
||||
-- we use Fail2ban action tag `ipjailfailures` here.
|
||||
failures SMALLINT NOT NULL DEFAULT 0,
|
||||
-- matched log lines.
|
||||
-- we use Fail2ban action tag `ipjailmatches` here.
|
||||
loglines TEXT,
|
||||
-- When the ban happens
|
||||
timestamp TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT (CURRENT_TIMESTAMP(0) AT TIME ZONE 'UTC'),
|
||||
-- if `remove=1`, `ip` will be removed by cron job.
|
||||
remove INT2 DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX idx_banned_ip_ports_protocol ON banned (ip, ports, protocol);
|
||||
CREATE INDEX idx_banned_jail ON banned (jail);
|
||||
CREATE INDEX idx_banned_hostname ON banned (hostname);
|
||||
CREATE INDEX idx_banned_country ON banned (country);
|
||||
CREATE INDEX idx_banned_timestamp ON banned (timestamp);
|
||||
CREATE INDEX idx_banned_remove ON banned (remove);
|
||||
CREATE INDEX idx_banned_rdns ON banned (rdns);
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<service>
|
||||
<short>SSH</short>
|
||||
<description>Secure Shell (SSH) is a protocol for logging into and executing commands on remote machines. It provides secure encrypted communications. If you plan on accessing your machine remotely via SSH over a firewalled interface, enable this option. You need the openssh-server package installed for this option to be useful.</description>
|
||||
<port protocol="tcp" port="22"/>
|
||||
</service>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<zone>
|
||||
<short>Mail services</short>
|
||||
<description>Allow access to mail services from external network.</description>
|
||||
<service name="http"/>
|
||||
<service name="https"/>
|
||||
<service name="smtp"/>
|
||||
<service name="smtp-submission"/>
|
||||
<service name="pop3"/>
|
||||
<service name="pop3s"/>
|
||||
<service name="imap"/>
|
||||
<service name="imaps"/>
|
||||
<service name="ssh"/>
|
||||
</zone>
|
||||
+362
@@ -0,0 +1,362 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# This file is part of iRedMail, which is an open source mail server
|
||||
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
#
|
||||
# iRedMail is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# iRedMail is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: ip6tables
|
||||
# Required-Start: $network $syslog
|
||||
# Required-Stop: $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Control ip6tables firewall.
|
||||
### END INIT INFO
|
||||
#
|
||||
# This init.d script is used to control ip6tables, based on
|
||||
# /etc/init.d/ip6tables on Red Hat Enterprise Linux 5.3, modified
|
||||
# by Zhang Huangbin (zhb _at_ iredmail.org), iRedMail project
|
||||
# (http://www.iredmail.org/).
|
||||
#
|
||||
|
||||
#
|
||||
# config: /etc/default/ip6tables
|
||||
|
||||
# Source function library.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
IPTABLES='ip6tables'
|
||||
IPTABLES_DATA="/etc/default/$IPTABLES"
|
||||
IPTABLES_CONFIG="/etc/default/${IPTABLES}-config"
|
||||
IPV="${IPTABLES%tables}" # ip for ipv4 | ip6 for ipv6
|
||||
PROC_IPTABLES_NAMES="/proc/net/${IPV}_tables_names"
|
||||
VAR_SUBSYS_IPTABLES="/var/lock/subsys/$IPTABLES"
|
||||
[ -d $(dirname ${VAR_SUBSYS_IPTABLES}) ] || mkdir -p $(dirname ${VAR_SUBSYS_IPTABLES})
|
||||
|
||||
if [ ! -x /sbin/$IPTABLES ]; then
|
||||
log_daemon_msg "/sbin/$IPTABLES does not exist." "ip6tables"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if lsmod 2>/dev/null | grep -q ipchains ; then
|
||||
log_daemon_msg "ipchains and $IPTABLES can not be used together." "ip6tables"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Old or new modutils
|
||||
/sbin/modprobe --version 2>&1 | grep -q module-init-tools \
|
||||
&& NEW_MODUTILS=1 \
|
||||
|| NEW_MODUTILS=0
|
||||
|
||||
# Default firewall configuration:
|
||||
IPTABLES_MODULES=""
|
||||
IPTABLES_MODULES_UNLOAD="no"
|
||||
IPTABLES_SAVE_ON_STOP="no"
|
||||
IPTABLES_SAVE_ON_RESTART="no"
|
||||
IPTABLES_SAVE_COUNTER="no"
|
||||
IPTABLES_STATUS_NUMERIC="yes"
|
||||
|
||||
# Load firewall configuration.
|
||||
[ -f "$IPTABLES_CONFIG" ] && . "$IPTABLES_CONFIG"
|
||||
|
||||
rmmod_r() {
|
||||
# Unload module with all referring modules.
|
||||
# At first all referring modules will be unloaded, then the module itself.
|
||||
local mod=$1
|
||||
local ret=0
|
||||
local ref=
|
||||
|
||||
# Get referring modules.
|
||||
# New modutils have another output format.
|
||||
[ $NEW_MODUTILS = 1 ] \
|
||||
&& ref=`lsmod | awk "/^${mod}/ { print \\\$4; }" | tr ',' ' '` \
|
||||
|| ref=`lsmod | grep ^${mod} | cut -d "[" -s -f 2 | cut -d "]" -s -f 1`
|
||||
|
||||
# recursive call for all referring modules
|
||||
for i in $ref; do
|
||||
rmmod_r $i
|
||||
let ret+=$?;
|
||||
done
|
||||
|
||||
# Unload module.
|
||||
# The extra test is for 2.6: The module might have autocleaned,
|
||||
# after all referring modules are unloaded.
|
||||
if grep -q "^${mod}" /proc/modules ; then
|
||||
modprobe -r $mod > /dev/null 2>&1
|
||||
let ret+=$?;
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
flush_n_delete() {
|
||||
# Flush firewall rules and delete chains.
|
||||
[ -e "$PROC_IPTABLES_NAMES" ] || return 1
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
[ -z "$tables" ] && return 1
|
||||
|
||||
log_daemon_msg "Flushing firewall rules" "ip6tables"
|
||||
ret=0
|
||||
# For all tables
|
||||
for i in $tables; do
|
||||
# Flush firewall rules.
|
||||
$IPTABLES -t $i -F;
|
||||
let ret+=$?;
|
||||
|
||||
# Delete firewall chains.
|
||||
$IPTABLES -t $i -X;
|
||||
let ret+=$?;
|
||||
|
||||
# Set counter to zero.
|
||||
$IPTABLES -t $i -Z;
|
||||
let ret+=$?;
|
||||
done
|
||||
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
return $ret
|
||||
}
|
||||
|
||||
set_policy() {
|
||||
# Set policy for configured tables.
|
||||
policy=$1
|
||||
|
||||
# Check if iptable module is loaded
|
||||
[ ! -e "$PROC_IPTABLES_NAMES" ] && return 1
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
[ -z "$tables" ] && return 1
|
||||
|
||||
log_daemon_msg "Setting chains to policy $policy"
|
||||
ret=0
|
||||
for i in $tables; do
|
||||
echo -n " $i"
|
||||
case "$i" in
|
||||
security)
|
||||
$IPTABLES -t filter -P INPUT $policy \
|
||||
&& $IPTABLES -t filter -P OUTPUT $policy \
|
||||
&& $IPTABLES -t filter -P FORWARD $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
raw)
|
||||
$IPTABLES -t raw -P PREROUTING $policy \
|
||||
&& $IPTABLES -t raw -P OUTPUT $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
filter)
|
||||
$IPTABLES -t filter -P INPUT $policy \
|
||||
&& $IPTABLES -t filter -P OUTPUT $policy \
|
||||
&& $IPTABLES -t filter -P FORWARD $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
nat)
|
||||
$IPTABLES -t nat -P PREROUTING $policy \
|
||||
&& $IPTABLES -t nat -P POSTROUTING $policy \
|
||||
&& $IPTABLES -t nat -P OUTPUT $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
mangle)
|
||||
$IPTABLES -t mangle -P PREROUTING $policy \
|
||||
&& $IPTABLES -t mangle -P POSTROUTING $policy \
|
||||
&& $IPTABLES -t mangle -P INPUT $policy \
|
||||
&& $IPTABLES -t mangle -P OUTPUT $policy \
|
||||
&& $IPTABLES -t mangle -P FORWARD $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
*)
|
||||
let ret+=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
return $ret
|
||||
}
|
||||
|
||||
start() {
|
||||
# Do not start if there is no config file.
|
||||
[ -f "$IPTABLES_DATA" ] || return 1
|
||||
|
||||
log_daemon_msg "Applying $IPTABLES firewall rules"
|
||||
|
||||
OPT=
|
||||
[ "x$IPTABLES_SAVE_COUNTER" = "xyes" ] && OPT="-c"
|
||||
|
||||
$IPTABLES-restore $OPT $IPTABLES_DATA
|
||||
if [ $? -eq 0 ]; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1; return 1
|
||||
fi
|
||||
|
||||
# Load additional modules (helpers)
|
||||
if [ -n "$IPTABLES_MODULES" ]; then
|
||||
echo -n "Loading additional $IPTABLES modules"
|
||||
ret=0
|
||||
for mod in $IPTABLES_MODULES; do
|
||||
echo -n "$mod "
|
||||
modprobe $mod > /dev/null 2>&1
|
||||
let ret+=$?;
|
||||
done
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
fi
|
||||
|
||||
touch $VAR_SUBSYS_IPTABLES
|
||||
return $ret
|
||||
}
|
||||
|
||||
stop() {
|
||||
# Do not stop if iptables module is not loaded.
|
||||
[ -e "$PROC_IPTABLES_NAMES" ] || return 1
|
||||
|
||||
flush_n_delete
|
||||
set_policy ACCEPT
|
||||
|
||||
if [ "x$IPTABLES_MODULES_UNLOAD" = "xyes" ]; then
|
||||
echo -n "Unloading $IPTABLES modules"
|
||||
ret=0
|
||||
rmmod_r ${IPV}_tables
|
||||
let ret+=$?;
|
||||
rmmod_r ${IPV}_conntrack
|
||||
let ret+=$?;
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
fi
|
||||
|
||||
rm -f $VAR_SUBSYS_IPTABLES
|
||||
return $ret
|
||||
}
|
||||
|
||||
save() {
|
||||
# Check if iptable module is loaded
|
||||
[ ! -e "$PROC_IPTABLES_NAMES" ] && return 1
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
[ -z "$tables" ] && return 1
|
||||
|
||||
echo -n "Saving firewall rules to $IPTABLES_DATA"
|
||||
|
||||
OPT=
|
||||
[ "x$IPTABLES_SAVE_COUNTER" = "xyes" ] && OPT="-c"
|
||||
|
||||
ret=0
|
||||
TMP_FILE=`/bin/mktemp -q /tmp/$IPTABLES.XXXXXX` \
|
||||
&& chmod 600 "$TMP_FILE" \
|
||||
&& $IPTABLES-save $OPT > $TMP_FILE 2>/dev/null \
|
||||
&& size=`stat -c '%s' $TMP_FILE` && [ $size -gt 0 ] \
|
||||
|| ret=1
|
||||
if [ $ret -eq 0 ]; then
|
||||
if [ -e $IPTABLES_DATA ]; then
|
||||
cp -f $IPTABLES_DATA $IPTABLES_DATA.save \
|
||||
&& chmod 600 $IPTABLES_DATA.save \
|
||||
|| ret=1
|
||||
fi
|
||||
if [ $ret -eq 0 ]; then
|
||||
cp -f $TMP_FILE $IPTABLES_DATA \
|
||||
&& chmod 600 $IPTABLES_DATA \
|
||||
|| ret=1
|
||||
fi
|
||||
fi
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
echo
|
||||
rm -f $TMP_FILE
|
||||
return $ret
|
||||
}
|
||||
|
||||
status() {
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
|
||||
# Do not print status if lockfile is missing and iptables modules are not
|
||||
# loaded.
|
||||
# Check if iptable module is loaded
|
||||
if [ ! -f "$VAR_SUBSYS_IPTABLES" -a -z "$tables" ]; then
|
||||
echo "Firewall is stopped."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
if [ ! -e "$PROC_IPTABLES_NAMES" ]; then
|
||||
echo "Firewall is not configured. "
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$tables" ]; then
|
||||
echo "Firewall is not configured. "
|
||||
return 1
|
||||
fi
|
||||
|
||||
NUM=
|
||||
[ "x$IPTABLES_STATUS_NUMERIC" = "xyes" ] && NUM="-n"
|
||||
VERBOSE=
|
||||
[ "x$IPTABLES_STATUS_VERBOSE" = "xyes" ] && VERBOSE="--verbose"
|
||||
COUNT=
|
||||
[ "x$IPTABLES_STATUS_LINENUMBERS" = "xyes" ] && COUNT="--line-numbers"
|
||||
|
||||
for table in $tables; do
|
||||
echo "Table: $table"
|
||||
$IPTABLES -t $table --list $NUM $VERBOSE $COUNT && echo
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
restart() {
|
||||
[ "x$IPTABLES_SAVE_ON_RESTART" = "xyes" ] && save
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
[ "x$IPTABLES_SAVE_ON_STOP" = "xyes" ] && save
|
||||
stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
[ -e "$VAR_SUBSYS_IPTABLES" ] && restart
|
||||
;;
|
||||
status)
|
||||
status
|
||||
RETVAL=$?
|
||||
;;
|
||||
panic)
|
||||
flush_n_delete
|
||||
set_policy DROP
|
||||
RETVAL=$?
|
||||
;;
|
||||
save)
|
||||
save
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|condrestart|status|panic|save}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
@@ -0,0 +1,52 @@
|
||||
#---------------------------------------------------------------------
|
||||
# This file is part of iRedMail, which is an open source mail server
|
||||
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
#
|
||||
# iRedMail is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# iRedMail is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
*filter
|
||||
:INPUT DROP [0:0]
|
||||
:FORWARD DROP [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
|
||||
# Keep state.
|
||||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
# Loop device.
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
|
||||
-A INPUT -p ipv6-icmp -j ACCEPT
|
||||
|
||||
# ssh
|
||||
-A INPUT -p tcp --dport 22 -j ACCEPT
|
||||
|
||||
# http, https
|
||||
-A INPUT -p tcp --dport 80 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 443 -j ACCEPT
|
||||
|
||||
# smtp, submission
|
||||
-A INPUT -p tcp --dport 25 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 587 -j ACCEPT
|
||||
|
||||
# pop3, pop3s
|
||||
-A INPUT -p tcp --dport 110 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 995 -j ACCEPT
|
||||
#-A INPUT -p tcp --dport 10110 -j ACCEPT
|
||||
|
||||
# imap, imaps
|
||||
-A INPUT -p tcp --dport 143 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 993 -j ACCEPT
|
||||
|
||||
COMMIT
|
||||
+363
@@ -0,0 +1,363 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
# This file is part of iRedMail, which is an open source mail server
|
||||
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
#
|
||||
# iRedMail is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# iRedMail is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: iptables
|
||||
# Required-Start: $network $syslog
|
||||
# Required-Stop: $network $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Control iptables firewall.
|
||||
### END INIT INFO
|
||||
#
|
||||
# This init.d script is used to control iptables, based on
|
||||
# /etc/init.d/iptables on Red Hat Enterprise Linux 5.3, modified
|
||||
# by Zhang Huangbin (zhb _at_ iredmail.org), iRedMail project
|
||||
# (http://www.iredmail.org/).
|
||||
#
|
||||
|
||||
#
|
||||
# config: /etc/default/iptables
|
||||
# config: /etc/default/iptables-config
|
||||
|
||||
# Source function library.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
IPTABLES='iptables'
|
||||
IPTABLES_DATA="/etc/default/$IPTABLES"
|
||||
IPTABLES_CONFIG="/etc/default/${IPTABLES}-config"
|
||||
IPV="${IPTABLES%tables}" # ip for ipv4 | ip6 for ipv6
|
||||
PROC_IPTABLES_NAMES="/proc/net/${IPV}_tables_names"
|
||||
VAR_SUBSYS_IPTABLES="/var/lock/subsys/$IPTABLES"
|
||||
[ -d $(dirname ${VAR_SUBSYS_IPTABLES}) ] || mkdir -p $(dirname ${VAR_SUBSYS_IPTABLES})
|
||||
|
||||
if [ ! -x /sbin/$IPTABLES ]; then
|
||||
log_daemon_msg "/sbin/$IPTABLES does not exist." "iptables"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if lsmod 2>/dev/null | grep -q ipchains ; then
|
||||
log_daemon_msg "ipchains and $IPTABLES can not be used together." "iptables"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Old or new modutils
|
||||
/sbin/modprobe --version 2>&1 | grep -q module-init-tools \
|
||||
&& NEW_MODUTILS=1 \
|
||||
|| NEW_MODUTILS=0
|
||||
|
||||
# Default firewall configuration:
|
||||
IPTABLES_MODULES=""
|
||||
IPTABLES_MODULES_UNLOAD="no"
|
||||
IPTABLES_SAVE_ON_STOP="no"
|
||||
IPTABLES_SAVE_ON_RESTART="no"
|
||||
IPTABLES_SAVE_COUNTER="no"
|
||||
IPTABLES_STATUS_NUMERIC="yes"
|
||||
|
||||
# Load firewall configuration.
|
||||
[ -f "$IPTABLES_CONFIG" ] && . "$IPTABLES_CONFIG"
|
||||
|
||||
rmmod_r() {
|
||||
# Unload module with all referring modules.
|
||||
# At first all referring modules will be unloaded, then the module itself.
|
||||
local mod=$1
|
||||
local ret=0
|
||||
local ref=
|
||||
|
||||
# Get referring modules.
|
||||
# New modutils have another output format.
|
||||
[ $NEW_MODUTILS = 1 ] \
|
||||
&& ref=`lsmod | awk "/^${mod}/ { print \\\$4; }" | tr ',' ' '` \
|
||||
|| ref=`lsmod | grep ^${mod} | cut -d "[" -s -f 2 | cut -d "]" -s -f 1`
|
||||
|
||||
# recursive call for all referring modules
|
||||
for i in $ref; do
|
||||
rmmod_r $i
|
||||
let ret+=$?;
|
||||
done
|
||||
|
||||
# Unload module.
|
||||
# The extra test is for 2.6: The module might have autocleaned,
|
||||
# after all referring modules are unloaded.
|
||||
if grep -q "^${mod}" /proc/modules ; then
|
||||
modprobe -r $mod > /dev/null 2>&1
|
||||
let ret+=$?;
|
||||
fi
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
flush_n_delete() {
|
||||
# Flush firewall rules and delete chains.
|
||||
[ -e "$PROC_IPTABLES_NAMES" ] || return 1
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
[ -z "$tables" ] && return 1
|
||||
|
||||
log_daemon_msg "Flushing firewall rules" "iptables"
|
||||
ret=0
|
||||
# For all tables
|
||||
for i in $tables; do
|
||||
# Flush firewall rules.
|
||||
$IPTABLES -t $i -F;
|
||||
let ret+=$?;
|
||||
|
||||
# Delete firewall chains.
|
||||
$IPTABLES -t $i -X;
|
||||
let ret+=$?;
|
||||
|
||||
# Set counter to zero.
|
||||
$IPTABLES -t $i -Z;
|
||||
let ret+=$?;
|
||||
done
|
||||
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
return $ret
|
||||
}
|
||||
|
||||
set_policy() {
|
||||
# Set policy for configured tables.
|
||||
policy=$1
|
||||
|
||||
# Check if iptable module is loaded
|
||||
[ ! -e "$PROC_IPTABLES_NAMES" ] && return 1
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
[ -z "$tables" ] && return 1
|
||||
|
||||
log_daemon_msg "Setting chains to policy $policy"
|
||||
ret=0
|
||||
for i in $tables; do
|
||||
echo -n " $i"
|
||||
case "$i" in
|
||||
security)
|
||||
$IPTABLES -t filter -P INPUT $policy \
|
||||
&& $IPTABLES -t filter -P OUTPUT $policy \
|
||||
&& $IPTABLES -t filter -P FORWARD $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
raw)
|
||||
$IPTABLES -t raw -P PREROUTING $policy \
|
||||
&& $IPTABLES -t raw -P OUTPUT $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
filter)
|
||||
$IPTABLES -t filter -P INPUT $policy \
|
||||
&& $IPTABLES -t filter -P OUTPUT $policy \
|
||||
&& $IPTABLES -t filter -P FORWARD $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
nat)
|
||||
$IPTABLES -t nat -P PREROUTING $policy \
|
||||
&& $IPTABLES -t nat -P POSTROUTING $policy \
|
||||
&& $IPTABLES -t nat -P OUTPUT $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
mangle)
|
||||
$IPTABLES -t mangle -P PREROUTING $policy \
|
||||
&& $IPTABLES -t mangle -P POSTROUTING $policy \
|
||||
&& $IPTABLES -t mangle -P INPUT $policy \
|
||||
&& $IPTABLES -t mangle -P OUTPUT $policy \
|
||||
&& $IPTABLES -t mangle -P FORWARD $policy \
|
||||
|| let ret+=1
|
||||
;;
|
||||
*)
|
||||
let ret+=1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
return $ret
|
||||
}
|
||||
|
||||
start() {
|
||||
# Do not start if there is no config file.
|
||||
[ -f "$IPTABLES_DATA" ] || return 1
|
||||
|
||||
log_daemon_msg "Applying $IPTABLES firewall rules"
|
||||
|
||||
OPT=
|
||||
[ "x$IPTABLES_SAVE_COUNTER" = "xyes" ] && OPT="-c"
|
||||
|
||||
$IPTABLES-restore $OPT $IPTABLES_DATA
|
||||
if [ $? -eq 0 ]; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1; return 1
|
||||
fi
|
||||
|
||||
# Load additional modules (helpers)
|
||||
if [ -n "$IPTABLES_MODULES" ]; then
|
||||
echo -n "Loading additional $IPTABLES modules"
|
||||
ret=0
|
||||
for mod in $IPTABLES_MODULES; do
|
||||
echo -n "$mod "
|
||||
modprobe $mod > /dev/null 2>&1
|
||||
let ret+=$?;
|
||||
done
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
fi
|
||||
|
||||
touch $VAR_SUBSYS_IPTABLES
|
||||
return $ret
|
||||
}
|
||||
|
||||
stop() {
|
||||
# Do not stop if iptables module is not loaded.
|
||||
[ -e "$PROC_IPTABLES_NAMES" ] || return 1
|
||||
|
||||
flush_n_delete
|
||||
set_policy ACCEPT
|
||||
|
||||
if [ "x$IPTABLES_MODULES_UNLOAD" = "xyes" ]; then
|
||||
echo -n "Unloading $IPTABLES modules"
|
||||
ret=0
|
||||
rmmod_r ${IPV}_tables
|
||||
let ret+=$?;
|
||||
rmmod_r ${IPV}_conntrack
|
||||
let ret+=$?;
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
fi
|
||||
|
||||
rm -f $VAR_SUBSYS_IPTABLES
|
||||
return $ret
|
||||
}
|
||||
|
||||
save() {
|
||||
# Check if iptable module is loaded
|
||||
[ ! -e "$PROC_IPTABLES_NAMES" ] && return 1
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
[ -z "$tables" ] && return 1
|
||||
|
||||
echo -n "Saving firewall rules to $IPTABLES_DATA"
|
||||
|
||||
OPT=
|
||||
[ "x$IPTABLES_SAVE_COUNTER" = "xyes" ] && OPT="-c"
|
||||
|
||||
ret=0
|
||||
TMP_FILE=`/bin/mktemp -q /tmp/$IPTABLES.XXXXXX` \
|
||||
&& chmod 600 "$TMP_FILE" \
|
||||
&& $IPTABLES-save $OPT > $TMP_FILE 2>/dev/null \
|
||||
&& size=`stat -c '%s' $TMP_FILE` && [ $size -gt 0 ] \
|
||||
|| ret=1
|
||||
if [ $ret -eq 0 ]; then
|
||||
if [ -e $IPTABLES_DATA ]; then
|
||||
cp -f $IPTABLES_DATA $IPTABLES_DATA.save \
|
||||
&& chmod 600 $IPTABLES_DATA.save \
|
||||
|| ret=1
|
||||
fi
|
||||
if [ $ret -eq 0 ]; then
|
||||
cp -f $TMP_FILE $IPTABLES_DATA \
|
||||
&& chmod 600 $IPTABLES_DATA \
|
||||
|| ret=1
|
||||
fi
|
||||
fi
|
||||
[ $ret -eq 0 ] && log_end_msg 0 || log_end_msg 1
|
||||
echo
|
||||
rm -f $TMP_FILE
|
||||
return $ret
|
||||
}
|
||||
|
||||
status() {
|
||||
tables=`cat $PROC_IPTABLES_NAMES 2>/dev/null`
|
||||
|
||||
# Do not print status if lockfile is missing and iptables modules are not
|
||||
# loaded.
|
||||
# Check if iptable module is loaded
|
||||
if [ ! -f "$VAR_SUBSYS_IPTABLES" -a -z "$tables" ]; then
|
||||
echo "Firewall is stopped."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if firewall is configured (has tables)
|
||||
if [ ! -e "$PROC_IPTABLES_NAMES" ]; then
|
||||
echo "Firewall is not configured. "
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$tables" ]; then
|
||||
echo "Firewall is not configured. "
|
||||
return 1
|
||||
fi
|
||||
|
||||
NUM=
|
||||
[ "x$IPTABLES_STATUS_NUMERIC" = "xyes" ] && NUM="-n"
|
||||
VERBOSE=
|
||||
[ "x$IPTABLES_STATUS_VERBOSE" = "xyes" ] && VERBOSE="--verbose"
|
||||
COUNT=
|
||||
[ "x$IPTABLES_STATUS_LINENUMBERS" = "xyes" ] && COUNT="--line-numbers"
|
||||
|
||||
for table in $tables; do
|
||||
echo "Table: $table"
|
||||
$IPTABLES -t $table --list $NUM $VERBOSE $COUNT && echo
|
||||
done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
restart() {
|
||||
[ "x$IPTABLES_SAVE_ON_RESTART" = "xyes" ] && save
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
[ "x$IPTABLES_SAVE_ON_STOP" = "xyes" ] && save
|
||||
stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
restart
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart)
|
||||
[ -e "$VAR_SUBSYS_IPTABLES" ] && restart
|
||||
;;
|
||||
status)
|
||||
status
|
||||
RETVAL=$?
|
||||
;;
|
||||
panic)
|
||||
flush_n_delete
|
||||
set_policy DROP
|
||||
RETVAL=$?
|
||||
;;
|
||||
save)
|
||||
save
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|condrestart|status|panic|save}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
@@ -0,0 +1,53 @@
|
||||
#---------------------------------------------------------------------
|
||||
# This file is part of iRedMail, which is an open source mail server
|
||||
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
#
|
||||
# iRedMail is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# iRedMail is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
*filter
|
||||
:INPUT DROP [0:0]
|
||||
:FORWARD DROP [0:0]
|
||||
:OUTPUT ACCEPT [0:0]
|
||||
|
||||
# Keep state.
|
||||
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
# Loop device.
|
||||
-A INPUT -i lo -j ACCEPT
|
||||
|
||||
# Allow PING from remote hosts.
|
||||
-A INPUT -p icmp --icmp-type echo-request -j ACCEPT
|
||||
|
||||
# ssh
|
||||
-A INPUT -p tcp --dport 22 -j ACCEPT
|
||||
|
||||
# http, https
|
||||
-A INPUT -p tcp --dport 80 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 443 -j ACCEPT
|
||||
|
||||
# smtp, submission
|
||||
-A INPUT -p tcp --dport 25 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 587 -j ACCEPT
|
||||
|
||||
# pop3, pop3s
|
||||
-A INPUT -p tcp --dport 110 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 995 -j ACCEPT
|
||||
#-A INPUT -p tcp --dport 10110 -j ACCEPT
|
||||
|
||||
# imap, imaps
|
||||
-A INPUT -p tcp --dport 143 -j ACCEPT
|
||||
-A INPUT -p tcp --dport 993 -j ACCEPT
|
||||
|
||||
COMMIT
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/usr/sbin/nft -f
|
||||
|
||||
flush ruleset
|
||||
|
||||
# `inet` applies to both IPv4 and IPv6.
|
||||
table inet filter {
|
||||
chain input {
|
||||
type filter hook input priority 0;
|
||||
|
||||
# accept any localhost traffic
|
||||
iif lo accept
|
||||
|
||||
# no ping floods:
|
||||
ip protocol icmp icmp type echo-request limit rate over 10/second burst 4 packets drop
|
||||
ip6 nexthdr icmpv6 icmpv6 type echo-request limit rate over 10/second burst 4 packets drop
|
||||
|
||||
# accept traffic originated from us
|
||||
ct state established,related accept
|
||||
|
||||
# accept ICMP & IGMP
|
||||
ip6 nexthdr icmpv6 icmpv6 type { destination-unreachable, packet-too-big, time-exceeded, parameter-problem, mld-listener-query, mld-listener-report, mld-listener-reduction, nd-router-solicit, nd-router-advert, nd-neighbor-solicit, nd-neighbor-advert, ind-neighbor-solicit, ind-neighbor-advert, mld2-listener-report } accept
|
||||
ip protocol icmp icmp type { destination-unreachable, router-solicitation, router-advertisement, time-exceeded, parameter-problem } accept
|
||||
ip protocol igmp accept
|
||||
|
||||
# ssh
|
||||
tcp dport 22 accept
|
||||
|
||||
# http/https
|
||||
tcp dport 80 accept
|
||||
tcp dport 443 accept
|
||||
|
||||
# smtp/submission
|
||||
tcp dport 25 accept
|
||||
tcp dport 587 accept
|
||||
|
||||
# pop3/pop3s
|
||||
tcp dport 110 accept
|
||||
tcp dport 995 accept
|
||||
|
||||
# imap/imaps
|
||||
tcp dport 143 accept
|
||||
tcp dport 993 accept
|
||||
|
||||
# count and drop any other traffic
|
||||
counter drop
|
||||
}
|
||||
|
||||
chain output {
|
||||
type filter hook output priority 0;
|
||||
policy accept;
|
||||
}
|
||||
|
||||
chain forward {
|
||||
type filter hook forward priority 0;
|
||||
policy drop;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
PH_DOVECOT_LOG_FILE PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_DOVECOT_MASTER_PID
|
||||
PH_DOVECOT_SIEVE_LOG_FILE PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_DOVECOT_MASTER_PID
|
||||
PH_DOVECOT_LMTP_LOG_FILE PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_DOVECOT_MASTER_PID
|
||||
@@ -0,0 +1 @@
|
||||
PH_IREDAPD_LOG_FILE PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_IREDAPD_PID_FILE
|
||||
@@ -0,0 +1 @@
|
||||
PH_MLMMJADMIN_LOG_FILE PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_MLMMJADMIN_PID_FILE
|
||||
@@ -0,0 +1,2 @@
|
||||
PH_PHP_FPM_LOG_MAIN PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_PHP_FPM_PID_FILE
|
||||
PH_PHP_FPM_LOG_SLOW PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 600 7 * 24 Z PH_PHP_FPM_PID_FILE
|
||||
@@ -0,0 +1 @@
|
||||
PH_OPENLDAP_LOG_FILE PH_SYS_USER_SYSLOG:PH_SYS_GROUP_SYSLOG 640 7 * 24 Z
|
||||
@@ -0,0 +1,2 @@
|
||||
!dovecot
|
||||
PH_IREDMAIL_SYSLOG_FACILITY.* PH_DOVECOT_LOG_FILE
|
||||
@@ -0,0 +1,2 @@
|
||||
!fail2ban
|
||||
PH_FAIL2BAN_SYSLOG_FACILITY.* PH_FAIL2BAN_LOG_FILE
|
||||
@@ -0,0 +1,2 @@
|
||||
!iredapd
|
||||
PH_IREDMAIL_SYSLOG_FACILITY.* PH_IREDAPD_LOG_FILE
|
||||
@@ -0,0 +1,2 @@
|
||||
!mlmmjadmin
|
||||
PH_IREDMAIL_SYSLOG_FACILITY.* PH_MLMMJADMIN_LOG_FILE
|
||||
@@ -0,0 +1,2 @@
|
||||
!php-fpm
|
||||
local5.* PH_PHP_FPM_LOG_MAIN
|
||||
@@ -0,0 +1,2 @@
|
||||
!slapd
|
||||
*.* PH_OPENLDAP_LOG_FILE
|
||||
@@ -0,0 +1,465 @@
|
||||
-- --------------------------------------------------------------------
|
||||
-- This file is part of iRedMail, which is an open source mail server
|
||||
-- solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
--
|
||||
-- iRedMail is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- iRedMail is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- --------------------------------------------------------------------
|
||||
|
||||
--
|
||||
-- Based on original postfixadmin template.
|
||||
-- http://postfixadmin.sf.net
|
||||
--
|
||||
|
||||
-- USE PH_VMAIL_DB_NAME;
|
||||
|
||||
--
|
||||
-- Table structure for table admin
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS admin (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
password VARCHAR(255) NOT NULL DEFAULT '',
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
language VARCHAR(5) NOT NULL DEFAULT '',
|
||||
passwordlastchange DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
-- Store per-admin settings. Used in iRedAdmin-Pro.
|
||||
settings TEXT,
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username),
|
||||
INDEX (passwordlastchange),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table alias
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS alias (
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
accesspolicy VARCHAR(30) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (address),
|
||||
INDEX (domain),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- Alias and mailing list moderators.
|
||||
CREATE TABLE IF NOT EXISTS moderators (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address, moderator),
|
||||
INDEX (domain),
|
||||
INDEX (dest_domain)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- Forwardings. it contains
|
||||
-- - members of mail alias account
|
||||
-- - per-account alias addresses
|
||||
-- - per-user mail forwarding addresses
|
||||
CREATE TABLE IF NOT EXISTS forwardings (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
forwarding VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- defines whether it's a standalone (mlmmj) mailing list account. 0=no, 1=yes.
|
||||
is_maillist TINYINT(1) NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a standalone mail alias account. 0=no, 1=yes.
|
||||
is_list TINYINT(1) NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a mail forwarding address of mail user. 0=no, 1=yes.
|
||||
is_forwarding TINYINT(1) NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a per-account alias address. 0=no, 1=yes.
|
||||
is_alias TINYINT(1) NOT NULL DEFAULT 0,
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address, forwarding),
|
||||
INDEX (domain),
|
||||
INDEX (dest_domain),
|
||||
INDEX (is_maillist),
|
||||
INDEX (is_list),
|
||||
INDEX (is_alias)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table domain
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS domain (
|
||||
-- mail domain name. e.g. iredmail.org.
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
description TEXT,
|
||||
-- Disclaimer text. Used by Amavisd + AlterMIME.
|
||||
disclaimer TEXT,
|
||||
-- Max alias accounts in this domain. e.g. 10.
|
||||
aliases INT(10) NOT NULL DEFAULT 0,
|
||||
-- Max mail accounts in this domain. e.g. 100.
|
||||
mailboxes INT(10) NOT NULL DEFAULT 0,
|
||||
-- Max mailing list accounts in this domain. e.g. 10.
|
||||
maillists INT(10) NOT NULL DEFAULT 0,
|
||||
-- Max mailbox quota in this domain. e.g. 1073741824 (1GB).
|
||||
maxquota BIGINT(20) NOT NULL DEFAULT 0,
|
||||
-- Not used. Historical.
|
||||
quota BIGINT(20) NOT NULL DEFAULT 0,
|
||||
-- Per-domain transport. e.g. dovecot, smtp:[192.168.1.1]:25
|
||||
transport VARCHAR(255) NOT NULL DEFAULT 'dovecot',
|
||||
backupmx TINYINT(1) NOT NULL DEFAULT 0,
|
||||
-- Store per-domain settings. Used in iRedAdmin-Pro.
|
||||
settings TEXT,
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (domain),
|
||||
INDEX (backupmx),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `alias_domain` (
|
||||
alias_domain VARCHAR(255) NOT NULL,
|
||||
target_domain VARCHAR(255) NOT NULL,
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (alias_domain),
|
||||
INDEX (target_domain),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table domain_admins
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS domain_admins (
|
||||
username VARCHAR(255) CHARACTER SET ascii NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) CHARACTER SET ascii NOT NULL DEFAULT '',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username,domain),
|
||||
INDEX (username),
|
||||
INDEX (domain),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table mailbox
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS mailbox (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
password VARCHAR(255) NOT NULL DEFAULT '',
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
language VARCHAR(5) NOT NULL DEFAULT '',
|
||||
-- Mailbox format.
|
||||
-- All formats supported by Dovecot are ok. e.g. maildir, mdbox.
|
||||
-- FYI: https://wiki2.dovecot.org/MailboxFormat
|
||||
mailboxformat VARCHAR(50) NOT NULL DEFAULT 'maildir',
|
||||
-- mailbox folder name can be any folder name supported by Linux/BSD file
|
||||
-- system.
|
||||
mailboxfolder VARCHAR(50) NOT NULL DEFAULT 'Maildir',
|
||||
storagebasedirectory VARCHAR(255) NOT NULL DEFAULT '',
|
||||
storagenode VARCHAR(255) NOT NULL DEFAULT '',
|
||||
maildir VARCHAR(255) NOT NULL DEFAULT '',
|
||||
quota BIGINT(20) NOT NULL DEFAULT 0, -- Total mail quota size
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
transport VARCHAR(255) NOT NULL DEFAULT '',
|
||||
department VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`rank` VARCHAR(255) NOT NULL DEFAULT 'normal',
|
||||
employeeid VARCHAR(255) DEFAULT '',
|
||||
isadmin TINYINT(1) NOT NULL DEFAULT 0,
|
||||
isglobaladmin TINYINT(1) NOT NULL DEFAULT 0,
|
||||
enablesmtp TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablesmtpsecured TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablepop3 TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablepop3secured TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablepop3tls TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enableimap TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enableimapsecured TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enableimaptls TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enabledeliver TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablelda TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablemanagesieve TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablemanagesievesecured TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablesieve TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablesievesecured TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablesievetls TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enableinternal TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enabledoveadm TINYINT(1) NOT NULL DEFAULT 1,
|
||||
`enablelib-storage` TINYINT(1) NOT NULL DEFAULT 1,
|
||||
`enablequota-status` TINYINT(1) NOT NULL DEFAULT 1,
|
||||
`enableindexer-worker` TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablelmtp TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enabledsync TINYINT(1) NOT NULL DEFAULT 1,
|
||||
enablesogo TINYINT(1) NOT NULL DEFAULT 1,
|
||||
-- Must be set to NULL if it's not restricted.
|
||||
allow_nets TEXT DEFAULT NULL,
|
||||
lastlogindate DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
lastloginipv4 INT(4) UNSIGNED NOT NULL DEFAULT 0,
|
||||
lastloginprotocol CHAR(255) NOT NULL DEFAULT '',
|
||||
disclaimer TEXT,
|
||||
-- Below 4 columns are deprecated and will be removed in future release.
|
||||
-- Don't use them.
|
||||
allowedsenders TEXT,
|
||||
rejectedsenders TEXT,
|
||||
allowedrecipients TEXT,
|
||||
rejectedrecipients TEXT,
|
||||
-- Store per-user settings. Used in iRedAdmin-Pro.
|
||||
settings TEXT,
|
||||
passwordlastchange DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username),
|
||||
INDEX (domain),
|
||||
INDEX (department),
|
||||
INDEX (employeeid),
|
||||
INDEX (isadmin),
|
||||
INDEX (isglobaladmin),
|
||||
INDEX (enablesmtp),
|
||||
INDEX (enablesmtpsecured),
|
||||
INDEX (enablepop3),
|
||||
INDEX (enablepop3secured),
|
||||
INDEX (enablepop3tls),
|
||||
INDEX (enableimap),
|
||||
INDEX (enableimapsecured),
|
||||
INDEX (enableimaptls),
|
||||
INDEX (enabledeliver),
|
||||
INDEX (enablelda),
|
||||
INDEX (enablemanagesieve),
|
||||
INDEX (enablemanagesievesecured),
|
||||
INDEX (enablesieve),
|
||||
INDEX (enablesievesecured),
|
||||
INDEX (enablesievetls),
|
||||
INDEX (enablelmtp),
|
||||
INDEX (enableinternal),
|
||||
INDEX (enabledoveadm),
|
||||
INDEX (`enablelib-storage`),
|
||||
INDEX (`enablequota-status`),
|
||||
INDEX (`enableindexer-worker`),
|
||||
INDEX (enabledsync),
|
||||
INDEX (enablesogo),
|
||||
INDEX (passwordlastchange),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS maillists (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- Per mailing list transport. for example: 'mlmmj:example.com/listname'.
|
||||
transport VARCHAR(255) NOT NULL DEFAULT '',
|
||||
accesspolicy VARCHAR(30) NOT NULL DEFAULT '',
|
||||
maxmsgsize BIGINT(20) NOT NULL DEFAULT 0,
|
||||
-- name of the mailing list
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- short introduction of the mailing list on subscription page
|
||||
description TEXT,
|
||||
-- a server-wide unique id (a 36-characters string) for each mailing list
|
||||
mlid VARCHAR(36) NOT NULL DEFAULT '',
|
||||
-- control whether newsletter-style subscription from website is enabled
|
||||
-- 1 -> enabled, 0 -> disabled
|
||||
is_newsletter TINYINT(1) NOT NULL DEFAULT 0,
|
||||
settings TEXT,
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (address),
|
||||
UNIQUE INDEX (mlid),
|
||||
INDEX (is_newsletter),
|
||||
INDEX (domain),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table sender_bcc_domain
|
||||
-- TODO Merge into table 'domain' (domain.sender_bcc)
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS sender_bcc_domain (
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (domain),
|
||||
INDEX (bcc_address),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table recipient_bcc_domain
|
||||
-- TODO Merge into table 'domain' (domain.recipient_bcc)
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS recipient_bcc_domain (
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (domain),
|
||||
INDEX (bcc_address),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table sender_bcc_user
|
||||
-- TODO Merge into table 'mailbox' (mailbox.sender_bcc)
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS sender_bcc_user (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username),
|
||||
INDEX (bcc_address),
|
||||
INDEX (domain),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- Table structure for table recipient_bcc_user
|
||||
-- TODO Merge into table 'mailbox' (mailbox.recipient_bcc)
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS recipient_bcc_user (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
modified DATETIME NOT NULL DEFAULT '1970-01-01 01:01:01',
|
||||
expired DATETIME NOT NULL DEFAULT '9999-12-31 00:00:00',
|
||||
active TINYINT(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username),
|
||||
INDEX (bcc_address),
|
||||
INDEX (expired),
|
||||
INDEX (active)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- Sender dependent relayhost.
|
||||
-- - per-user: account='user@domain.com'
|
||||
-- - per-domain: account='@domain.com'
|
||||
-- References:
|
||||
-- - http://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps
|
||||
-- - http://www.postfix.org/transport.5.html
|
||||
CREATE TABLE IF NOT EXISTS sender_relayhost (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
account VARCHAR(255) NOT NULL DEFAULT '',
|
||||
relayhost VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE INDEX (account)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
-- Used to store basic info of deleted mailboxes.
|
||||
CREATE TABLE IF NOT EXISTS deleted_mailboxes (
|
||||
id BIGINT(20) UNSIGNED AUTO_INCREMENT,
|
||||
timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
-- Email address of deleted user
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- Domain part of username
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- Absolute path of user's mailbox
|
||||
maildir VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- Deleted by which domain admin
|
||||
admin VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- The time scheduled to delete this mailbox.
|
||||
-- NOTE: it requires cron job + script to actually delete the mailbox.
|
||||
delete_date DATE DEFAULT NULL,
|
||||
|
||||
KEY id (id),
|
||||
INDEX (timestamp),
|
||||
INDEX (username),
|
||||
INDEX (domain),
|
||||
INDEX (admin),
|
||||
INDEX (delete_date)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--
|
||||
-- IMAP shared folders. User 'from_user' shares folders to user 'to_user'.
|
||||
-- WARNING: Works only with Dovecot 1.2+.
|
||||
--
|
||||
CREATE TABLE IF NOT EXISTS share_folder (
|
||||
from_user VARCHAR(255) CHARACTER SET ascii NOT NULL,
|
||||
to_user VARCHAR(255) CHARACTER SET ascii NOT NULL,
|
||||
dummy CHAR(1),
|
||||
PRIMARY KEY (from_user, to_user),
|
||||
INDEX (from_user),
|
||||
INDEX (to_user)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS anyone_shares (
|
||||
from_user VARCHAR(255) NOT NULL,
|
||||
dummy CHAR(1) DEFAULT '1',
|
||||
PRIMARY KEY (from_user)
|
||||
);
|
||||
|
||||
-- used_quota
|
||||
-- Used to store realtime mailbox quota in Dovecot.
|
||||
-- WARNING: Works only with Dovecot 1.2+.
|
||||
--
|
||||
-- Note: Don't touch this table, it will be updated by Dovecot automatically.
|
||||
CREATE TABLE IF NOT EXISTS `used_quota` (
|
||||
`username` VARCHAR(255) NOT NULL,
|
||||
`bytes` BIGINT NOT NULL DEFAULT 0,
|
||||
`messages` BIGINT NOT NULL DEFAULT 0,
|
||||
`domain` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (`username`),
|
||||
INDEX (domain)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- Trigger `used_quota_before_insert` is used to set `used_quota.domain`.
|
||||
-- NOTE: `used_quota.domain` is not used by Dovecot, but used in iRedAdmin to
|
||||
-- get better SQL query performance while calculating per-domain used
|
||||
-- quota.
|
||||
DELIMITER //
|
||||
CREATE TRIGGER `used_quota_before_insert`
|
||||
BEFORE INSERT ON `used_quota` FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.domain = SUBSTRING_INDEX(NEW.username, '@', -1);
|
||||
END;
|
||||
//
|
||||
DELIMITER ;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `last_login` (
|
||||
`username` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`domain` VARCHAR(255) NOT NULL DEFAULT '',
|
||||
`imap` INT(11) DEFAULT NULL,
|
||||
`pop3` INT(11) DEFAULT NULL,
|
||||
`lda` INT(11) DEFAULT NULL,
|
||||
PRIMARY KEY (`username`),
|
||||
INDEX (`domain`),
|
||||
INDEX (`imap`),
|
||||
INDEX (`pop3`),
|
||||
INDEX (`lda`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@@ -0,0 +1,467 @@
|
||||
-- ---------------------------------------------------------------------
|
||||
-- This file is part of iRedMail, which is an open source mail server
|
||||
-- solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
--
|
||||
-- iRedMail is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- iRedMail is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
-- ---------------------------------------------------------------------
|
||||
|
||||
-- Connect as vmailadmin
|
||||
-- \c PH_VMAIL_DB_NAME PH_VMAIL_DB_ADMIN_USER;
|
||||
|
||||
-- Required by PostgreSQL 8.x (RHEL/CentOS 6)
|
||||
-- CREATE LANGUAGE plpgsql;
|
||||
|
||||
-- Used to store domain admin accounts
|
||||
CREATE TABLE admin (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
password VARCHAR(255) NOT NULL DEFAULT '',
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
language VARCHAR(5) NOT NULL DEFAULT '',
|
||||
passwordlastchange TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
-- Store per-admin settings. Used in iRedAdmin-Pro.
|
||||
settings TEXT NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username)
|
||||
);
|
||||
CREATE INDEX idx_admin_passwordlastchange ON admin (passwordlastchange);
|
||||
CREATE INDEX idx_admin_expired ON admin (expired);
|
||||
CREATE INDEX idx_admin_active ON admin (active);
|
||||
|
||||
-- Used to store mail alias accounts
|
||||
CREATE TABLE alias (
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
accesspolicy VARCHAR(30) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (address)
|
||||
);
|
||||
CREATE INDEX idx_alias_domain ON alias (domain);
|
||||
CREATE INDEX idx_alias_expired ON alias (expired);
|
||||
CREATE INDEX idx_alias_active ON alias (active);
|
||||
|
||||
-- Alias and mailing list moderators.
|
||||
CREATE TABLE moderators (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
moderator VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT ''
|
||||
);
|
||||
|
||||
CREATE INDEX idx_moderators_address ON moderators (address);
|
||||
CREATE INDEX idx_moderators_moderator ON moderators (moderator);
|
||||
CREATE UNIQUE INDEX idx_moderators_address_moderator ON moderators (address, moderator);
|
||||
CREATE INDEX idx_moderators_domain ON moderators (domain);
|
||||
CREATE INDEX idx_moderators_dest_domain ON moderators (dest_domain);
|
||||
|
||||
-- Forwardings. it contains
|
||||
-- - members of mail alias account
|
||||
-- - per-account alias addresses
|
||||
-- - per-user mail forwarding addresses
|
||||
CREATE TABLE forwardings (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
forwarding VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
dest_domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- defines whether it's a (mlmmj) mailing list account. 0=no, 1=yes.
|
||||
is_maillist INT2 NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a standalone mail alias account. 0=no, 1=yes.
|
||||
is_list INT2 NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a mail forwarding address of mail user. 0=no, 1=yes.
|
||||
is_forwarding INT2 NOT NULL DEFAULT 0,
|
||||
-- defines whether it's a per-account alias address. 0=no, 1=yes.
|
||||
is_alias INT2 NOT NULL DEFAULT 0,
|
||||
active INT2 NOT NULL DEFAULT 1
|
||||
);
|
||||
CREATE INDEX idx_forwardings_address ON forwardings (address);
|
||||
CREATE INDEX idx_forwardings_forwarding ON forwardings (forwarding);
|
||||
CREATE UNIQUE INDEX idx_forwardings_address_forwarding ON forwardings (address, forwarding);
|
||||
CREATE INDEX idx_forwardings_domain ON forwardings (domain);
|
||||
CREATE INDEX idx_forwardings_dest_domain ON forwardings (dest_domain);
|
||||
CREATE INDEX idx_forwardings_is_maillist ON forwardings (is_maillist);
|
||||
CREATE INDEX idx_forwardings_is_list ON forwardings (is_list);
|
||||
CREATE INDEX idx_forwardings_is_forwarding ON forwardings (is_forwarding);
|
||||
CREATE INDEX idx_forwardings_is_alias ON forwardings (is_alias);
|
||||
|
||||
-- Used to store virtual mail domains
|
||||
CREATE TABLE domain (
|
||||
-- mail domain name. e.g. iredmail.org.
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
description TEXT NOT NULL DEFAULT '',
|
||||
-- Disclaimer text. Used by Amavisd + AlterMIME.
|
||||
disclaimer TEXT NOT NULL DEFAULT '',
|
||||
-- Max alias accounts in this domain. e.g. 10.
|
||||
aliases INT8 NOT NULL DEFAULT 0,
|
||||
-- Max mail accounts in this domain. e.g. 100.
|
||||
mailboxes INT8 NOT NULL DEFAULT 0,
|
||||
-- Max mailing lists in this domain. e.g. 100.
|
||||
maillists INT8 NOT NULL DEFAULT 0,
|
||||
-- Max mailbox quota in this domain. e.g. 1073741824 (1GB).
|
||||
maxquota INT8 NOT NULL DEFAULT 0,
|
||||
-- Not used. Historical.
|
||||
quota INT8 NOT NULL DEFAULT 0,
|
||||
-- Per-domain transport. e.g. dovecot, smtp:[192.168.1.1]:25
|
||||
transport VARCHAR(255) NOT NULL DEFAULT 'dovecot',
|
||||
-- Store per-domain settings. Used in iRedAdmin-Pro.
|
||||
settings TEXT NOT NULL DEFAULT '',
|
||||
backupmx INT2 NOT NULL DEFAULT 0,
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (domain)
|
||||
);
|
||||
CREATE INDEX idx_domain_backupmx ON domain (backupmx);
|
||||
CREATE INDEX idx_domain_expired ON domain (expired);
|
||||
CREATE INDEX idx_domain_active ON domain (active);
|
||||
|
||||
-- Used to store alias domains
|
||||
CREATE TABLE alias_domain (
|
||||
alias_domain VARCHAR(255) NOT NULL,
|
||||
target_domain VARCHAR(255) NOT NULL,
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (alias_domain)
|
||||
);
|
||||
CREATE INDEX idx_alias_domain_target_domain ON alias_domain (target_domain);
|
||||
CREATE INDEX idx_alias_domain_active ON alias_domain (active);
|
||||
|
||||
-- Used to store domain <=> admin relationship
|
||||
CREATE TABLE domain_admins (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username,domain)
|
||||
);
|
||||
CREATE INDEX idx_domain_admins_username ON domain_admins (username);
|
||||
CREATE INDEX idx_domain_admins_domain ON domain_admins (domain);
|
||||
CREATE INDEX idx_domain_admins_active ON domain_admins (active);
|
||||
|
||||
-- Used to store virtual mail accounts
|
||||
CREATE TABLE mailbox (
|
||||
username VARCHAR(255) NOT NULL,
|
||||
password VARCHAR(255) NOT NULL DEFAULT '',
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
language VARCHAR(5) NOT NULL DEFAULT '',
|
||||
-- Mailbox format.
|
||||
-- All formats supported by Dovecot are ok. e.g. maildir, mdbox.
|
||||
-- FYI: https://wiki2.dovecot.org/MailboxFormat
|
||||
mailboxformat VARCHAR(50) NOT NULL DEFAULT 'maildir',
|
||||
-- mailbox folder name can be any folder name supported by Linux/BSD file
|
||||
-- system.
|
||||
mailboxfolder VARCHAR(50) NOT NULL DEFAULT 'Maildir',
|
||||
storagebasedirectory VARCHAR(255) NOT NULL DEFAULT '',
|
||||
storagenode VARCHAR(255) NOT NULL DEFAULT '',
|
||||
maildir VARCHAR(255) NOT NULL DEFAULT '',
|
||||
quota INT8 NOT NULL DEFAULT 0, -- Total mail quota size
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
transport VARCHAR(255) NOT NULL DEFAULT '',
|
||||
department VARCHAR(255) NOT NULL DEFAULT '',
|
||||
rank VARCHAR(255) NOT NULL DEFAULT 'normal',
|
||||
employeeid VARCHAR(255) DEFAULT '',
|
||||
isadmin INT2 NOT NULL DEFAULT 0,
|
||||
isglobaladmin INT2 NOT NULL DEFAULT 0,
|
||||
enablesmtp INT2 NOT NULL DEFAULT 1,
|
||||
enablesmtpsecured INT2 NOT NULL DEFAULT 1,
|
||||
enablepop3 INT2 NOT NULL DEFAULT 1,
|
||||
enablepop3secured INT2 NOT NULL DEFAULT 1,
|
||||
enablepop3tls INT2 NOT NULL DEFAULT 1,
|
||||
enableimap INT2 NOT NULL DEFAULT 1,
|
||||
enableimapsecured INT2 NOT NULL DEFAULT 1,
|
||||
enableimaptls INT2 NOT NULL DEFAULT 1,
|
||||
enabledeliver INT2 NOT NULL DEFAULT 1,
|
||||
enablelda INT2 NOT NULL DEFAULT 1,
|
||||
enablemanagesieve INT2 NOT NULL DEFAULT 1,
|
||||
enablemanagesievesecured INT2 NOT NULL DEFAULT 1,
|
||||
enablesieve INT2 NOT NULL DEFAULT 1,
|
||||
enablesievesecured INT2 NOT NULL DEFAULT 1,
|
||||
enablesievetls INT2 NOT NULL DEFAULT 1,
|
||||
enableinternal INT2 NOT NULL DEFAULT 1,
|
||||
enabledoveadm INT2 NOT NULL DEFAULT 1,
|
||||
"enablelib-storage" INT2 NOT NULL DEFAULT 1,
|
||||
"enablequota-status" INT2 NOT NULL DEFAULT 1,
|
||||
"enableindexer-worker" INT2 NOT NULL DEFAULT 1,
|
||||
enablelmtp INT2 NOT NULL DEFAULT 1,
|
||||
enabledsync INT2 NOT NULL DEFAULT 1,
|
||||
enablesogo INT2 NOT NULL DEFAULT 1,
|
||||
-- Must be set to NULL if it's not restricted.
|
||||
allow_nets TEXT DEFAULT NULL,
|
||||
lastlogindate TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
lastloginipv4 INET NOT NULL DEFAULT '0.0.0.0',
|
||||
lastloginprotocol CHAR(255) NOT NULL DEFAULT '',
|
||||
disclaimer TEXT NOT NULL DEFAULT '',
|
||||
-- Below 4 columns are deprecated and will be removed in future release.
|
||||
-- Don't use them.
|
||||
allowedsenders TEXT NOT NULL DEFAULT '',
|
||||
rejectedsenders TEXT NOT NULL DEFAULT '',
|
||||
allowedrecipients TEXT NOT NULL DEFAULT '',
|
||||
rejectedrecipients TEXT NOT NULL DEFAULT '',
|
||||
-- Store per-user settings. Used in iRedAdmin-Pro.
|
||||
settings TEXT NOT NULL DEFAULT '',
|
||||
passwordlastchange TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username)
|
||||
);
|
||||
CREATE INDEX idx_mailbox_domain ON mailbox (domain);
|
||||
CREATE INDEX idx_mailbox_department ON mailbox (department);
|
||||
CREATE INDEX idx_mailbox_employeeid ON mailbox (employeeid);
|
||||
CREATE INDEX idx_mailbox_isadmin ON mailbox (isadmin);
|
||||
CREATE INDEX idx_mailbox_isglobaladmin ON mailbox (isglobaladmin);
|
||||
CREATE INDEX idx_mailbox_enablesmtp ON mailbox (enablesmtp);
|
||||
CREATE INDEX idx_mailbox_enablesmtpsecured ON mailbox (enablesmtpsecured);
|
||||
CREATE INDEX idx_mailbox_enablepop3 ON mailbox (enablepop3);
|
||||
CREATE INDEX idx_mailbox_enablepop3secured ON mailbox (enablepop3secured);
|
||||
CREATE INDEX idx_mailbox_enableimap ON mailbox (enableimap);
|
||||
CREATE INDEX idx_mailbox_enableimapsecured ON mailbox (enableimapsecured);
|
||||
CREATE INDEX idx_mailbox_enableimaptls ON mailbox (enableimaptls);
|
||||
CREATE INDEX idx_mailbox_enablepop3tls ON mailbox (enablepop3tls);
|
||||
CREATE INDEX idx_mailbox_enablesievetls ON mailbox (enablesievetls);
|
||||
CREATE INDEX idx_mailbox_enabledeliver ON mailbox (enabledeliver);
|
||||
CREATE INDEX idx_mailbox_enablelda ON mailbox (enablelda);
|
||||
CREATE INDEX idx_mailbox_enablemanagesieve ON mailbox (enablemanagesieve);
|
||||
CREATE INDEX idx_mailbox_enablemanagesievesecured ON mailbox (enablemanagesievesecured);
|
||||
CREATE INDEX idx_mailbox_enablesieve ON mailbox (enablesieve);
|
||||
CREATE INDEX idx_mailbox_enablesievesecured ON mailbox (enablesievesecured);
|
||||
CREATE INDEX idx_mailbox_enablelmtp ON mailbox (enablelmtp);
|
||||
CREATE INDEX idx_mailbox_enabledsync ON mailbox (enabledsync);
|
||||
CREATE INDEX idx_mailbox_enableinternal ON mailbox (enableinternal);
|
||||
CREATE INDEX idx_mailbox_enabledoveadm ON mailbox (enabledoveadm);
|
||||
CREATE INDEX idx_mailbox_enablelib_storage ON mailbox ("enablelib-storage");
|
||||
CREATE INDEX idx_mailbox_enablequota_status ON mailbox ("enablequota-status");
|
||||
CREATE INDEX idx_mailbox_enableindexer_worker ON mailbox ("enableindexer-worker");
|
||||
CREATE INDEX idx_mailbox_enablesogo ON mailbox (enablesogo);
|
||||
CREATE INDEX idx_mailbox_passwordlastchange ON mailbox (passwordlastchange);
|
||||
CREATE INDEX idx_mailbox_expired ON mailbox (expired);
|
||||
CREATE INDEX idx_mailbox_active ON mailbox (active);
|
||||
|
||||
|
||||
CREATE TABLE maillists (
|
||||
id SERIAL PRIMARY KEY,
|
||||
address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- Per mailing list transport. for example: 'mlmmj:example.com/listname'.
|
||||
transport VARCHAR(255) NOT NULL DEFAULT '',
|
||||
accesspolicy VARCHAR(30) NOT NULL DEFAULT '',
|
||||
maxmsgsize INT8 NOT NULL DEFAULT 0,
|
||||
-- name of the mailing list
|
||||
name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
-- short introduction of the mailing list on subscription page
|
||||
description TEXT,
|
||||
-- a server-wide unique id (a 36-characters string) for each mailing list
|
||||
mlid VARCHAR(36) NOT NULL DEFAULT '',
|
||||
-- control whether newsletter-style subscription from website is enabled
|
||||
-- 1 -> enabled, 0 -> disabled
|
||||
is_newsletter INT2 NOT NULL DEFAULT 0,
|
||||
settings TEXT,
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1
|
||||
);
|
||||
CREATE UNIQUE INDEX idx_maillists_address ON maillists (address);
|
||||
CREATE INDEX idx_maillists_domain ON maillists (domain);
|
||||
CREATE UNIQUE INDEX idx_maillists_mlid ON maillists (mlid);
|
||||
CREATE INDEX idx_maillists_is_newsletter ON maillists (is_newsletter);
|
||||
CREATE INDEX idx_maillists_active ON maillists (active);
|
||||
|
||||
CREATE TABLE sender_bcc_domain (
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (domain)
|
||||
);
|
||||
CREATE INDEX idx_sender_bcc_domain_bcc_address ON sender_bcc_domain (bcc_address);
|
||||
CREATE INDEX idx_sender_bcc_domain_expired ON sender_bcc_domain (expired);
|
||||
CREATE INDEX idx_sender_bcc_domain_active ON sender_bcc_domain (active);
|
||||
|
||||
CREATE TABLE sender_bcc_user (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username)
|
||||
);
|
||||
CREATE INDEX idx_sender_bcc_user_bcc_address ON sender_bcc_user (bcc_address);
|
||||
CREATE INDEX idx_sender_bcc_user_domain ON sender_bcc_user (domain);
|
||||
CREATE INDEX idx_sender_bcc_user_expired ON sender_bcc_user (expired);
|
||||
CREATE INDEX idx_sender_bcc_user_active ON sender_bcc_user (active);
|
||||
|
||||
--
|
||||
-- Table structure for table recipient_bcc_domain
|
||||
--
|
||||
CREATE TABLE recipient_bcc_domain (
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (domain)
|
||||
);
|
||||
CREATE INDEX idx_recipient_bcc_domain_bcc_address ON recipient_bcc_domain (bcc_address);
|
||||
CREATE INDEX idx_recipient_bcc_domain_expired ON recipient_bcc_domain (expired);
|
||||
CREATE INDEX idx_recipient_bcc_domain_active ON recipient_bcc_domain (active);
|
||||
|
||||
--
|
||||
-- Table structure for table recipient_bcc_user
|
||||
--
|
||||
CREATE TABLE recipient_bcc_user (
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
bcc_address VARCHAR(255) NOT NULL DEFAULT '',
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
created TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
modified TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT NOW()::TIMESTAMP WITHOUT TIME ZONE,
|
||||
expired TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT '9999-12-31 01:01:01',
|
||||
active INT2 NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY (username)
|
||||
);
|
||||
CREATE INDEX idx_recipient_bcc_user_bcc_address ON recipient_bcc_user (bcc_address);
|
||||
CREATE INDEX idx_recipient_bcc_user_expired ON recipient_bcc_user (expired);
|
||||
CREATE INDEX idx_recipient_bcc_user_active ON recipient_bcc_user (active);
|
||||
|
||||
-- Sender dependent relayhost.
|
||||
-- - per-user: account='user@domain.com'
|
||||
-- - per-domain: account='@domain.com'
|
||||
-- References:
|
||||
-- - http://www.postfix.org/postconf.5.html#sender_dependent_relayhost_maps
|
||||
-- - http://www.postfix.org/transport.5.html
|
||||
CREATE TABLE sender_relayhost (
|
||||
id SERIAL PRIMARY KEY,
|
||||
account VARCHAR(255) NOT NULL DEFAULT '',
|
||||
relayhost VARCHAR(255) NOT NULL DEFAULT ''
|
||||
);
|
||||
CREATE UNIQUE INDEX idx_sender_relayhost_account ON sender_relayhost (account);
|
||||
|
||||
-- Used to store basic info of deleted mailboxes.
|
||||
CREATE TABLE deleted_mailboxes (
|
||||
id SERIAL PRIMARY KEY,
|
||||
timestamp TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
-- Email address of deleted user
|
||||
username VARCHAR(255) NOT NULL DEFAULT '',
|
||||
|
||||
-- Domain part of username
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
|
||||
-- Absolute path of user's mailbox
|
||||
maildir VARCHAR(255) NOT NULL DEFAULT '',
|
||||
|
||||
-- Deleted by which domain admin
|
||||
admin VARCHAR(255) NOT NULL DEFAULT '',
|
||||
|
||||
-- The time scheduled to delete this mailbox.
|
||||
-- NOTE: it requires cron job + script to actually delete the mailbox.
|
||||
delete_date DATE DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_deleted_mailboxes_timestamp ON deleted_mailboxes (timestamp);
|
||||
CREATE INDEX idx_deleted_mailboxes_username ON deleted_mailboxes (username);
|
||||
CREATE INDEX idx_deleted_mailboxes_domain ON deleted_mailboxes (domain);
|
||||
CREATE INDEX idx_deleted_mailboxes_admin ON deleted_mailboxes (admin);
|
||||
CREATE INDEX idx_delete_date ON deleted_mailboxes (delete_date);
|
||||
|
||||
--
|
||||
-- IMAP shared folders. User 'from_user' shares folders to user 'to_user'.
|
||||
-- WARNING: Works only with Dovecot 1.2+.
|
||||
--
|
||||
CREATE TABLE share_folder (
|
||||
from_user VARCHAR(255) NOT NULL,
|
||||
to_user VARCHAR(255) NOT NULL,
|
||||
dummy CHAR(1),
|
||||
PRIMARY KEY (from_user, to_user)
|
||||
);
|
||||
CREATE INDEX idx_share_folder_from_user ON share_folder (from_user);
|
||||
CREATE INDEX idx_share_folder_to_user ON share_folder (to_user);
|
||||
|
||||
CREATE TABLE anyone_shares (
|
||||
from_user VARCHAR(255) NOT NULL,
|
||||
dummy CHAR(1),
|
||||
PRIMARY KEY (from_user)
|
||||
);
|
||||
|
||||
-- used_quota
|
||||
-- Used to store realtime mailbox quota in Dovecot.
|
||||
-- WARNING: Works only with Dovecot 1.2+.
|
||||
--
|
||||
-- Note: Don't touch this table, it will be updated by Dovecot automatically.
|
||||
CREATE TABLE used_quota (
|
||||
username VARCHAR(255) NOT NULL,
|
||||
bytes INT8 NOT NULL DEFAULT 0,
|
||||
messages INT8 NOT NULL DEFAULT 0,
|
||||
domain VARCHAR(255) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (username)
|
||||
);
|
||||
CREATE INDEX idx_used_quota_domain ON used_quota (domain);
|
||||
|
||||
-- Trigger required by quota dict
|
||||
CREATE OR REPLACE FUNCTION merge_quota() RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
IF NEW.messages < 0 OR NEW.messages IS NULL THEN
|
||||
-- ugly kludge: we came here from this function, really do try to insert
|
||||
IF NEW.messages IS NULL THEN
|
||||
NEW.messages = 0;
|
||||
ELSE
|
||||
NEW.messages = -NEW.messages;
|
||||
END IF;
|
||||
return NEW;
|
||||
END IF;
|
||||
|
||||
LOOP
|
||||
UPDATE used_quota
|
||||
SET bytes = bytes + NEW.bytes, messages = messages + NEW.messages, domain=split_part(NEW.username, '@', 2)
|
||||
WHERE username = NEW.username;
|
||||
IF found THEN
|
||||
RETURN NULL;
|
||||
END IF;
|
||||
|
||||
BEGIN
|
||||
IF NEW.messages = 0 THEN
|
||||
INSERT INTO used_quota (bytes, messages, username, domain)
|
||||
VALUES (NEW.bytes, NULL, NEW.username, split_part(NEW.username, '@', 2));
|
||||
ELSE
|
||||
INSERT INTO used_quota (bytes, messages, username, domain)
|
||||
VALUES (NEW.bytes, -NEW.messages, NEW.username, split_part(NEW.username, '@', 2));
|
||||
END IF;
|
||||
return NULL;
|
||||
EXCEPTION WHEN unique_violation THEN
|
||||
-- someone just inserted the record, update it
|
||||
END;
|
||||
END LOOP;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER mergequota
|
||||
BEFORE INSERT ON used_quota FOR EACH ROW
|
||||
EXECUTE PROCEDURE merge_quota();
|
||||
@@ -0,0 +1,452 @@
|
||||
#---------------------------------------------------------------------
|
||||
# This file is part of iRedMail, which is an open source mail server
|
||||
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
#
|
||||
# iRedMail is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# iRedMail is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# This schema is shipped within iRedMail project:
|
||||
# http://www.iredmail.org/
|
||||
#
|
||||
# It should be localed at:
|
||||
# - RHEL/CentOS: /etc/openldap/schema/iredmail.schema
|
||||
# - Debian: /etc/ldap/schema/iredmail.schema
|
||||
# - FreeBSD: /usr/local/etc/openldap/schema/
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
# The offical iRedMail OID assigned by IANA is 32349, you can find it in url:
|
||||
# http://www.iana.org/assignments/enterprise-numbers
|
||||
#
|
||||
# 1.3.6.1.4.1.32349 OID of iRedMail.org
|
||||
# 1.3.6.1.4.1.32349.1 iRedMail
|
||||
# 1.3.6.1.4.1.32349.1.2 iRedMail LDAP Elements
|
||||
# 1.3.6.1.4.1.32349.1.2.1 AttributeTypes
|
||||
# 1.3.6.1.4.1.32349.1.2.2 ObjectClasses
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
# This schema depends on:
|
||||
# - core.schema
|
||||
# - cosine.schema
|
||||
#
|
||||
|
||||
#
|
||||
# Mail Service: Domain related attributes.
|
||||
#
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.1 NAME 'domainName'
|
||||
DESC 'Virtual Domain Name'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255}
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.2 NAME 'mtaTransport'
|
||||
DESC 'Transport program for Postfix'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
# When updating 'accountStatus=' for mail domain, must update 'domainStatus'
|
||||
# for all mail user/alias/list accounts.
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.3 NAME 'domainStatus'
|
||||
DESC 'Domain status, used by mail user/alias/list, not by mail domain itself.'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.4 NAME 'domainAdmin'
|
||||
DESC 'Domain admin'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.5 NAME 'domainGlobalAdmin'
|
||||
DESC 'Site wide domin admin: yes'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.6 NAME 'domainBackupMX'
|
||||
DESC 'Backup MX: yes, no'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.7 NAME 'domainSenderBccAddress'
|
||||
DESC 'Sender BCC address for whole domain'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320}
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.8 NAME 'domainRecipientBccAddress'
|
||||
DESC 'Recipient BCC address for whole domain'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320}
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.9 NAME 'domainMaxQuotaSize'
|
||||
DESC 'Obsoleted. Max quota size limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.10 NAME 'domainCurrentQuotaSize'
|
||||
DESC 'Current quota size limit for single domain'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.11 NAME 'domainMaxUserNumber'
|
||||
DESC 'Obsoleted. Max user number limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.12 NAME 'domainCurrentUserNumber'
|
||||
DESC 'Current user number limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.13 NAME 'domainMaxAliasNumber'
|
||||
DESC 'Obsoleted. Max alias number limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.14 NAME 'domainCurrentAliasNumber'
|
||||
DESC 'Current alias number limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.15 NAME 'domainMaxListNumber'
|
||||
DESC 'Obsoleted. Max mail list number limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.16 NAME 'domainCurrentListNumber'
|
||||
DESC 'Current mail list number limit for single domain'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.17 NAME 'disclaimer'
|
||||
DESC 'Disclaimer text'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.18 NAME 'domainDefaultUserQuota'
|
||||
DESC 'Default quota for new user'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.19 NAME 'domainAliasName'
|
||||
DESC 'Domain Alias Name'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.20 NAME 'domainWhitelistIP'
|
||||
DESC 'Whitelist IP address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.21 NAME 'domainWhitelistSender'
|
||||
DESC 'Whitelist sender address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.22 NAME 'domainBlacklistIP'
|
||||
DESC 'Blacklist IP address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.23 NAME 'domainBlacklistSender'
|
||||
DESC 'Blacklist sender address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.1.24 NAME 'domainPendingAliasName'
|
||||
DESC 'Pending alias domain name'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255} )
|
||||
|
||||
#
|
||||
# Mail Service: User related attributes.
|
||||
#
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.1 NAME 'mailUID'
|
||||
DESC 'UID of the user on the mailsystem'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.2 NAME 'mailGID'
|
||||
DESC 'GID of the user on the mailsystem'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.3 NAME 'storageBaseDirectory'
|
||||
DESC 'Path to mail storage base directory. Deprecated since iRedMail-0.9.8.'
|
||||
EQUALITY caseExactIA5Match
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.4 NAME 'mailMessageStore'
|
||||
DESC 'Path to the maildir/mbox on the mail system. Deprecated since iRedMail-0.9.8.'
|
||||
EQUALITY caseExactIA5Match
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.5 NAME 'mailQuota'
|
||||
DESC 'The amount of space the user can use until all further messages get bounced'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.6 NAME 'mailQuotaMessageLimit'
|
||||
DESC 'Quota limit in number of messages, 0 means unlimited'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.7 NAME 'mailHost'
|
||||
DESC 'On which mail server the messagestore of this user is located'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.8 NAME 'mailForwardingAddress'
|
||||
DESC 'Address(es) to forward all incoming messages to.'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreIA5SubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.9 NAME 'accountStatus'
|
||||
DESC 'The status of a user account: active, disabled'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.10 NAME 'userRecipientBccAddress'
|
||||
DESC 'Recipient BCC address for single user: must be a valid email address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320}
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.11 NAME 'userSenderBccAddress'
|
||||
DESC 'Sender BCC address for single user: must be a valid email address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320}
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.12 NAME 'backupMailAddress'
|
||||
DESC 'Backup mail address, used to reset password or whatever'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320}
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.13 NAME 'enabledService'
|
||||
DESC 'Enabled service: mail, smtp, imap, pop3, deliver, forward, senderbcc, recipientbcc, displayedInGlobalAddressBook'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.14 NAME 'memberOfGroup'
|
||||
DESC 'Group/List name which user belong to, MUST be a valid email address'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.15 NAME 'lastLoginDate'
|
||||
DESC 'Last login date.'
|
||||
EQUALITY generalizedTimeMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.16 NAME 'lastLoginIP'
|
||||
DESC 'Last login ip address.'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.17 NAME 'lastLoginProtocol'
|
||||
DESC 'Mail protocol used in last login: pop3, imap'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.18 NAME 'expiredDate'
|
||||
DESC 'Account expired date in YYYYMMDDHHMMSSZ format. Sample: 20180323142122Z'
|
||||
EQUALITY generalizedTimeMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.24
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.19 NAME 'shadowAddress'
|
||||
DESC 'Shadow address for mail user'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.20 NAME 'accountSetting'
|
||||
DESC 'Account setting. Default format: var:value'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.21 NAME 'userManager'
|
||||
DESC 'Mail address of manager'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.22 NAME 'mailWhitelistRecipient'
|
||||
DESC 'Whitelist recipient'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.23 NAME 'mailBlacklistRecipient'
|
||||
DESC 'Blacklist recipient'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.24 NAME 'disabledService'
|
||||
DESC 'Disabled service names'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
|
||||
|
||||
# This is a comma separated list of IPs and/or networks where the user is
|
||||
# allowed to log in from. If the user tries to log in elsewhere, the
|
||||
# authentication will fail the same way as if a wrong password was given.
|
||||
# Used in Dovecot LDAP query 'pass_attrs ='.
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.25 NAME 'allowNets'
|
||||
DESC 'Allow user to log in from only specified IPs.'
|
||||
EQUALITY caseIgnoreMatch
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1024}
|
||||
SINGLE-VALUE )
|
||||
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.26 NAME 'senderRelayHost'
|
||||
DESC 'Sender dependent relayhost'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{255}
|
||||
SINGLE-VALUE )
|
||||
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.27 NAME 'maxMessageSize'
|
||||
DESC 'Max message size (in bytes)'
|
||||
EQUALITY integerMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
|
||||
SINGLE-VALUE )
|
||||
|
||||
# Mailbox format.
|
||||
# All formats supported by Dovecot are ok. e.g. maildir, mdbox.
|
||||
# FYI: https://wiki2.dovecot.org/MailboxFormat
|
||||
# Dovecot config file (/etc/dovecot/dovecot-ldap.conf) sets default value
|
||||
# to 'maildir' if this attribute doesn't present.
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.28 NAME 'mailboxFormat'
|
||||
DESC 'Mailbox format. All formats supported by Dovecot are ok. e.g. maildir, mdbox.'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{50}
|
||||
SINGLE-VALUE )
|
||||
|
||||
# Mailbox folder name can be any folder name supported by Linux/BSD file system.
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.2.29 NAME 'mailboxFolder'
|
||||
DESC 'Folder name appended to maildir path. e.g. Maildir, Mailbox.'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{50}
|
||||
SINGLE-VALUE )
|
||||
|
||||
#
|
||||
# Mail Service: Mail List related attributes.
|
||||
#
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.3.1 NAME 'accessPolicy'
|
||||
DESC 'Mail list access policy: open, domain, subdomain, moedratorsonly, memberOnly'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.3.2 NAME 'hasMember'
|
||||
DESC 'Group has members: yes, no'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
|
||||
SINGLE-VALUE )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.3.3 NAME 'listAllowedUser'
|
||||
DESC 'Addresses which are ALWAYS allowed to send email to mailing list'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.3.4 NAME 'listModerator'
|
||||
DESC 'Moderator of mailing list'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{320} )
|
||||
attributetype ( 1.3.6.1.4.1.32349.1.2.3.5 NAME 'mailingListID'
|
||||
DESC 'A server-wide unique id for each (mlmmj) mailing list'
|
||||
EQUALITY caseIgnoreIA5Match
|
||||
SUBSTR caseIgnoreSubstringsMatch
|
||||
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{36} )
|
||||
|
||||
#
|
||||
# Object Class Definitions
|
||||
#
|
||||
objectclass ( 1.3.6.1.4.1.32349.1.2.4.1 NAME 'mailDomain'
|
||||
DESC 'Mail Domain' SUP top STRUCTURAL
|
||||
MUST ( domainName )
|
||||
MAY ( cn $ mtaTransport $ domainAdmin $
|
||||
enabledService $ disabledService $
|
||||
domainBackupMX $ accountStatus $ mailHost $
|
||||
domainSenderBccAddress $ domainRecipientBccAddress $
|
||||
domainMaxQuotaSize $ domainCurrentQuotaSize $
|
||||
domainMaxUserNumber $ domainCurrentUserNumber $
|
||||
domainMaxAliasNumber $ domainCurrentAliasNumber $
|
||||
domainMaxListNumber $ domainCurrentListNumber $
|
||||
domainDefaultUserQuota $ domainAliasName $ domainPendingAliasName $
|
||||
disclaimer $ description $ street $ telephoneNumber $
|
||||
facsimileTelephoneNumber $ expiredDate $ accountSetting $
|
||||
domainWhitelistIP $ domainWhitelistSender $
|
||||
domainBlacklistIP $ domainBlacklistSender $
|
||||
preferredLanguage $ senderRelayHost ) )
|
||||
objectclass ( 1.3.6.1.4.1.32349.1.2.4.2 NAME 'mailAdmin'
|
||||
DESC 'Mail Domain Admin' SUP top STRUCTURAL
|
||||
MUST ( mail )
|
||||
MAY ( domainGlobalAdmin $ description $
|
||||
enabledService $ disabledService $
|
||||
userPassword $ accountStatus $ cn $ sn $
|
||||
preferredLanguage $ givenName $ expiredDate $
|
||||
mailHost $ lastLoginDate $ accountSetting $ shadowLastChange ) )
|
||||
objectclass ( 1.3.6.1.4.1.32349.1.2.4.3 NAME 'mailUser'
|
||||
DESC 'Mail User' SUP top AUXILIARY
|
||||
MUST ( mail $ uid )
|
||||
MAY ( storageBaseDirectory $ mailMessageStore $ homeDirectory $
|
||||
userPassword $ mailHost $ mailUID $ mailGID $
|
||||
mailQuota $ mailQuotaMessageLimit $
|
||||
mailForwardingAddress $ shadowAddress $ accountStatus $
|
||||
userRecipientBccAddress $ userSenderBccAddress $
|
||||
enabledService $ disabledService $
|
||||
telephoneNumber $ backupMailAddress $
|
||||
mtaTransport $ memberOfGroup $ expiredDate $
|
||||
lastLoginDate $ lastLoginIP $ lastLoginProtocol $
|
||||
preferredLanguage $ disclaimer $ accountSetting $
|
||||
title $ userManager $
|
||||
mailWhitelistRecipient $ mailBlacklistRecipient $
|
||||
domainGlobalAdmin $ allowNets $ senderRelayHost $
|
||||
domainStatus $ maxMessageSize $ mailboxFormat $ mailboxFolder ) )
|
||||
objectclass ( 1.3.6.1.4.1.32349.1.2.4.4 NAME 'mailAlias'
|
||||
DESC 'Mail Alias Account' SUP top STRUCTURAL
|
||||
MUST ( mail )
|
||||
MAY ( accountStatus $ description $ cn $ memberOfGroup $
|
||||
enabledService $ disabledService $
|
||||
mailForwardingAddress $ shadowAddress $ expiredDate $
|
||||
accountSetting $ mailHost $ domainStatus ) )
|
||||
|
||||
# Notes:
|
||||
# - 'mtaTransport' and 'mailingListID' are used by mlmmj mailing list account
|
||||
objectclass ( 1.3.6.1.4.1.32349.1.2.4.5 NAME 'mailList'
|
||||
DESC 'Mailing List Account' SUP top STRUCTURAL
|
||||
MUST ( mail )
|
||||
MAY ( cn $ accountStatus $ description $ accessPolicy $ shadowAddress $
|
||||
enabledService $ disabledService $ memberOfGroup $ hasMember $
|
||||
listAllowedUser $ expiredDate $ accountSetting $ mailHost $
|
||||
member $ uniqueMember $ memberUid $ gidNumber $ domainStatus $
|
||||
mtaTransport $ mailinglistID $ maxMessageSize ) )
|
||||
objectclass ( 1.3.6.1.4.1.32349.1.2.4.6 NAME 'mailExternalUser'
|
||||
DESC 'Mail External User' SUP top STRUCTURAL
|
||||
MUST ( memberOfGroup )
|
||||
MAY ( cn $ accountStatus $ mail $ enabledService $ disabledService $
|
||||
description $ mailHost $ accountSetting $ shadowAddress $
|
||||
domainStatus ) )
|
||||
@@ -0,0 +1,13 @@
|
||||
PH_DOVECOT_LOG_DIR/*.log {
|
||||
weekly
|
||||
rotate 10
|
||||
missingok
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
sharedscripts
|
||||
|
||||
postrotate
|
||||
PH_SYSLOG_POSTROTATE_CMD
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
PH_IREDAPD_LOG_DIR/*.log {
|
||||
weekly
|
||||
rotate 10
|
||||
missingok
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
sharedscripts
|
||||
|
||||
postrotate
|
||||
PH_SYSLOG_POSTROTATE_CMD
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
PH_MLMMJADMIN_LOG_DIR/*.log {
|
||||
weekly
|
||||
rotate 10
|
||||
missingok
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
sharedscripts
|
||||
|
||||
postrotate
|
||||
PH_SYSLOG_POSTROTATE_CMD
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
PH_OPENLDAP_LOG_FILE {
|
||||
compress
|
||||
weekly
|
||||
rotate 10
|
||||
create 0600 PH_SYS_USER_LDAP PH_SYS_GROUP_LDAP
|
||||
missingok
|
||||
notifempty
|
||||
sharedscripts
|
||||
|
||||
# Use bzip2 for compress.
|
||||
#compresscmd bzip2
|
||||
#uncompresscmd bunzip2
|
||||
#compressoptions -9
|
||||
#compressext .bz2
|
||||
|
||||
postrotate
|
||||
PH_SYSLOG_POSTROTATE_CMD
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
PH_PHP_FPM_LOG_DIR/*.log {
|
||||
weekly
|
||||
rotate 10
|
||||
missingok
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
sharedscripts
|
||||
|
||||
postrotate
|
||||
/bin/kill -SIGUSR1 `cat PH_PHP_FPM_PID_FILE 2>/dev/null` 2>/dev/null || true
|
||||
endscript
|
||||
}
|
||||
Executable
+92
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env bash
|
||||
# File name: mlmmj-amime-receive
|
||||
# Purpose: Read mail messages from stdin, pipe it to altermime to add footer
|
||||
# in MIME-aware way, then pipe modified message to mlmmj-receive for
|
||||
# final delivery.
|
||||
#
|
||||
# Requirements:
|
||||
# - altermime: http://www.pldaniels.com/altermime/
|
||||
#
|
||||
# Authors:
|
||||
# - Original wrote by Gerd v. Egidy <gerd@egidy.de>, MIT License.
|
||||
# - Updated by Zhang Huangbin <zhb@iredmail.org>.
|
||||
|
||||
export PATH="/usr/bin:/usr/local/bin:/bin:/sbin:/usr/sbin:/usr/local/sbin:$PATH"
|
||||
|
||||
# All `mlmmj-*` programs must be ran with absolute path to the program.
|
||||
if [[ -x /usr/local/bin/mlmmj-receive ]]; then
|
||||
export CMD_MLMMJ_RECEIVE='/usr/local/bin/mlmmj-receive'
|
||||
else
|
||||
export CMD_MLMMJ_RECEIVE='/usr/bin/mlmmj-receive'
|
||||
fi
|
||||
|
||||
if [[ -x /usr/local/bin/altermime ]]; then
|
||||
export CMD_ALTERMIME='/usr/local/bin/altermime'
|
||||
else
|
||||
export CMD_ALTERMIME='/usr/bin/altermime'
|
||||
fi
|
||||
|
||||
# File names used to store footer in different MIME types:
|
||||
# plain text, html, base64 encoded.
|
||||
# WARNING: both `footer_text` and `footer_html` must exist.
|
||||
export FILE_FOOTER_TEXT='footer_text'
|
||||
export FILE_FOOTER_HTML='footer_html'
|
||||
|
||||
# Make sure command `mlmmj-receive` exist and executable
|
||||
if [ ! -x ${CMD_MLMMJ_RECEIVE} ]; then
|
||||
echo "Command ${CMD_MLMMJ_RECEIVE} doesn't exist or not executable, mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get mailing list directory passed to '-L' argument
|
||||
ML_DIR=''
|
||||
_has_L='NO'
|
||||
for i in $@; do
|
||||
if [ X"${_has_L}" == X'NO' ]; then
|
||||
if [ X"$i" == X'-L' ]; then
|
||||
_has_L='YES'
|
||||
fi
|
||||
else
|
||||
ML_DIR="$i"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ X"${ML_DIR}" == X'' ]; then
|
||||
echo "No mailing list directory specified (-L /path/to/listdir), mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${ML_DIR}" ]; then
|
||||
echo "Mailing list directory (${ML_DIR}) does not exist or not a directory, mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Mailing list sub-directory: control
|
||||
ML_SUBDIR_CONTROL="${ML_DIR}/control"
|
||||
|
||||
if [ ! -d "${ML_SUBDIR_CONTROL}" ]; then
|
||||
echo "Mailing list control directory (${ML_SUBDIR_CONTROL}) does not exist or not a directory, mail delivery aborted"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Path to footer files
|
||||
PATH_FOOTER_TEXT="${ML_SUBDIR_CONTROL}/${FILE_FOOTER_TEXT}"
|
||||
PATH_FOOTER_HTML="${ML_SUBDIR_CONTROL}/${FILE_FOOTER_HTML}"
|
||||
|
||||
# go to a dir where altermime can write it's tmp-files safely
|
||||
cd ${ML_DIR}
|
||||
|
||||
if [[ -x ${CMD_ALTERMIME} ]] && [[ -f ${PATH_FOOTER_TEXT} ]] && [[ -f ${PATH_FOOTER_HTML} ]]; then
|
||||
# pipe to altermime for MIME modification, then pipe to mlmmj-receive for final delivery.
|
||||
${CMD_ALTERMIME} --input=- \
|
||||
--altersigned \
|
||||
--log-syslog \
|
||||
--disclaimer=${PATH_FOOTER_TEXT} \
|
||||
--disclaimer-html=${PATH_FOOTER_HTML} \
|
||||
--htmltoo \
|
||||
--force-for-bad-html | ${CMD_MLMMJ_RECEIVE} "$@"
|
||||
else
|
||||
echo "Mail delivered without modificaiton."
|
||||
${CMD_MLMMJ_RECEIVE} "$@"
|
||||
fi
|
||||
@@ -0,0 +1,49 @@
|
||||
############################################################
|
||||
# DO NOT TOUCH THIS LINE.
|
||||
from libs.default_settings import *
|
||||
############################################################
|
||||
|
||||
# Listen address and port
|
||||
listen_address = 'PH_MLMMJADMIN_BIND_HOST'
|
||||
listen_port = PH_MLMMJADMIN_LISTEN_PORT
|
||||
|
||||
# Run as a non-privileged user/group.
|
||||
run_as_user = 'PH_SYS_USER_MLMMJ'
|
||||
run_as_group = 'PH_SYS_GROUP_MLMMJ'
|
||||
|
||||
# Pid file
|
||||
pid_file = 'PH_MLMMJADMIN_PID_FILE'
|
||||
|
||||
# Log level: info, debug.
|
||||
log_level = 'info'
|
||||
|
||||
# Specify the backend used to query/update meta data stored in SQL/LDAP.
|
||||
#
|
||||
# - `backend_api` is used when accessing RESTful API.
|
||||
# - `backend_cli` is used when you're managing mailing list account with
|
||||
# command line tool like `tools/maillist_admin.py`.
|
||||
#
|
||||
# Different backends may require different parameters in settings.py, please
|
||||
# read the comment lines in `backends/bk_*.py`.
|
||||
#
|
||||
# Available backends:
|
||||
#
|
||||
# - bk_iredmail_ldap: for iRedMail with OpenLDAP backend
|
||||
# - bk_iredmail_sql: for iRedMail with SQL backends (MySQL, MariaDB, PostgreSQL)
|
||||
# - bk_none: pure mlmmj, no SQL/LDAP database.
|
||||
#
|
||||
# WARNING: For iRedMail users, if you don't have iRedAdmin-Pro, please enable
|
||||
# proper backend below so that mlmmjadmin will store mailing list accounts in
|
||||
# SQL/LDAP database.
|
||||
backend_api = 'bk_none'
|
||||
backend_cli = 'bk_none'
|
||||
|
||||
# A list of API AUTH tokens (secret strings) used for authentication.
|
||||
# It's strong recommended to use a long string as auth token, program will log
|
||||
# first 8 characters to help you identity the client.
|
||||
api_auth_tokens = ['PH_MLMMJADMIN_API_AUTH_TOKEN']
|
||||
|
||||
MLMMJ_SPOOL_DIR = 'PH_MLMMJ_SPOOL_DIR'
|
||||
MLMMJ_ARCHIVE_DIR = 'PH_MLMMJ_ARCHIVE_DIR'
|
||||
MLMMJ_SKEL_DIR = 'PH_MLMMJ_SKEL_DIR'
|
||||
MLMMJ_DEFAULT_PROFILE_SETTINGS.update({'smtp_port': PH_AMAVISD_MLMMJ_PORT})
|
||||
@@ -0,0 +1,95 @@
|
||||
#---------------------------------------------------------------------
|
||||
# This file is part of iRedMail, which is an open source mail server
|
||||
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
|
||||
#
|
||||
# iRedMail is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# iRedMail is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with iRedMail. If not, see <http://www.gnu.org/licenses/>.
|
||||
#---------------------------------------------------------------------
|
||||
|
||||
#
|
||||
# Sample MySQL configuration file. It should be located at:
|
||||
#
|
||||
# - RHEL/CentOS: /etc/my.cnf
|
||||
# - FreeBSD (www/mysql56-server): /var/db/mysql/my.cnf
|
||||
#
|
||||
# Shipped within iRedMail project:
|
||||
# http://www.iredmail.org/
|
||||
#
|
||||
|
||||
[client]
|
||||
default-character-set = utf8mb4
|
||||
|
||||
[mysqld]
|
||||
#bind-address = 127.0.0.1
|
||||
port = 3306
|
||||
character-set-server = utf8mb4
|
||||
collation-server = utf8mb4_unicode_ci
|
||||
#datadir = /var/lib/mysql
|
||||
#socket = /var/lib/mysql/mysql.sock
|
||||
#user = mysql
|
||||
|
||||
#general_log = 1
|
||||
#general_log_file = /var/log/mysql.log
|
||||
|
||||
#slow_query_log
|
||||
#slow_query_log_file = /var/log/mysql_slow.log
|
||||
|
||||
skip-external-locking
|
||||
#skip-bdb
|
||||
#skip-networking
|
||||
|
||||
# Disable query cache
|
||||
query-cache-type = 0
|
||||
query-cache-size = 0
|
||||
|
||||
thread_cache_size = 8
|
||||
open_files_limit = 65535
|
||||
max_connections = 1024
|
||||
#max_connect_errors = 150
|
||||
|
||||
# When a MySQL client or the mysqld server receives a packet bigger than
|
||||
# max_allowed_packet bytes, it issues an ER_NET_PACKET_TOO_LARGE error and
|
||||
# closes the connection. With some clients, you may also get a Lost connection
|
||||
# to MySQL server during query error if the communication packet is too large.
|
||||
max_allowed_packet = 64M
|
||||
|
||||
# If you got error message like "The total number of locks exceeds the lock table size",
|
||||
# please try to increase 'innodb_buffer_pool_size' to a reasonable value.
|
||||
# Restarting MySQL server is required to make new value work.
|
||||
# You can get current value with SQL command:
|
||||
#
|
||||
# mysql> SHOW ENGINE INNODB STATUS \G
|
||||
# [...]
|
||||
# Buffer pool size 512
|
||||
# [...]
|
||||
#
|
||||
#innodb_buffer_pool_size=512M
|
||||
|
||||
# Creates each new table using its own .ibd file for storing data and indexes,
|
||||
# rather than in the system tablespace (ibdata*).
|
||||
# Reference:
|
||||
# http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_file_per_table
|
||||
innodb_file_per_table
|
||||
|
||||
#ssl-ca =
|
||||
#ssl-cert =
|
||||
#ssl-key =
|
||||
#ssl-cipher = ALL
|
||||
|
||||
#[mysql.server]
|
||||
#user = mysql
|
||||
#basedir = /var/lib
|
||||
|
||||
#[mysqld_safe]
|
||||
#log-error = /var/log/mysqld.log
|
||||
#pid-file = /var/run/mysqld/mysqld.pid
|
||||
@@ -0,0 +1,32 @@
|
||||
USE PH_VMAIL_DB_NAME;
|
||||
|
||||
-- Add your first domain
|
||||
INSERT INTO domain (domain, transport, settings, created)
|
||||
VALUES ('PH_FIRST_DOMAIN', 'PH_TRANSPORT', 'default_user_quota:1024;', NOW());
|
||||
|
||||
-- Add your first normal user
|
||||
INSERT INTO mailbox (username,
|
||||
password,
|
||||
name,
|
||||
maildir,
|
||||
quota,
|
||||
domain,
|
||||
isadmin,
|
||||
isglobaladmin,
|
||||
created)
|
||||
VALUES ('PH_DOMAIN_ADMIN_EMAIL',
|
||||
'PH_DOMAIN_ADMIN_PASSWD_HASH',
|
||||
'PH_DOMAIN_ADMIN_NAME',
|
||||
'PH_DOMAIN_ADMIN_MAILDIR_HASH_PART',
|
||||
1024,
|
||||
'PH_FIRST_DOMAIN',
|
||||
1,
|
||||
1,
|
||||
NOW());
|
||||
|
||||
INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
|
||||
VALUES ('PH_DOMAIN_ADMIN_EMAIL', 'PH_DOMAIN_ADMIN_EMAIL', 'PH_FIRST_DOMAIN', 'PH_FIRST_DOMAIN', 1);
|
||||
|
||||
-- Mark first mail user as global admin
|
||||
INSERT INTO domain_admins (username, domain, created)
|
||||
VALUES ('PH_DOMAIN_ADMIN_EMAIL', 'ALL', NOW());
|
||||
@@ -0,0 +1,7 @@
|
||||
-- Delete anonymouse user.
|
||||
USE mysql;
|
||||
|
||||
DELETE FROM user WHERE User='';
|
||||
DELETE FROM db WHERE User='';
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
@@ -0,0 +1,10 @@
|
||||
-- Create database for virtual hosts
|
||||
CREATE DATABASE IF NOT EXISTS PH_VMAIL_DB_NAME CHARACTER SET utf8;
|
||||
|
||||
-- Permissions
|
||||
GRANT SELECT ON PH_VMAIL_DB_NAME.* TO 'PH_VMAIL_DB_BIND_USER'@'PH_MYSQL_GRANT_HOST' IDENTIFIED BY 'PH_VMAIL_DB_BIND_PASSWD';
|
||||
-- GRANT SELECT ON PH_VMAIL_DB_NAME.* TO 'PH_VMAIL_DB_BIND_USER'@'PH_HOSTNAME' IDENTIFIED BY 'PH_VMAIL_DB_BIND_PASSWD';
|
||||
GRANT SELECT,INSERT,DELETE,UPDATE ON PH_VMAIL_DB_NAME.* TO 'PH_VMAIL_DB_ADMIN_USER'@'PH_MYSQL_GRANT_HOST' IDENTIFIED BY 'PH_VMAIL_DB_ADMIN_PASSWD';
|
||||
-- GRANT SELECT,INSERT,DELETE,UPDATE ON PH_VMAIL_DB_NAME.* TO 'PH_VMAIL_DB_ADMIN_USER'@'PH_HOSTNAME' IDENTIFIED BY 'PH_VMAIL_DB_ADMIN_PASSWD';
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
@@ -0,0 +1,9 @@
|
||||
-- Grant access privilege to ${MYSQL_ROOT_USER}@${MYSQL_GRANT_HOST} ...'
|
||||
|
||||
USE mysql;
|
||||
|
||||
-- Allow access from MYSQL_GRANT_HOST with password
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'PH_MYSQL_ROOT_USER'@'PH_MYSQL_GRANT_HOST' WITH GRANT OPTION;
|
||||
-- GRANT ALL PRIVILEGES ON *.* TO 'PH_MYSQL_ROOT_USER'@'PH_HOSTNAME' WITH GRANT OPTION;
|
||||
|
||||
FLUSH PRIVILEGES;
|
||||
@@ -0,0 +1,24 @@
|
||||
# netdata go.d.plugin configuration
|
||||
#
|
||||
# This file is in YaML format.
|
||||
|
||||
# Enable/disable the whole go.d.plugin.
|
||||
enabled: yes
|
||||
|
||||
# Enable/disable default value for all modules.
|
||||
default_run: yes
|
||||
|
||||
# Maximum number of used CPUs. Zero means no limit.
|
||||
max_procs: 0
|
||||
|
||||
# Enable/disable specific g.d.plugin module
|
||||
modules:
|
||||
apache: no
|
||||
lighttpd: no
|
||||
lighttpd2: no
|
||||
energid: no
|
||||
|
||||
web_log: yes
|
||||
nginx: yes
|
||||
phpfpm: yes
|
||||
mysql: yes
|
||||
@@ -0,0 +1,3 @@
|
||||
jobs:
|
||||
- name: local
|
||||
dsn: PH_NETDATA_DB_USER:PH_NETDATA_DB_PASSWD@tcp(PH_MYSQL_SERVER_ADDRESS:PH_MYSQL_SERVER_PORT)/
|
||||
@@ -0,0 +1,4 @@
|
||||
jobs:
|
||||
- name: local
|
||||
url: https://127.0.0.1/stub_status
|
||||
tls_skip_verify: yes
|
||||
@@ -0,0 +1,4 @@
|
||||
jobs:
|
||||
- name: local
|
||||
url: https://127.0.0.1/status?full&json
|
||||
tls_skip_verify: yes
|
||||
@@ -0,0 +1 @@
|
||||
SEND_EMAIL="NO"
|
||||
@@ -0,0 +1,63 @@
|
||||
# Get config from http://127.0.0.1:<netdata_port>/netdata.conf
|
||||
[registry]
|
||||
# Disable public central registry and become registry locally
|
||||
enabled = yes
|
||||
|
||||
# Register to internal server instead
|
||||
registry to announce = http://127.0.0.1:PH_NETDATA_PORT
|
||||
|
||||
[global]
|
||||
# The number of entries the netdata daemon will by default keep in memory
|
||||
# for each chart dimension. This setting can also be configured per chart.
|
||||
history = 172800
|
||||
|
||||
# memory mode
|
||||
# - `save` is the default mode, data are maintained in memory and saved to
|
||||
# disk when netdata exits.
|
||||
# - `ram` data are exclusively on memory and never saved on disk.
|
||||
# - `map` like swap, files are mapped to memory on demand.
|
||||
#
|
||||
# WARNING: We suggest not to use this mode on nodes that run other
|
||||
# applications.
|
||||
#
|
||||
# - `none` no local database (used when data are streamed to a remote netdata).
|
||||
# - `dbengine`: data are in database files.
|
||||
# The Database Engine works like a traditional database.
|
||||
memory mode = dbengine
|
||||
|
||||
#
|
||||
# dbengine.
|
||||
#
|
||||
# determines the amount of RAM in MiB that is dedicated to caching netdata
|
||||
# metric values themselves.
|
||||
page cache size = 32
|
||||
|
||||
# determines the amount of disk space in MiB that is dedicated to storing
|
||||
# netdata metric values and all related metadata describing them.
|
||||
dbengine disk space = 256
|
||||
|
||||
# Bind to 127.0.0.1 by default.
|
||||
bind to = 127.0.0.1
|
||||
# Bind to all available network interfaces, but allow access from specified
|
||||
# IP addresses or networks.
|
||||
#bind to = *
|
||||
#allow connections from =
|
||||
|
||||
run as user = PH_SYS_USER_NETDATA
|
||||
default port = PH_NETDATA_PORT
|
||||
|
||||
# The frequency in seconds, for data collection.
|
||||
update every = 3
|
||||
|
||||
# Log files
|
||||
# Nginx logs access log, netdata no need to log it again.
|
||||
access log = none
|
||||
#error log = syslog
|
||||
#debug log = syslog
|
||||
|
||||
[plugin:proc]
|
||||
# Disable IPVS check since iRedMail doesn't use ipvs by default
|
||||
/proc/net/ip_vs/stats = no
|
||||
|
||||
# inbound packets dropped
|
||||
/proc/net/dev = no
|
||||
@@ -0,0 +1,49 @@
|
||||
# netdata python.d.plugin configuration
|
||||
#
|
||||
# This file is in YaML format.
|
||||
# Generally the format is:
|
||||
#
|
||||
# name: value
|
||||
#
|
||||
|
||||
# Enable / disable the whole python.d.plugin (all its modules)
|
||||
enabled: yes
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Enable / Disable python.d.plugin modules
|
||||
#default_run: yes
|
||||
#
|
||||
# If "default_run" = "yes" the default for all modules is enabled (yes).
|
||||
# Setting any of these to "no" will disable it.
|
||||
#
|
||||
# If "default_run" = "no" the default for all modules is disabled (no).
|
||||
# Setting any of these to "yes" will enable it.
|
||||
|
||||
# Enable / Disable explicit garbage collection (full collection run). Default is enabled.
|
||||
gc_run: yes
|
||||
|
||||
# Garbage collection interval in seconds. Default is 300.
|
||||
gc_interval: 300
|
||||
|
||||
apache: no
|
||||
# apache_cache has been replaced by web_log
|
||||
apache_cache: no
|
||||
chrony: no
|
||||
energid: no
|
||||
# this is just an example
|
||||
example: no
|
||||
go_expvar: no
|
||||
# gunicorn_log has been replaced by web_log
|
||||
gunicorn_log: no
|
||||
logind: no
|
||||
# nginx_log has been replaced by web_log
|
||||
nginx_log: no
|
||||
nginx_plus: no
|
||||
exim: no
|
||||
|
||||
# Use go.d for better performance since netdata-1.19.0.
|
||||
web_log: no
|
||||
nginx: no
|
||||
phpfpm: no
|
||||
mysql: no
|
||||
bind: no
|
||||
@@ -0,0 +1,8 @@
|
||||
update_every: 5
|
||||
|
||||
local:
|
||||
username : "PH_LDAP_BINDDN" # The bind user with right to access monitor statistics
|
||||
password : "PH_LDAP_BINDPW" # The password for the binded user
|
||||
server : "localhost" # The listening address of the LDAP server
|
||||
port : 389 # The listening port of the LDAP server
|
||||
timeout : 1
|
||||
@@ -0,0 +1,5 @@
|
||||
socket:
|
||||
name : 'local'
|
||||
user : 'PH_NETDATA_DB_USER'
|
||||
password : 'PH_NETDATA_DB_PASSWD'
|
||||
database : 'postgres'
|
||||
@@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
LimitNOFILE=30000
|
||||
@@ -0,0 +1 @@
|
||||
map_hash_bucket_size 1024;
|
||||
@@ -0,0 +1,8 @@
|
||||
map $sent_http_content_type $expires {
|
||||
default off;
|
||||
application/x-javascript 1d;
|
||||
text/css 1d;
|
||||
~image/ 1d;
|
||||
}
|
||||
|
||||
expires $expires;
|
||||
@@ -0,0 +1 @@
|
||||
client_max_body_size 12m;
|
||||
@@ -0,0 +1 @@
|
||||
default_type application/octet-stream;
|
||||
@@ -0,0 +1,10 @@
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_http_version 1.0;
|
||||
gzip_comp_level 2;
|
||||
gzip_min_length 10240;
|
||||
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_types text/plain text/css text/xml text/javascript text/json application/json application/x-javascript application/xml application/xml+rss;
|
||||
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
@@ -0,0 +1,7 @@
|
||||
add_header X-Frame-Options sameorigin;
|
||||
add_header X-Content-Type-Options nosniff;
|
||||
add_header X-XSS-Protection '1; mode=block';
|
||||
add_header X-Download-Options noopen;
|
||||
add_header X-Permitted-Cross-Domain-Policies none;
|
||||
add_header Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'";
|
||||
add_header Referrer-Policy strict-origin;
|
||||
@@ -0,0 +1,2 @@
|
||||
access_log PH_NGINX_LOG_ACCESSLOG;
|
||||
error_log PH_NGINX_LOG_ERRORLOG;
|
||||
@@ -0,0 +1 @@
|
||||
include PH_NGINX_MIME_TYPES;
|
||||
@@ -0,0 +1,3 @@
|
||||
upstream php_workers {
|
||||
server PH_PHP_FPM_BIND_HOST:PH_PHP_FPM_PORT;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
sendfile on;
|
||||
@@ -0,0 +1,2 @@
|
||||
# Hide Nginx version number
|
||||
server_tokens off;
|
||||
@@ -0,0 +1 @@
|
||||
types_hash_max_size 2048;
|
||||
@@ -0,0 +1,12 @@
|
||||
user PH_HTTPD_USER;
|
||||
worker_processes 1;
|
||||
pid PH_NGINX_PID;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include PH_HTTPD_CONF_DIR_ENABLED_CONF/*.conf;
|
||||
include PH_HTTPD_CONF_DIR_ENABLED_SITES/*.conf;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Note: This file must be loaded before other virtual host config files,
|
||||
#
|
||||
# HTTPS
|
||||
server {
|
||||
listen PH_HTTPS_PORT ssl;
|
||||
#listen [::]:PH_HTTPS_PORT ssl;
|
||||
server_name _;
|
||||
|
||||
root PH_HTTPD_DOCUMENTROOT;
|
||||
index index.php index.html;
|
||||
|
||||
include PH_NGINX_CONF_TMPL_DIR/misc.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/ssl.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/iredadmin.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/roundcube.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/sogo.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/netdata.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/php-catchall.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/stub_status.tmpl;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Note: This file must be loaded before other virtual host config files,
|
||||
#
|
||||
# HTTP
|
||||
server {
|
||||
# Listen on ipv4
|
||||
listen PH_PORT_HTTP;
|
||||
#listen [::]:PH_PORT_HTTP;
|
||||
|
||||
server_name _;
|
||||
|
||||
# Redirect all insecure http:// requests to https://
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
# Sample setting for Adminer: http://adminer.org/
|
||||
|
||||
# -----------------------------------------
|
||||
# How to get it working:
|
||||
#
|
||||
# mkdir PH_HTTPD_SERVERROOT/adminer
|
||||
# cd PH_HTTPD_SERVERROOT/adminer
|
||||
# wget http://www.adminer.org/latest.php
|
||||
# chmod +x latest.php
|
||||
#
|
||||
# Warning: for security concern, it's recommended to change the URL '/adminer'
|
||||
# to another random string to avoid login attempts from bad guys.
|
||||
# for example, change the url to '^/HIoWCwogSHukIbGL'.
|
||||
#
|
||||
# -----------------------------------------
|
||||
# If you cannot login to MySQL server as root user:
|
||||
#
|
||||
# New MySQL or MariaDB support plugin authentication, by default, the root
|
||||
# account has setting `user.plugin=unix_socket` (in `mysql` database). The
|
||||
# `auth_socket` authentication plugin authenticates clients that connect from
|
||||
# the local host through the Unix socket file, this prevents access via network
|
||||
# connection, including Adminer. To make it working, please disable this
|
||||
# authentication plugin with sql commands below:
|
||||
#
|
||||
# sql> USE mysql;
|
||||
# sql> UPDATE user SET plugin='' WHERE User='root';
|
||||
#
|
||||
# Refer to MySQL document for more details:
|
||||
# https://dev.mysql.com/doc/refman/5.7/en/socket-authentication-plugin.html
|
||||
|
||||
location ~ ^/adminer$ {
|
||||
include PH_NGINX_CONF_TMPL_DIR/hsts.tmpl;
|
||||
include PH_NGINX_CONF_TMPL_DIR/fastcgi_php.tmpl;
|
||||
|
||||
fastcgi_param SCRIPT_FILENAME PH_HTTPD_SERVERROOT/adminer/latest.php;
|
||||
|
||||
# Access control
|
||||
#allow 127.0.0.1;
|
||||
#allow 192.168.1.10;
|
||||
#allow 192.168.1.0/24;
|
||||
#deny all;
|
||||
}
|
||||
|
||||
location ~ ^/adminer.css$ {
|
||||
alias PH_HTTPD_SERVERROOT/adminer/adminer.css;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#
|
||||
# Template used to handle PHP fastcgi applications
|
||||
#
|
||||
# You still need to define `SCRIPT_FILENAME` for your PHP application, and
|
||||
# probably `fastcgi_index` if your application use different index file.
|
||||
#
|
||||
include fastcgi_params;
|
||||
|
||||
# Directory index file
|
||||
fastcgi_index index.php;
|
||||
|
||||
# Handle PHP files with upstream handler
|
||||
fastcgi_pass php_workers;
|
||||
|
||||
# Fix the HTTPROXY issue.
|
||||
# Reference: https://httpoxy.org/
|
||||
fastcgi_param HTTP_PROXY '';
|
||||
@@ -0,0 +1,17 @@
|
||||
# Use HTTP Strict Transport Security to force client to use secure
|
||||
# connections only. References:
|
||||
#
|
||||
# * RFC Document (6797): HTTP Strict Transport Security (HSTS)
|
||||
# https://tools.ietf.org/html/rfc6797#section-6.1.2
|
||||
#
|
||||
# * Short tutorial from Mozilla:
|
||||
# https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security
|
||||
#
|
||||
# WARNING: According to RFC document, HSTS will fail with self-signed SSL
|
||||
# certificate.
|
||||
# https://tools.ietf.org/html/rfc6797#page-27
|
||||
#
|
||||
# Syntax:
|
||||
#
|
||||
# Strict-Transport-Security: max-age=expireTime [; includeSubDomains] [; preload]
|
||||
add_header Strict-Transport-Security "max-age=31536000";
|
||||
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# Run iRedAdmin as a sub-domain virtual host.
|
||||
#
|
||||
include PH_NGINX_CONF_TMPL_DIR/hsts.tmpl;
|
||||
|
||||
location / {
|
||||
root PH_IREDADMIN_HTTPD_ROOT_SYMBOL_LINK;
|
||||
uwsgi_pass PH_IREDADMIN_BIND_ADDRESS:PH_IREDADMIN_LISTEN_PORT;
|
||||
uwsgi_param UWSGI_CHDIR PH_IREDADMIN_HTTPD_ROOT_SYMBOL_LINK;
|
||||
uwsgi_param UWSGI_SCRIPT iredadmin;
|
||||
include uwsgi_params;
|
||||
}
|
||||
|
||||
location /static {
|
||||
alias PH_IREDADMIN_HTTPD_ROOT_SYMBOL_LINK/static;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
# Settings for iRedAdmin.
|
||||
|
||||
# static files under /iredadmin/static
|
||||
location ~ ^/iredadmin/static/(.*) {
|
||||
alias PH_IREDADMIN_HTTPD_ROOT_SYMBOL_LINK/static/$1;
|
||||
}
|
||||
|
||||
# Python scripts
|
||||
location ~ ^/iredadmin(.*) {
|
||||
rewrite ^/iredadmin(/.*)$ $1 break;
|
||||
|
||||
include PH_NGINX_CONF_TMPL_DIR/hsts.tmpl;
|
||||
|
||||
include uwsgi_params;
|
||||
uwsgi_pass PH_IREDADMIN_BIND_ADDRESS:PH_IREDADMIN_LISTEN_PORT;
|
||||
uwsgi_param UWSGI_CHDIR PH_IREDADMIN_HTTPD_ROOT_SYMBOL_LINK;
|
||||
uwsgi_param UWSGI_SCRIPT iredadmin;
|
||||
uwsgi_param SCRIPT_NAME /iredadmin;
|
||||
|
||||
# Access control
|
||||
#allow 127.0.0.1;
|
||||
#allow 192.168.1.10;
|
||||
#allow 192.168.1.0/24;
|
||||
#deny all;
|
||||
}
|
||||
|
||||
# iRedAdmin: redirect /iredadmin to /iredadmin/
|
||||
location = /iredadmin {
|
||||
rewrite ^ /iredadmin/;
|
||||
}
|
||||
|
||||
# Handle newsletter-style subscription/unsubscription supported in iRedAdmin-Pro.
|
||||
location ~ ^/newsletter/ {
|
||||
rewrite /newsletter/(.*) /iredadmin/newsletter/$1 last;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Allow access to '^/.well-known/'
|
||||
location ~ ^/.well-known/ {
|
||||
allow all;
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
autoindex off;
|
||||
#root /var/www/html;
|
||||
}
|
||||
|
||||
# Deny all attempts to access hidden files such as .htaccess.
|
||||
location ~ /\. { deny all; }
|
||||
|
||||
# Handling noisy messages
|
||||
location = /favicon.ico { access_log off; log_not_found off; }
|
||||
location = /robots.txt { access_log off; log_not_found off; }
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user