メールサーバを小リニューアル
メールサーバの機能を部分的に更新した。
これまでMailbox形式だった物をMaildir形式のものに変え、
POP3だったものをIMAP4にした程度だが。
……あ、qpopperをやめてdovecotにしたなそういえば。
というわけで、1ヶ月ぶりの更新はここから始めようと思う。
うーん、記事を書く時間を割く努力をもっとしなければ。
さて、まずはMaildir形式への移行方法から。
……と言っても、postfixを導入している当サーバでは非常に簡単だ。/usr/local/etc/postfix/main.cfの……
home_mailbox = Mailbox
を
home_mailbox = Maildir/
に変えて終了。あとはpostfixをreloadすれば、新しくメールが配送された際に
宛先のホームディレクトリ直下にMaildirが作成される。
次。dovecotの導入……だが、別段vpopmailに対応させなければならないわけでなし、
暗号化にナーバスになるでもないのでこちらも作業は至って簡単だ。
# cd /usr/ports/mail/dovecot # make config (IPv6とLDAを使用しないように指定) # make install clean # cp -p /usr/local/etc/dovecot-example.conf /usr/local/etc/dovecot.conf
インストールを行い、設定ファイルをデフォルトからコピーした上で書き換える。
--- /usr/local/etc/dovecot.conf Fri Mar 21 15:05:22 2008 +++ /usr/local/etc/dovecot-example.conf Fri Mar 21 14:55:16 2008 @@ -47,7 +47,6 @@ # matches the local IP (ie. you're connecting from the same computer), the # connection is considered secure and plaintext authentication is allowed. #disable_plaintext_auth = yes -disable_plaintext_auth = no # Should all IMAP and POP3 processes be killed when Dovecot master process # shuts down. Setting this to "no" means that Dovecot can be upgraded without @@ -76,7 +75,7 @@ # Syslog facility to use if you're logging to syslog. Usually if you don't # want to use "mail", you'll use local0..local7. Also other standard # facilities are supported. -syslog_facility = local0 +#syslog_facility = mail ## ## SSL settings @@ -88,7 +87,6 @@ # Disable SSL/TLS support. #ssl_disable = no -ssl_disable = yes # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before # dropping root privileges, so keep the key file unreadable by anyone but @@ -142,7 +140,6 @@ # only it has access, it's used to control access for authentication process. # Note that this user is NOT used to access mails. <doc/wiki/UserIds.txt> #login_user = dovecot -login_user = dovecot # Set max. process size in megabytes. If you don't use # login_process_per_connection you might need to grow this. @@ -174,7 +171,6 @@ # Greeting message for clients. #login_greeting = Dovecot ready. -login_greeting = POP-Server Ready. # Space-separated list of elements we want to log. The elements which have # a non-empty variable value are joined together to form a comma-separated @@ -215,8 +211,7 @@ # <doc/wiki/MailLocation.txt> # #mail_location = -#mail_location = mbox:~/mail/:INBOX=/var/mail/%u -mail_location = maildir:~/Maildir +mail_location = mbox:~/mail/:INBOX=/var/mail/%u # If you need to set multiple mailbox locations or want to change default # namespace settings, you can do it by defining namespace sections. @@ -336,18 +331,14 @@ # be done even if first_valid_uid is set to 0. #first_valid_uid = 500 #last_valid_uid = 0 -first_valid_uid = 1001 -last_valid_uid = 2000 # Valid GID range for users, defaults to non-root/wheel. Users having # non-valid GID as primary group ID aren't allowed to log in. If user # belongs to supplementary groups with non-valid GIDs, those groups are # not set. #first_valid_gid = 1 -#first_valid_gid = 0 +first_valid_gid = 0 #last_valid_gid = 0 -first_valid_gid = 1001 -last_valid_gid = 2000 # Maximum number of running mail processes. When this limit is reached, # new users aren't allowed to log in. @@ -596,21 +587,17 @@ # mostly intended to reduce disk I/O. With maildir it doesn't move files # from new/ to cur/, with mbox it doesn't write Status-header. #pop3_no_flag_updates = no - pop3_no_flag_updates = no # Support LAST command which exists in old POP3 specs, but has been removed # from new ones. Some clients still wish to use this though. Enabling this # makes RSET command clear all \Seen flags from messages. #pop3_enable_last = no - pop3_enable_last = no # If mail has X-UIDL header, use it as the mail's UIDL. #pop3_reuse_xuidl = no - pop3_reuse_xuidl = no # Keep the mailbox locked for the entire POP3 session. #pop3_lock_session = no - pop3_lock_session = no # POP3 UIDL (unique mail identifier) format to use. You can use following # variables: @@ -651,14 +638,11 @@ # %m - number of messages (before deletion) # %s - mailbox size in bytes (before deletion) #pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s - pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s # Workarounds for various client bugs: # outlook-no-nuls: @@ -676,26 +660,26 @@ ## LDA specific settings ## -#protocol lda { -# # Address to use when sending rejection mails. -# postmaster_address = postmaster@example.com -# -# # Hostname to use in various parts of sent mails, eg. in Message-Id. -# # Default is the system's real hostname. -# #hostname = -# -# # Support for dynamically loadable plugins. mail_plugins is a space separated -# # list of plugins to load. -# #mail_plugins = -# #mail_plugin_dir = /usr/local/lib/dovecot/lda -# -# # Binary to use for sending mails. -# #sendmail_path = /usr/lib/sendmail -# sendmail_path = /usr/sbin/sendmail -# -# # UNIX socket path to master authentication server to find users. -# #auth_socket_path = /var/run/dovecot/auth-master -#} +protocol lda { + # Address to use when sending rejection mails. + postmaster_address = postmaster@example.com + + # Hostname to use in various parts of sent mails, eg. in Message-Id. + # Default is the system's real hostname. + #hostname = + + # Support for dynamically loadable plugins. mail_plugins is a space separated + # list of plugins to load. + #mail_plugins = + #mail_plugin_dir = /usr/local/lib/dovecot/lda + + # Binary to use for sending mails. + #sendmail_path = /usr/lib/sendmail + sendmail_path = /usr/sbin/sendmail + + # UNIX socket path to master authentication server to find users. + #auth_socket_path = /var/run/dovecot/auth-master +} # Username formatting before it's looked up from databases. You can use # the standard variables here, eg. %Lu would lowercase the username, %n would @@ -858,10 +840,10 @@ # System users (NSS, /etc/passwd, or similiar) # In many systems nowadays this uses Name Service Switch, which is # configured in /etc/nsswitch.conf. <doc/wiki/AuthDatabase.Passwd.txt> - passdb passwd { + #passdb passwd { # [blocking=yes] - See userdb passwd for explanation #args = - } + #} # Shadow passwords for system users (NSS, /etc/shadow or similiar). # Deprecated by PAM nowadays.
こんな感じ。長くなり過ぎたかな?あとは自動起動の設定を施して終了。