ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
7568846
帖子: 63
注册时间: 2008-10-09 10:04

ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#1

帖子 7568846 » 2009-02-18 9:56

ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail+clamav+Spamassassin+Amavisd-new+DCC+Pyzor邮件系统搭建
-------------------------------------------------

2009年02月16日 编写:阳光
注:在“ROOT”
http://www.howtoforge.com
wiki.ubuntu.org.cn
forum.ubuntu.org.cn
上面的网址,是学ubuntu最好的地方
-------------------------------------------------
首先我们来安装LAMP,可以在新立得软件管理器中找到,我们选择“编辑”,“使用任务分组标记软件包”,选择“LAMP SERVER”确定,应用。如果喜欢用命令的朋友,
apt-get install apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libaprutil1 libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0 mysql-common mysql-server php5-common php5-mysql
接下来我们来安装phpmyadmin这个也可心在源里面找到,安装的时候提示选择WEB,我们选apache2
sudo apt-get install phpmyadmin
我们把/etc/phpmyadmin/apache.conf复制到/etc/apache2/conf.d/文件夹下,这样我们只要在浏览器中输入localhost(换成你的IP域名都可以)/phpmyadmin就可以打开了。
/etc/init.d/apache2 restart
安装php5-mcrypt

apt-get install php5-mcrypt

编辑php配置文件

gedit /etc/php5/apache2/php.ini

在extension下面加上
extension=php5-mcrypt.so

配置apache
gedit /etc/apache2/apache2.conf
在配置文件最后面加入下面几行:
AddType application/x-httpd-php .php .htm .html
AddDefaultCharset UTF-8
ServerName 127.0.0.1
<IfModule dir_module>
DirectoryIndex index.htm index.html index.php
</IfModule>
重新启动apache2 和mysql
/etc/init.d/apache2 restart
/etc/init.d/mysql restart
至此 LAMP环境配置成功,试一下 echo phpinfo(); 吧!
接下来我们来安装zend optimizer.从官网下载它www.zend.org。解压(我放在/usr/src)
cd ZendOptimizer-3.3.3-linux-glibc23-i386
./install
它会让你填上php.ini的路径(/etc/php5/apache2/)
它会让你真上apahce2的路径(/usr/sbin/apache2)
安装完后,再到浏览器上试下看安装成功没有localhost/index.php

将/bin/sh连接到/bin/bash
ln -sf /bin/bash /bin/sh

删除apparmor
/etc/init.d/apparmor stop
update-rc.d -f apparmor remove
安装Postfix, Courier, Saslauthd, MySQL, phpMyAdmin
apt-get install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl phpmyadmin apache2 libapache2-mod-php5 php5 php5-mysql libpam-smbpass
你会被询问以下问题:
Create directories for web-based administration? <-- No
General type of mail configuration: <-- Internet Site
System mail name: <-- server1.example.com
SSL certificate required <-- Ok
Web server to reconfigure automatically: <-- apache2

接下来给postfix 打上补丁了
apt-get install build-essential dpkg-dev fakeroot debhelper libgdbm-dev libldap2-dev libpcre3-dev libssl-dev libsasl2-dev postgresql-server-dev-8.2 po-debconf dpatch libmysqlclient15-dev lsb-release libcdb-dev libdb-dev
cd /usr/src
apt-get source postfix
检查你的postfix版本
postconf -d | grep mail_version
显示的信息如下
root@server1:/usr/src# postconf -d | grep mail_version
mail_version = 2.5.1
milter_macro_v = $mail_name $mail_version
root@server1:/usr/src#
现在执行下面的命令
wget http://vda.sourceforge.net/VDA/postfix- ... g.patch.gz
gunzip postfix-2.5.1-vda-ng.patch.gz
cd postfix-2.5.1
patch -p1 < ../postfix-2.5.1-vda-ng.patch
dpkg-buildpackage
然后
cd ..
ls -l
你会看到下面的这些信息
root@server1:/usr/src# ls -l
total 5804
drwxr-sr-x 19 root src 4096 2008-05-15 00:36 postfix-2.5.1
-rw-r--r-- 1 root src 235739 2008-05-15 00:35 postfix_2.5.1-2ubuntu1.diff.gz
-rw-r--r-- 1 root src 787 2008-05-15 00:35 postfix_2.5.1-2ubuntu1.dsc
-rw-r--r-- 1 root src 2236 2008-05-15 00:37 postfix_2.5.1-2ubuntu1_i386.changes
-rw-r--r-- 1 root src 1165838 2008-05-15 00:37 postfix_2.5.1-2ubuntu2_i386.deb
-rw-r--r-- 1 root src 3153629 2008-02-26 03:04 postfix_2.5.1.orig.tar.gz
-rw-r--r-- 1 root src 57952 2008-03-24 01:51 postfix-2.5.1-vda-ng.patch
-rw-r--r-- 1 root src 39796 2008-05-15 00:37 postfix-cdb_2.5.1-2ubuntu1_i386.deb
-rw-r--r-- 1 root src 139888 2008-05-15 00:37 postfix-dev_2.5.1-2ubuntu1_all.deb
-rw-r--r-- 1 root src 916386 2008-05-15 00:37 postfix-doc_2.5.1-2ubuntu1_all.deb
-rw-r--r-- 1 root src 46694 2008-05-15 00:37 postfix-ldap_2.5.1-2ubuntu1_i386.deb
-rw-r--r-- 1 root src 41730 2008-05-15 00:37 postfix-mysql_2.5.1-2ubuntu2_i386.deb
-rw-r--r-- 1 root src 41530 2008-05-15 00:37 postfix-pcre_2.5.1-2ubuntu1_i386.deb
-rw-r--r-- 1 root src 41796 2008-05-15 00:37 postfix-pgsql_2.5.1-2ubuntu1_i386.deb
root@server1:/usr/src#
如上面显示的一样,确定没有生成这些deb包也没有多在关系统,我们可以登录上mirror.lupaworld.com/ubuntu/pool/main/p/postfix,在里面找到postfix_2.5.1-2ubuntu2_i386.deb和postfix-mysql_2.5.1-2ubuntu2_i386.deb

