分类: LINUX
2009-02-20 17:26:11
./configure --with-redhat \
--with-mailuser=vmail --with-mailgroup=vmail \
--with-authldaprc=/etc/authlib/authldaprc --sysconfdir=/etc \
--prefix=/usr/local/authlib --without-stdheaderdir
make
make install
make install-configure
echo "/usr/local/authlib/lib/courier-authlib" >> /etc/ld.so.conf
ldconfig -v
ln -sv /usr/local/authlib/bin/courierauthconfig /usr/bin
cp courier-authlib.sysvinit /etc/init.d/courier-authlib
chmod 755 /etc/init.d/courier-authlib
chkconfig --add courier-authlib
chkconfig --level 35 courier-authlib on
service courier-authlib start
chmod 755 /usr/local/authlib/var/spool/authdaemon
设置配置文件authdaemonrc:
vi /etc/authlib/authdaemonrc
authmodulelist="authldap"
authmodulelistorig="authldap"
DEBUG_LOGIN=2
配置authldaprc:
LDAP_URI ldap://localhost
LDAP_PORT 389
LDAP_PROTOCOL_VERSION 3
LDAP_TIMEOUT 5
LDAP_DOMAIN test.com //服务器域名
LDAP_BASEDN o=extmailAccount,dc=extmail.org
LDAP_BINDDN cn=Manager,dc=extmail.org
LDAP_BINDPW 111111
LDAP_MAIL mail
LDAP_FILTER (active=1)
LDAP_GLOB_UID vmail
LDAP_GLOB_GID vmail
LDAP_HOMEDIR homeDirectory
LDAP_MAILROOT /var/mailbox
LDAP_MAILDIRQUOTA mailQuota
LDAP_CRYPTPW userPassword
LDAP_DEREF never
LDAP_TLS 0
#LDAP_MAILDIR mailMessageStore
#LDAP_AUTHBIND 1
./configure --prefix=/usr/local/apache --enable-so --enable-ssl --enable-track-vars \
--enable-rewrite --with-zlib --enable-suexec --with-suexec-caller=daemon \
--with-suexec-docroot=/var/www/
Make
Make install
./configure --prefix=/usr/local/php \
--with-ldap=/usr --with-ldap-sasl=/usr/local/sasl \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-libxml-dir=/usr --with-gd=/usr \
--with-zlib --enable-magic-quotes \
--enable-libgcc --enable-mbstring=all \
--enable-sockets --with-gnu-ld --with-gettext
Make
Make install
cp php.ini-dist /usr/local/php/lib/php/php.ini
编辑 httpd.conf 配置文件。不再详细说明
make -f Makefile.init makefiles \
'CCARGS=-DHAS_LDAP -I/usr/local/openldap/include \
-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/sasl/include/sasl -I/usr/local/BerkeleyDB/include -DUSE_TLS -I-DUSE_TLS \
-I/usr/include/openssl' \
'AUXLIBS=-L/usr/local/openldap/lib -lldap -llber -L/usr/local/sasl/lib -lsasl2 \
-L/usr/local/BerkeleyDB/lib -L/usr/lib -lssl -lcrypto'
make
make install
newaliases
mv /etc/postfix/main.cf /etc/postfix/main.cf.bak
mv /etc/postfix/master.cf /etc/postfix/master.cf.bak
touch /etc/postfix/main.cf
touch /etc/postfix/master.cf
postalias /etc/aliases
建立邮件存储文件夹:
mkdir -pv /var/mailbox
chown -R vmail:vmail /var/mailbox/
chmod -R 700 /var/mailbox/
设置main.cf文件(我的配置文档):
queue_directory = /var/spool/postfix
######################################################################
command_directory = /usr/sbin
daemon_directory = /usr/local/postfix
mail_owner = postfix
myhostname = test.com
mydomain = test.com
myorigin = $mydomain
inet_interfaces = all
mydestination =
unknown_local_recipient_reject_code = 550
mynetworks = 192.168.150.0/24, 127.0.0.0/8
############################CYRUS-SASL############################
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_unknown_sender_domain,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
reject_unauth_destination,permit
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
#smtpd_sasl_path = /usr/local/sasl
smtpd_sasl_security_options = noanonymous
#smtpd_sasl_type = cyrus
smtpd_sasl_application_name = smtpd
smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available!
#############################SASL-END##################################
#############################Virtual Mailbox Settings####################
virtual_mailbox_base=/var/mailbox
virtual_mailbox_maps=ldap:/etc/postfix/ldap_virtual_mailbox_maps.cf
virtual_mailbox_domains=ldap:/etc/postfix/ldap_virtual_domains_maps.cf
virtual_alias_domains=
virtual_alias_maps=ldap:/etc/postfix/ldap_virtual_alias_maps.cf
virtual_uid_maps=static:1001
virtual_gid_maps=static:1001
virtual_transport=maildrop
maildrop_destination_recipient_limit=1
maildrop_destination_concurrency_limit=1
#################################Mailbox END###############################
#################################Quota Settings############################
message_size_limit=1433600
virtual_mailbox_limit=20791520
virtual_create_maildirsize=yes
virtual_mailbox_extended=yes
virtual_mailbox_limit_maps=ldap:/etc/postfix/ldap_virtual_limit_maps.cf
virtual_mailbox_limit_override=yes
virtual_maildir_limit_message= Sorry,The User's maildir has overdrawn his diskspace quota,Please try again later.
virtual_overquota_bounce=yes
################################Quota END#################################
################################Amavis Start##############################
content_filter=amavisfeed:[127.0.0.1]:10024
max_use=1000
################################Amavis END################################
debug_peer_level = 2
debugger_command =
PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
xxgdb $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
mailq_path = /usr/bin/mailq
setgid_group = postdrop
html_directory = /var/www/postfix_html
manpage_directory = /usr/local/postfix
sample_directory = /etc/postfix
readme_directory = no
设置master.cf文件:
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
#submission inet n - n - - smtpd
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#smtps inet n - n - - smtpd
# -o smtpd_tls_wrappermode=yes
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_client_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
#628 inet n - n - - qmqpd
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay unix - - n - - smtp
-o smtp_fallback_relay=
-o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent. See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/local/maildrop/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix - n n - - pipe
flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
cyrus unix - n n - - pipe
user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp unix - n n - - pipe
flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# ====================================================================
#
# Other external delivery methods.
#
ifmail unix - n n - - pipe
flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
#
#bsmtp unix - n n - - pipe
# flags=Fq. user=bsmtp argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient
#
scalemail-backend unix - n n - 2 pipe
flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store
# ${nexthop} ${user} ${extension}
#
mailman unix - n n - - pipe
flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
# ${nexthop} ${user}
#############################################################################
#############################################################################
amavisfeed unix - - n - 2 smtp
-o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
-o disable_dns_lookups=yes
-o max_use=20
#
127.0.0.1:10025 inet n - n - - smtpd
-o content_filter=
-o smtpd_delay_reject=no
-o smtpd_client_restrictions=permit_mynetworks,reject
-o smtpd_helo_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o smtpd_data_restrictions=reject_unauth_pipelining
-o smtpd_end_of_data_restrictions=
-o smtpd_restriction_classes=
-o mynetworks=127.0.0.0/8
-o smtpd_error_sleep_time=0
-o smtpd_soft_error_limit=1001
-o smtpd_hard_error_limit=1000
-o smtpd_client_connection_count_limit=0
-o smtpd_client_connection_rate_limit=0
-o receive_override_options=no_header_body_checks,no_unknown_recipient_checks,no_milters
-o local_header_rewrite_clients=