CREATE TABLE alias (
id int(11) unsigned NOT NULL auto_increment,
alias varchar(128) NOT NULL default '',
destination varchar(128) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
CREATE TABLE relocated (
id int(11) unsigned NOT NULL auto_increment,
email varchar(128) NOT NULL default '',
destination varchar(128) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
CREATE TABLE transport (
id int(11) unsigned NOT NULL auto_increment,
domain varchar(128) NOT NULL default '',
destination varchar(128) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY domain (domain)
) TYPE=MyISAM;
CREATE TABLE users (
id int(11) unsigned NOT NULL auto_increment,
email varchar(128) NOT NULL default '',
clear varchar(128) NOT NULL default '',
name tinytext NOT NULL,
uid int(11) unsigned NOT NULL default '1011',
gid int(11) unsigned NOT NULL default '1011',
homedir tinytext NOT NULL,
maildir tinytext NOT NULL,
quota tinytext NOT NULL,
postfix enum('Y','N') NOT NULL default 'Y',
PRIMARY KEY (id),
UNIQUE KEY email (email)
) TYPE=MyISAM;
CREATE TABLE virtual (
id int(11) unsigned NOT NULL auto_increment,
email varchar(128) NOT NULL default '',
destination varchar(128) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;
/etc/postfix目录下各mysql配置文件:
mysql-aliases.cf
user = mysql-postfix-user
password = mysql-postfix-pass
dbname = postfix
table = alias
select_field = destination
where_field = alias
hosts = 127.0.0.1
mysql> use postfix
mysql> insert into transport set domain='test.org', destination='virtual:';
mysql> insert into users set email='san@test.org',clear='test',name='',uid='65534',gid='65534',homedir='home/vmail',maildir='test.org/san/';
然后就可以使用客户端收发邮件,记得用户名是email地址。
二、防病毒系统
1、安装McAfee uvscan for linux
McAfee uvscan for linux虽然是试用,但是没有什么限制,可以升级,也没有过期。
# wget http://download.nai.com/products/evaluation/virusscan/english/cmdline/linux/version_4.24/intel/vlnx424e.tar.Z
# tar xzf vlnx424e.tar.Z
# ./install-uvscan
#!/bin/sh
#
# update-dat.sh
#
cd /usr/local/uvscan/
wget -q -O readme.txt http://download.nai.com/products/datfiles/4.x/nai/readme.txt >/dev/null
AVVER=`head -5 readme.txt | grep ' 4[0-9][0-9][0-9] ' | head -1 | sed -e 's/^.* (4[0-9]*) .*$/1/'`
if [ ! -f dat-$AVVER.tar ]; then
for i in *.tar ; do
mv $i $i.old
done
if wget http://download.nai.com/products/datfiles/4.x/nai/dat-$AVVER.tar >/dev/null ; then
for i in *.dat ; do
cp -p $i $i.bak
done
if tar xf dat-$AVVER.tar ; then
rm -f *.old
echo `date` Successfully updated AntiVirus DAT files to $AVVER
fi
fi
fi
@inet_acl = qw( 127/8 1.2.3.4/32 ); # 1.2.3.4 is your external ip .. because want maybe also accept mail from that interface, it's up to you.
$warnvirussender = 1; # I want to warn people, who have got virus.
$warnvirusrecip = 1; # I want to warn my users about virus send to them.
$warn_offsite = 1; # I want to warn senders/recipients, that are not located on my server
$mailfrom_notify_admin = 'virusalert@example.com'; #
$mailfrom_notify_recip = 'virusalert@example.com'; # Change these to the appropriate email-adresses, you wish to use as sender
$mailfrom_notify_spamadmin = 'spam.police@example.com'; # for spam and virus warnings
$hdrfrom_notify_sender = 'AMaViS (content filter) <postmaster@example.com>';
$virus_admin = 'virus-admin@example.com'; #
$spam_admin = 'spam-admin@example.com'; #
指定使用uvscan:
@av_scanners = (
['NAI McAfee AntiVirus (uvscan)', 'uvscan',
'--secure -rv --summary --noboot {}', [0], [13],
qr/(?x) Found (?:
the (.+) (?:virus|trojan) |
(?:virus|trojan) or variant ([^ ]+) |
: (.+) NOT a virus)/ ],
);
找到/etc/postfix/master.cf如下行:
smtp inet n - n - - smtpd
改为如下:
smtp inet n n n - - smtpd -o content_filter=smtp-amavis:[127.0.0.1]:10024
smtp-amavis unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o disable_dns_lookups=yes
127.0.0.1:10025 inet n - n - - smtpd
-o local_recipient_maps=
-o smtpd_restriction_classes=
-o smtpd_client_restrictions=
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o strict_rfc821_envelopes=yes
# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
# - chinese english
ok_languages zh en
# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales en zh
Jul 16 17:40:09 2003 (392) Uncaught runner exception: unknown encoding
Jul 16 17:40:10 2003 (392) Traceback (most recent call last):
File "/usr/local/mailman/Mailman/Queue/Runner.py", line 105, in _oneloop
self._onefile(msg, msgdata)
File "/usr/local/mailman/Mailman/Queue/Runner.py", line 155, in _onefile
keepqueued = self._dispose(mlist, msg, msgdata)
File "/usr/local/mailman/Mailman/Queue/IncomingRunner.py", line 130, in _dispose
more = self._dopipeline(mlist, msg, msgdata, pipeline)
File "/usr/local/mailman/Mailman/Queue/IncomingRunner.py", line 153, in _dopipeline
sys.modules[modname].process(mlist, msg, msgdata)
File "/usr/local/mailman/Mailman/Handlers/CookHeaders.py", line 75, in process
prefix_subject(mlist, msg, msgdata)
File "/usr/local/mailman/Mailman/Handlers/CookHeaders.py", line 262, in prefix_subject
h.append(s, c)
File "/usr/local/mailman/pythonlib/email/Header.py", line 285, in append
s = s.encode(outcodec, errors)
LookupError: unknown encoding