dpkg -i postfix_2.5.1-2ubuntu1.2_i386.deb
dpkg -i postfix-mysql_2.5.1-2ubuntu1.2_i386.deb
接下来为postfix和courier创建数据库,如果你想图个简便,可心把我下面写的考备到一个数据库文件中再将它导入
gedit postfixadmin-mysql.sql //创建数据库文件
mysql -u root -p < postfixadmin-mysql.sql //导入数据库文件
下面是psotfixadmin-mysql.sql中的内容(注意下面建的用户名和密码,改成你自己惯用的)
#------------------------------------Start copy-------------------------------------
#
# Postfix Admin
# by Mischa Peters <mischa at high5 dot net>
# Copyright (c) 2002 - 2005 High5!
# License Info: http://www.postfixadmin.com/?file=LICENSE.TXT
#

# This is the complete MySQL database structure for Postfix Admin.
# If you are installing from scratch you can use this file otherwise you
# need to use the TABLE_CHANGES.TXT or TABLE_BACKUP_MX.TXT that comes with Postfix Admin.
#
# There are 2 entries for a database user in the file.
# One you can use for Postfix and one for Postfix Admin.
#
# If you run this file twice (2x) you will get an error on the user creation in MySQL.
# To go around this you can either comment the lines below "USE MySQL" until "USE postfix".
# Or you can remove the users from the database and run it again.
#
# You can create the database from the shell with:
#
# mysql -u root [-p] < DATABASE_MYSQL.TXT

#
# Postfix / MySQL
#
CREATE DATABASE postfix;

GRANT SELECT, INSERT, DELETE, UPDATE ON postfix.* TO postfix@localhost IDENTIFIED BY 'postfix';

USE postfix;
#
# Table structure for table admin
#
CREATE TABLE admin (
username varchar(255) NOT NULL default '',
password varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (username),
KEY username (username)
) COMMENT='Postfix Admin - Virtual Admins';

#
# Table structure for table alias
#
CREATE TABLE alias (
address varchar(255) NOT NULL default '',
goto text NOT NULL,
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (address),
KEY address (address)
) COMMENT='Postfix Admin - Virtual Aliases';

#
# Table structure for table domain
#
CREATE TABLE domain (
domain varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
aliases int(10) NOT NULL default '0',
mailboxes int(10) NOT NULL default '0',
maxquota int(10) NOT NULL default '0',
transport varchar(255) default NULL,
backupmx tinyint(1) NOT NULL default '0',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (domain),
KEY domain (domain)
) COMMENT='Postfix Admin - Virtual Domains';

#
# Table structure for table domain_admins
#
CREATE TABLE domain_admins (
username varchar(255) NOT NULL default '',
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
KEY username (username)
) COMMENT='Postfix Admin - Domain Admins';

#
# Table structure for table log
#
CREATE TABLE log (
timestamp datetime NOT NULL default '0000-00-00 00:00:00',
username varchar(255) NOT NULL default '',
domain varchar(255) NOT NULL default '',
action varchar(255) NOT NULL default '',
data varchar(255) NOT NULL default '',
KEY timestamp (timestamp)
) COMMENT='Postfix Admin - Log';

#
# Table structure for table mailbox
#
CREATE TABLE mailbox (
username varchar(255) NOT NULL default '',
password varchar(255) NOT NULL default '',
name varchar(255) NOT NULL default '',
maildir varchar(255) NOT NULL default '',
quota int(10) NOT NULL default '0',
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (username),
KEY username (username)
) COMMENT='Postfix Admin - Virtual Mailboxes';

#
# Table structure for table vacation
#
CREATE TABLE vacation (
email varchar(255) NOT NULL default '',
subject varchar(255) NOT NULL default '',
body text NOT NULL,
cache text NOT NULL,
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (email),
KEY email (email)
) COMMENT='Postfix Admin - Virtual Vacation';
#------------------------------------End copy-------------------------------------

这样我们创建了数据库为postfix,管理员用户名为postfix,密码为postfix,另外还有七张表

