さくらVPSサーバ設定メモ(7)

2011年5月14日 オフ 投稿者: KYO
Table of Contents

続いて、postfixとdovecotの設定。

  • postfix
  • dovecot

SMTP-Authの設定は、Postfix+Dovecot+SMTP-Authを参考に。

  • mta(postfix)

 

[shell]

$ sudo /usr/sbin/update-alternatives –config mta

$ sudo yum install postfix

$ sudo /etc/rc.d/init.d/postfix start

$ /etc/rc.d/init.d/sendmail stop

$ chkconfig sendmail off

$ chkconfig postfix on

$ telnet localhost 25

$ sudo vim /etc/postfix/main.cf

queue_directory = /var/spool/postfix

command_directory = /usr/sbin

daemon_directory = /usr/libexec/postfix

mail_owner = postfix

myhostname = mail.example.com

mydomain = example.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

virtual_mailbox_maps = hash:/etc/postfix/virtual

local_recipient_maps = unix:passwd.byname $alias_maps

unknown_local_recipient_reject_code = 550

mynetworks_style = subnet

mynetworks = 127.0.0.0/8

relay_domains = $mydestination

alias_maps = hash:/etc/aliases

alias_database = hash:/etc/aliases

home_mailbox = Maildir/

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.postfix

newaliases_path = /usr/bin/newaliases.postfix

mailq_path = /usr/bin/mailq.postfix

setgid_group = postdrop

html_directory = no

manpage_directory = /usr/share/man

sample_directory = /usr/share/doc/postfix-2.3.3/samples

readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES

disable_vrfy_command = yes

smtpd_sasl_auth_enable = yes

broken_sasl_auth_clients = yes

smtpd_sasl_security_options = noanonymous, noplaintext

smtpd_sasl_local_domain = $myhostname

smtpd_client_restrictions =

permit_mynetworks,

reject_rhsbl_client rhsbl.ahbl.org,

reject_rbl_client spamcop.net,

reject_rbl_client dynablock.wirehub.net,

reject_rbl_client sbl.spamhaus.org,

reject_unknown_client,

permit

smtpd_recipient_restrictions =

permit_mynetworks,

permit_sasl_authenticated,

reject_unauth_destination

smtpd_etrn_restrictions =

permit_mynetworks,

permit_sasl_authenticated,

reject_invalid_hostname

smtpd_helo_restrictions =

permit_mynetworks,

permit_sasl_authenticated,

reject_invalid_hostname,

reject_non_fqdn_hostname,

permit

smtpd_sender_restrictions = reject_unknown_sender_domain

smtpd_helo_required = yes

smtpd_sender_restrictions = reject_non_fqdn_sender

smtpd_client_connection_count_limit = 30

message_size_limit = 20480000

default_process_limit = 100

smtpd_client_connection_count_limit = 25

smtpd_client_connection_rate_limit = 100

smtpd_soft_error_limit = 4

smtpd_error_sleep_time = 30

smtpd_hard_error_limit = 5

[/shell]

 

[shell]

$ /etc/rc.d/init.d/saslauthd start

$ chkconfig saslauthd on

$ cd

$ mkdir -p /etc/skel/Maildir/{new,cur,tmp}

$ chmod -R 700 /etc/skel/Maildir/

[/shell]

 

  • dovecot

 

[shell]

$ sudo yum install dovecot

$ sudo vim /etc/dovecot.conf

 

 

protocols = imap pop3

ssl_disable = no

mail_location = maildir:~/Maildir

protocol imap {

}

protocol pop3 {

}

protocol lda {

postmaster_address = postmaster@example.com

}

auth default {

mechanisms = plain

passdb pam {

}

userdb passwd {

}

user = root

}

dict {

}

plugin {

}

 

 

$ sudo /etc/rc.d/init.d/dovecot start

$ chkconfig dovecot on

$ localhost 110

$ localhost 143

[/shell]