如果你想深入一点了解数据库
mysql -u root -p
mysql> CREATE DATABASE postfix; //创建postfix数据库
mysql> USE postfix; //进入postfix数据库
mysql> GRANT SELECT, INSERT, DELETE, UPDATE ON postfix.* TO postfix@localhost IDENTIFIED BY 'postfi'; //创建postfix管理员
接下来是为这个数据库建立表了
创建表管理
CREATE TABLE admin (
username varchar(255) NOT NULL default '',
password varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (username),
KEY username (username)
) COMMENT='Postfix Admin - Virtual Admins';
创建别名表
CREATE TABLE alias (
address varchar(255) NOT NULL default '',
goto text NOT NULL,
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (address),
KEY address (address)
) COMMENT='Postfix Admin - Virtual Aliases';
创建域表
CREATE TABLE domain (
domain varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
aliases int(10) NOT NULL default '0',
mailboxes int(10) NOT NULL default '0',
maxquota int(10) NOT NULL default '0',
transport varchar(255) default NULL,
backupmx tinyint(1) NOT NULL default '0',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (domain),
KEY domain (domain)
) COMMENT='Postfix Admin - Virtual Domains';

创建域管理表
CREATE TABLE domain_admins (
username varchar(255) NOT NULL default '',
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
KEY username (username)
) COMMENT='Postfix Admin - Domain Admins';
创建邮箱表
CREATE TABLE mailbox (
username varchar(255) NOT NULL default '',
password varchar(255) NOT NULL default '',
name varchar(255) NOT NULL default '',
maildir varchar(255) NOT NULL default '',
quota int(10) NOT NULL default '0',
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
modified datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (username),
KEY username (username)
) COMMENT='Postfix Admin - Virtual Mailboxes';
创建日志表
CREATE TABLE log (
timestamp datetime NOT NULL default '0000-00-00 00:00:00',
username varchar(255) NOT NULL default '',
domain varchar(255) NOT NULL default '',
action varchar(255) NOT NULL default '',
data varchar(255) NOT NULL default '',
KEY timestamp (timestamp)
) COMMENT='Postfix Admin - Log';
创建自动回复表
CREATE TABLE vacation (
email varchar(255) NOT NULL default '',
subject varchar(255) NOT NULL default '',
body text NOT NULL,
cache text NOT NULL,
domain varchar(255) NOT NULL default '',
created datetime NOT NULL default '0000-00-00 00:00:00',
active tinyint(1) NOT NULL default '1',
PRIMARY KEY (email),
KEY email (email)
) COMMENT='Postfix Admin - Virtual Vacation';
我们在登录localhost/phpmyadmin,在里面把刚刚建立的postfix用户的权限改为对postfix数据库的所有权限

设置Postfix MySQL映射
创建虚拟别名映射
右手边是select_field。在这个文件中会在 address 列和 goto 列产生映射。
editor /etc/postfix/mysql_virtual_alias_maps.cf
在/etc/postfix/mysql_virtual_alias_maps.cf文件中添加下列代码。
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = alias
select_field = goto
where_field = address
虚拟域映射
Posfix 仅仅使用这张表中的domain。对于这些域,我们不需要映射LHS 和 RHS
editor /etc/postfix/mysql_virtual_domains_maps.cf
将下面的代码加入上面的文件。
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = domain
select_field = domain
where_field = domain
#additional_conditions = and backupmx = '0' and active = '1'
虚拟邮箱映射
Postfix将在username 列和maildir查询邮箱表之间建立映射。
editor /etc/postfix/mysql_virtual_mailbox_maps.cf
将下列代码加入上述文件中。
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = mailbox
select_field = maildir
where_field = username
#additional_conditions = and active = '1'
虚拟邮箱引用映射
Postfix利用此映射为虚拟邮箱控制引用。在 mailbox表中Username 列和 quota列建立映射。
editor /etc/postfix/mysql_virtual_mailbox_limit_maps.cf
将下列代码加入上述文件中。
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1'
转发域映射
如果您使用您的邮件系统仅仅为了主机对一些虚拟域备份MX,那么您需要这个映射来告知Postfix为这些域转发信件。
editor /etc/postfix/mysql_relay_domains_maps.cf
将下列代码加入上述文件中。
user = postfix
password = postfix
hosts = 127.0.0.1
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and backupmx = '1'

执行下列命令,改变这些文件按属于postfix组。保证文件的安全性。
chgrp postfix /etc/postfix/mysql_*.cf
使得文件对组用户可读。
chmod 640 /etc/postfix/mysql_*.cf
创建虚拟邮件用户

我们的系统可以为数千用户提供邮箱。这些用户全部都是虚拟用户(相对于Linux系统用户而言)。所以这些用户不能在我们的系统硬盘上存放他们的信件。您或许不打算为每一个用户都分配一个惟一的系统UID (user ID)。因此我们创建一个Linux用户,它是所有邮箱的拥有者。
groupadd -g 5000 vmail
useradd -m -g vmail -u 5000 -d /home/vmail -s /bin/bash vmail

配置Postfix和MySQL映射
我们已将创建了MySQL映射配置文件。现在我们配置Postfix main.cf 文件以便Postfix能从MySQL数据库中查询虚拟邮箱和虚拟域。打开main.cf
editor /etc/postfix/main.cf
看起来因该是这样的
# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = epfhk
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = epfhk.com, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_fetchmail_maps = mysql:/etc/postfix/mysql_virtual_fetchmail_maps.cf
virtual_mailbox_limit = 51200000
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
把上面的都复制到你的main.cf文件中

好了现在我们来做SMTP身份认证了
cd /etc/postfix
openssl req -new -outform PEM -out smtpd.cert -newkey rsa:2048 -nodes -keyout smtpd.key -keyform PEM -days 365 -x509
它们询问你问题
Country Name (2 letter code) [AU]: //国家
State or Province Name (full name) [Some-State]: //省
Locality Name (eg, city) []: //城市
Organization Name (eg, company) [Internet Widgits Pty Ltd]: //组织名称
Organizational Unit Name (eg, section) []: 组织单位名称
Common Name (eg, YOUR name) []: 通用名称
Email Address []: 邮件地址
更改smtpd.key权限
chmod o= /etc/postfix/smtpd.key
配置Saslauthd
mkdir -p /var/spool/postfix/var/run/saslauthd
gedit /etc/default/saslauthd
和下面的一样就行
#
# Settings for saslauthd daemon
# Please read /usr/share/doc/sasl2-bin/README.Debian for details.
#

# Should saslauthd run automatically on startup? (default: no)
START=yes

# Description of this saslauthd instance. Recommended.
# (suggestion: SASL Authentication Daemon)
DESC="SASL Authentication Daemon"

# Short name of this saslauthd instance. Strongly recommended.
# (suggestion: saslauthd)
NAME="saslauthd"

# Which authentication mechanisms should saslauthd use? (default: pam)
#
# Available options in this Debian package:
# getpwent -- use the getpwent() library function
# kerberos5 -- use Kerberos 5
# pam -- use PAM
# rimap -- use a remote IMAP server
# shadow -- use the local shadow password file
# sasldb -- use the local sasldb database file
# ldap -- use LDAP (configuration is in /etc/saslauthd.conf)
#
# Only one option may be used at a time. See the saslauthd man page
# for more information.
#
# Example: MECHANISMS="pam"
MECHANISMS="pam"

# Additional options for this mechanism. (default: none)
# See the saslauthd man page for information about mech-specific options.
MECH_OPTIONS=""

# How many saslauthd processes should we run? (default: 5)
# A value of 0 will fork a new process for each connection.
THREADS=5

# Other options (default: -c -m /var/run/saslauthd)
# Note: You MUST specify the -m option or saslauthd won't run!
#
# See /usr/share/doc/sasl2-bin/README.Debian for Debian-specific information.
# See the saslauthd man page for general information about these options.
#
# Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd"
#OPTIONS="-c -m /var/run/saslauthd"
OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"

配置/etc/pam.d/smtp

auth required pam_mysql.so user=postfix passwd=postfix host=127.0.0.1 db=postfix table=mailbox usercolumn=username passwdcolumn=password crypt=1
account sufficient pam_mysql.so user=postfix passwd=postfix host=127.0.0.1 db=postfix table=mailbox usercolumn=username passwdcolumn=password crypt=1

配置/etc/postfix/sasl/smtpd.conf

pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: postfix
sql_passwd: postfix
sql_database: postfix
sql_select: select password from mailbox where username = '%u'

添加用户
adduser postfix sasl
重启
/etc/init.d/postfix restart
/etc/init.d/saslauthd restart
注,8.04版本会提示打不到/etc/mailname文件,你可以在/etc下建一个mailname文件,打开文件,在里面填上本地计算机名,或域名,文件属性读写

配置Courier
gedit /etc/courier/authdaemonrc
将authmodulelist="authpam"改为authmodulelist="authmysql"

cp /etc/courier/authmysqlrc /etc/courier/authmysqlrc_orig
cat /dev/null > /etc/courier/authmysqlrc
把下面的所有内容考到authmysqlrc
MYSQL_SERVER 127.0.0.1
MYSQL_USERNAME postfix
MYSQL_PASSWORD postfix
MYSQL_DATABASE postfix
MYSQL_USER_TABLE mailbox
MYSQL_LOGIN_FIELD username
MYSQL_NAME_FIELD name
MYSQL_CRYPT_PWFIELD password
#MYSQL_CLEAR_PWFIELD password
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD concat(quota,'S')
MYSQL_HOME_FIELD '/home/vmail'
MYSQL_UID_FIELD '5000'
MYSQL_GID_FIELD '5000'

重新启动
/etc/init.d/courier-authdaemon restart
/etc/init.d/courier-imap restart
/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop restart
/etc/init.d/courier-pop-ssl restart


做好上面的之后,我们下载postfixadmin http://postfixadmin.sourceforge.net/安装
apt-get install php5-imap
用文本编辑打开/usr/share/postfixadmin/config.inc.php
$CONF['configured'] = true;
$CONF['default_language'] = 'cn';
$CONF['database_type'] = 'mysql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'postfix';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';
建立一个重定向
ln -s /usr/share/postfixadmin/ /var/www/postfixadmin
在浏览器中输入localhost/postfixadmin/setup.php
看看检测是否有问题,经过我上面的步骤因该是没有问题的,如果有问题,请对我的步骤仔细检察
在里面创建一个超级管理员,创建后,删除/usr/sahre/postfixadmin/下的setup.php文件
再在浏览器中输入localhost/postfixadmin 用刚刚建的账号登录,接下来自己操作了



在这里才做一半呢,还要杀毒,反垃极,squirrelmail,openwebmail

好了我们来慢慢做
安装amavisd-new, SpamAssassin, And ClamAV

apt-get install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 unzoo libnet-ph-perl libnet-snpp-perl libnet-telnet-perl nomarch lzop pax

修改/etc/amavis/conf.d/15-content_filter_mode
gedit /etc/amavis/conf.d/15-content_filter_mode
里面的容应该是这样
use strict;

# You can modify this file to re-enable SPAM checking through spamassassin
# and to re-enable antivirus checking.

#
# Default antivirus checking mode
# Uncomment the two lines below to enable it back
#

@bypass_virus_checks_maps = (
\%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re);


#
# Default SPAM checking mode
# Uncomment the two lines below to enable it back
#

@bypass_spam_checks_maps = (
\%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re);

1; # ensure a defined return

修改/etc/amavis/conf.d/20-debian_defaults
gedit /etc/amavis/conf.d/20-debian_defaults
我们来修改他里面的一些参数,我安装后没有修改
[...]
$QUARANTINEDIR = "$MYHOME/virusmails";
$quarantine_subdir_levels = 1; # enable quarantine dir hashing

$log_recip_templ = undef; # disable by-recipient level-0 log entries
$DO_SYSLOG = 1; # log via syslogd (preferred)
$syslog_ident = 'amavis'; # syslog ident tag, prepended to all messages
$syslog_facility = 'mail';
$syslog_priority = 'debug'; # switch to info to drop debug output, etc

$enable_db = 1; # enable use of BerkeleyDB/libdb (SNMP and nanny)
$enable_global_cache = 1; # enable use of libdb-based cache if $enable_db=1

$inet_socket_port = 10024; # default listening socket

$sa_spam_subject_tag = '***SPAM*** ';
$sa_tag_level_deflt = 2.0; # add spam info headers if at, or above that level
$sa_tag2_level_deflt = 6.31; # add 'spam detected' headers at that level
$sa_kill_level_deflt = 6.31; # triggers spam evasive actions
$sa_dsn_cutoff_level = 10; # spam level beyond which a DSN is not sent

$sa_mail_body_size_limit = 200*1024; # don't waste time on SA if mail is larger
$sa_local_tests_only = 0; # only tests which do not require internet access?

[...]
$final_virus_destiny = D_DISCARD; # (data not lost, see virus
quarantine)
$final_banned_destiny = D_BOUNCE; # D_REJECT when front-end MTA
$final_spam_destiny = D_BOUNCE;
$final_bad_header_destiny = D_PASS; # False-positive prone (for spam)
[...]

修改/etc/amavis/conf.d/50-user
gedit /etc/amavis/conf.d/50-user
里面的内容应该是这样的
use strict;

#
# Place your configuration directives here. They will override those in
# earlier files.
#
# See /usr/share/doc/amavisd-new/ for documentation and examples of
# the directives you can use in this file
#

$pax='pax';

#------------ Do not modify anything below this line -------------
1; # ensure a defined return

上面做完以后我们在添加用户组并重新启动
adduser clamav amavis
/etc/init.d/amavis restart
/etc/init.d/clamav-daemon restart
/etc/init.d/clamav-freshclam restart
注:有的时候amavis启动会报错,myhostname ,解决办法是找到/etc/amavis/conf.d/05-node_id有文本打开他把,还要在/etc下建一个mailname文件,把自己的主机名写上去
#$myhostname = "myhostname";改成你自己的域名就行了还要把前面的“#”去掉


现在我们设定postfix传入电子邮件时要用到amavisd-new
postconf -e 'content_filter = amavis:[127.0.0.1]:10024'
postconf -e 'receive_override_options = no_address_mappings'
编辑/etc/postfix/master.cf在最后面把下面的内容添加
gedit /etc/postfix/master.cf



amavis unix - - - - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes

127.0.0.1:10025 inet n - - - - smtpd
-o content_filter=
-o local_recipient_maps=
-o relay_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 mynetworks=127.0.0.0/8
-o strict_rfc821_envelopes=yes
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_bind_address=127.0.0.1

有些朋友,在master文件里加上面的代码后,SMTP就用不了,现在我把我的MASTER文件传上来

重启
/etc/init.d/postfix restart

我们执行命令 netstat -tap 会看到下面内容,说明我们的amavis己经做成功了
root@server1:/etc/postfix# netstat -tap
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 localhost:10024 *:* LISTEN 4687/amavisd (maste
tcp 0 0 localhost:10025 *:* LISTEN 8779/master
tcp 0 0 localhost:mysql *:* LISTEN 4764/mysqld
tcp 0 0 *:www *:* LISTEN 5838/apache2
tcp 0 0 localhost:ipp *:* LISTEN 5316/cupsd
tcp 0 0 *:smtp *:* LISTEN 8779/master
tcp 1 0 long.local:38641 bi-in-f165.google.c:www CLOSE_WAIT 6232/firefox
tcp 0 0 long.local:37698 122.224.198.34:www ESTABLISHED 8656/http
tcp6 0 0 [::]:imaps [::]:* LISTEN 5251/couriertcpd
tcp6 0 0 [::]:pop3s [::]:* LISTEN 5291/couriertcpd
tcp6 0 0 [::]:pop3 [::]:* LISTEN 5268/couriertcpd
tcp6 0 0 [::]:imap2 [::]:* LISTEN 5226/couriertcpd
root@server1:/etc/postfix#

https://wiki.ubuntu.org.cn/UbuntuHelp:PostfixAmavisNew
接下来我们来安装Razor, Pyzor,DCC并配置SpamAssassin
安装
apt-get install razor pyzor
因为DCC不在我们软件库中我们要执行下面的操作
cd /tmp
wget http://launchpadlibrarian.net/11564361/ ... 5_i386.deb
wget http://launchpadlibrarian.net/11564359/ ... 5_i386.deb
dpkg -i dcc-common_1.3.42-5_i386.deb
dpkg -i dcc-server_1.3.42-5_i386.deb

现在我们来编辑SpamAssassin,用文本打开
gedit /etc/spamassassin/local.cf把下列的代码写在最后面
#dcc
use_dcc 1
dcc_path /usr/bin/dccproc

#pyzor
use_pyzor 1
pyzor_path /usr/bin/pyzor

#razor
use_razor2 1
razor_config /etc/razor/razor-agent.conf

#bayes
use_bayes 1
use_bayes_rules 1
bayes_auto_learn 1

我们再来编辑/etc/spamassassin/v310.pre
# DCC - perform DCC message checks.
#
# DCC is disabled here because it is not open source. See the DCC
# license for more details.
#
loadplugin Mail::SpamAssassin::Plugin::DCC
注:主要是把loadplugin前面的“#”去掉
然后执行
spamassassin --lint
重启amavis
/etc/init.d/amavis restart
再更新我们的SpamAssassin
sa-update --no-gpg
为了让它以后能够自动更新,我们要做这样两步
执行下面的建一个脚本
crontab -e
把下面的代码复制
23 4 */2 * * /usr/bin/sa-update --no-gpg &> /dev/null
按ctrl+o 来保存,按ctrl+x来退出


现在我们来配置超出配额的通知

cd /usr/local/sbin/
wget http://puuhis.net/vhcs/quota.txt
mv quota.txt quota_notify
chmod 755 quota_notify
gedit /usr/local/sbin/quota_notify
按下面的代码做相应的修改,主要是最后两个要加上“%”号
[...]
my $POSTFIX_CF = "/etc/postfix/main.cf";
my $MAILPROG = "/usr/sbin/sendmail -t";
my $WARNPERCENT = 80;
my @POSTMASTERS = ('postmaster@yourdomain.tld');
my $CONAME = 'My Company';
my $COADDR = 'postmaster@yourdomain.tld';
my $SUADDR = 'postmaster@yourdomain.tld';
my $MAIL_REPORT = 1;
my $MAIL_WARNING = 1;
[...]
print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n";
[...]
print "Your mailbox: $luser is $lusers{$luser}% full.\n\n";
[...]

我们来建一个脚本
crontab -e
把下面的代码粘贴
0 0 * * * /usr/local/sbin/quota_notify &> /dev/null
做完上面的所有项后,我们来发一个测试邮件,看看amavis有没有起到做用,发邮件之后,到/home/vmail/对应你接收的用户目录,打开那个“new”文件夹,你会看到,你刚刚发的邮件,用文本打开它。


接下来是安装squirrelmail(基于WEB的)
安装这两个软件比上面的要简单多了,ubuntu技术文章上都有,下面我们也来说说要怎样安装
apt-get install squirrelmail php-pear squirrelmail-locales
接下来我们把squirrelmail下面的apache2.conf文件考到apache2下,重新启动apache2
cp /etc/squirrelmail/apache.conf /etc/apache2/conf.d/squirrelmail.conf
/etc/init.d/apache2 restart
安装DB库
pear install DB
接着来配置squirrelmail
squirrelmail-configure 或
/usr/sbin/squirrelmail-configure
我们选择“D”填入“courier”,再按回车
我们选择“8”安装你所須要的插件,按“R”键返回
我们选择“10”配置你所要的语言选择“1”写入“zh_CN”选择“2”写入“GB2312”
其它的接你的须求配置
接“S”保存接“Q”退出
注:有个时候语言选择了,但是还是汉化不了,一会儿中文一会儿英文的,我们这样做

cd /var/lib/locales/supported.d/
gedit local
把下面的粘贴
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
zh_TW.UTF-8 UTF-8
zh_CN GB2312
zh_CN.GB18030 GB18030
zh_CN.GBK GBK
运行下面的
dpkg-reconfigure locales


如果您要修改SquirrelMail 附件的大小,需要直接修改 /etc/php5/apache2/php.ini 文件:

memory_limit = 40M ; //改为40M (这样才能发10M的附件)
post_max_size = 10M ; //php可接受的 post 方法大小 10M
upload_max_filesize = 10M ; //最大上载文件10M


如果使用Postfix 作为后台邮件服务器,还需要修改main.cf
message_size_limit = 14336000 (附件大小,14M,实际为10M的文件)
virtual_mailbox_limit = 102400000 (邮箱空间100M)
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes

最后/etc/postfix/main.cf文件里的内容是这样子的


# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = /usr/share/doc/postfix

# TLS parameters
smtpd_tls_cert_file = /etc/postfix/smtpd.cert
smtpd_tls_key_file = /etc/postfix/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = epfhk
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = epfhk.com, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8
message_size_limit = 143360000
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
html_directory = /usr/share/doc/postfix/html
virtual_alias_domains =
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_authenticated_header = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_limit = 512000000
virtual_minimum_uid = 5000
virtual_uid_maps = static:5000
virtual_gid_maps = static:5000
virtual_mailbox_base = /home/vmail
virtual_transport = virtual
virtual_create_maildirsize = yes
virtual_maildir_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the your maildir has overdrawn your diskspace quota, please free up some of spaces of your mailbox try again.
virtual_overquota_bounce = yes
proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
content_filter = amavis:[127.0.0.1]:10024
receive_override_options = no_address_mappings

最后你可以用各种邮件客户端来测试,ssl加密测试,

教程己经写完了,搞了几天终于是搞完了,还有什么不好的地方,希望坛里的各位朋友一起帮忙
附件
postfix.tar.bz2
(1.55 MiB) 已下载 178 次
master.rar
(1.53 KiB) 已下载 200 次
上次由 7568846 在 2009-06-10 8:42,总共编辑 17 次。
头像
percy
帖子: 508
注册时间: 2006-09-10 8:19
系统: Gentoo/Mac OS X
来自: Shanghai,China
联系:

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#2

帖子 percy » 2009-02-18 20:49

很好很强大,写了这么多,真有耐心。
7568846
帖子: 63
注册时间: 2008-10-09 10:04

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#3

帖子 7568846 » 2009-02-18 21:59

望朋友门给点意见
单身浪子
帖子: 3
注册时间: 2009-02-25 18:27

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#4

帖子 单身浪子 » 2009-02-25 18:54

我跟你的文章实践了以下,发现无法打开webmail ,提示:ERROR: Connection dropped by IMAP server.

日志提示:
imapd: Connection, ip=[::ffff:127.0.0.1]
Feb 25 18:37:06 ubuntu-jim imapd: chdir test@xxx.com/: No such file or directory

authtest 提示:
authtest -s login test@xxx.com test
Authentication succeeded.

Authenticated: test@xxx.com (uid 5000, gid 5000)
Home Directory: /home/vmail
Maildir: test@xxx.com/
Quota: 0S
Encrypted Password: $1$fa9f1a42$NJUQ3rs81rWnIP.A/05iX/
Cleartext Password: test
Options: (none)

/home/vmail 中没有任何文件夹或者文件
上次由 单身浪子 在 2009-02-25 19:06,总共编辑 1 次。
单身浪子
帖子: 3
注册时间: 2009-02-25 18:27

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#5

帖子 单身浪子 » 2009-02-25 18:54

应该是maildir的问题,还请高人提点!
7568846
帖子: 63
注册时间: 2008-10-09 10:04

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#6

帖子 7568846 » 2009-02-26 12:53

楼上的这位朋友,是不是安上面的做的,有些MYSQL认证文件件,要改数据库的账号,密码,我记得我做的是你只要在postfixadmin里面建了虚拟用户,/home/vamil里面就会有对应的文件

我安这篇文章做的5面,都没有出现上面的问题,你要确保,你建的像什么,连接数据库文件的账号密码,SMTP,MYSQL文件,还有courier MYSQL认证
单身浪子
帖子: 3
注册时间: 2009-02-25 18:27

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#7

帖子 单身浪子 » 2009-02-26 13:06

authtest 提示:
authtest -s login test@xxx.com test
Authentication succeeded.

Authenticated: test@xxx.com (uid 5000, gid 5000)
Home Directory: /home/vmail
Maildir: test@xxx.com/
Quota: 0S
Encrypted Password: $1$fa9f1a42$NJUQ3rs81rWnIP.A/05iX/
Cleartext Password: test
Options: (none)



Maildir: test@xxx.com
这行是有问题的!应该显示/home/vmail/xxx.com/test@xxx.com

我在postfixadmin内创建了虚拟域,也创建了虚拟用户,但无法关联创建目录
7568846
帖子: 63
注册时间: 2008-10-09 10:04

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#8

帖子 7568846 » 2009-02-26 13:13

这是你的认证没有做好 smtp和courier 你这样,你用phpmyadmin 在里面建一个库,库名为“postfix”user:postfix password:postfix 权限是对postfix这个库有所有的权限,再按我上面的来做,系统装好后不要升级


我们加QQ来聊聊

537589532
头像
Jarson
帖子: 2371
注册时间: 2008-07-21 9:44
来自: 深圳
联系:

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#9

帖子 Jarson » 2009-02-26 13:26

收藏先,有空实践下 :em05
头像
hunteru
帖子: 12
注册时间: 2008-12-22 22:42

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#10

帖子 hunteru » 2009-02-27 16:25

感谢楼主的文章。
不过被你的一个错误给害惨了...花了我1天时间才发现。
按照你的配置好,pop3没问题,但是smtp死活过不去。
后来找来找去才找到问题所在:
配置/etc/pam.d/smtp

auth required pam_mysql.so user=postfix passwd=postfix host=127.0.0.1 db=postfix table=admin usercolumn=username passwdcolumn=password crypt=1
account sufficient pam_mysql.so user=postfix passwd=postfix host=127.0.0.1 db=postfix table=admin usercolumn=username passwdcolumn=password crypt=1
这两句里的 table,都应该设为mailbox而不是admin,否则虚拟用户一个也认证不了 :em04
7568846
帖子: 63
注册时间: 2008-10-09 10:04

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#11

帖子 7568846 » 2009-02-27 22:36

谢谢楼上的

我己修改
头像
larryli
帖子: 66
注册时间: 2006-03-10 11:10
来自: 广东 深圳
联系:

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#12

帖子 larryli » 2009-03-30 12:19

:em01 感谢楼主的研究和详细文档,已经在服务器上部署好了。

想问一下 postfix 补丁的问题。
手工打补丁后,是否能使用 apt-get upgrade 升级 postfix。
另外,我使用 mirror.lupaworld.com 就不需要手工 patch,也可以自动 upgrade 么?

我把 squirrermail 换成 roundcube-webmail 了,然后加上 iredmail.org 修改密码的补丁。
yangchusky
帖子: 24
注册时间: 2008-12-30 12:57
来自: 广东广州
联系:

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#13

帖子 yangchusky » 2009-03-31 18:22

弱弱地问下..我是在8.10下安装滴..没有打postfix的补丁..smtp可以发送.用pop 和imap死活登录不了..
用的是md5的加密格式.
是不是没有打补丁的关系??
做最好的手机维修论坛
http://www.gsm120.com
lordroc
帖子: 9
注册时间: 2009-03-27 10:12

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#14

帖子 lordroc » 2009-04-03 10:22

Apr 2 18:44:06 roc-desktop imapd: Connection, ip=[::ffff:127.0.0.1]
Apr 2 18:44:06 roc-desktop imapd: LOGIN FAILED, user=james, ip=[::ffff:127.0.0.1]
Apr 2 18:44:11 roc-desktop imapd: LOGOUT, ip=[::ffff:127.0.0.1], rcvd=42, sent=332
Apr 2 18:44:16 roc-desktop imapd: Connection, ip=[::ffff:127.0.0.1]
Apr 2 18:44:16 roc-desktop imapd: LOGIN FAILED, user=james, ip=[::ffff:127.0.0.1]
Apr 2 18:44:21 roc-desktop imapd: LOGOUT, ip=[::ffff:127.0.0.1], rcvd=41, sent=332
Apr 2 18:55:30 roc-desktop postfix/master[13438]: fatal: /etc/postfix/master.cf: line 83: bad transport type: smtp_data_done_timeout=1200
Apr 2 18:59:23 roc-desktop postfix/master[13519]: fatal: /etc/postfix/master.cf: line 83: bad transport type: smtp_data_done_timeout=1200

装好后,用松鼠登录,总是提示密码错误…………这个不可能输错的。
用本地telnet localhost 25也不能登陆,日志如上
ww_great
帖子: 15
注册时间: 2008-06-04 17:29

Re: ubuntu8.04+postfix+postfixadmin+courier+mysql+squirrermail

#15

帖子 ww_great » 2009-04-05 22:28

本人完全是新手,全部按照上面的步骤安装设置,到这里:
配置/etc/postfix/sasl/smtpd.conf

pwcheck_method: saslauthd
mech_list: plain login
allow_plaintext: true
auxprop_plugin: mysql
sql_hostnames: 127.0.0.1
sql_user: postfix
sql_passwd: postfix
sql_database: postfix
sql_select: select password from users where email = '%u'

添加用户
adduser postfix sasl
重启
/etc/init.d/postfix restart ----[这里出了错误!]
/etc/init.d/saslauthd restart

系统提示目录 /etc/mailname 不存在!手工创建一个,提示有两个hard link。
能否指教一下?

另外,感觉文章说的有点不够清楚,很多配置的地方好像有疑问,包括上面的/etc/mailname目录和postfix配置文件main.cf中的:
myhostname = epfhk.com
这里的机器名是否应当替换为自己配置的机器名称?

还有就是那几个mysql 与postfix 配置映射的文件,在之前的安装过程中似乎不会存在,本人是完全重新创建新文件并全部照搬,作者如果能对这些文件出处做个介绍就好了。

上面都是本人配置过程出现的问题,希望能获得楼主的帮助。

谢谢!
回复