LoginSignup
0
0

More than 5 years have passed since last update.

FreeBSD + Dovecot 2.2.27

Posted at

FreeBSD に Dovecot 2.2.27 をインストールしてみたのでメモ。
(注:まだ書きかけです)

環境

  1. FreeBSD 11.0 (VirtualBox)

方針

  1. ports を使ってインストール

    1. pkg でインストールできるのはバージョン 2.2.25_5 でちょっと古い。

      % pkg search dovecot2 | grep -v plugin
      dovecot2-2.2.25_5              Secure, fast and powerful IMAP and POP3 server
      
      1. dovecot パッケージはバージョン 1.2.17 なので dovecot2 を使用
  2. ports を更新する

    1. FreeBSD 11.0 に同梱されている ports では dovecot2 のバージョンは 2.2.24 でちょっと古い

      % grep ^PORTVERSION /usr/ports/mail/dovecot2/Makefile
      PORTVERSION=    2.2.24
      
  3. IMAP のみで POP3 は使わない

  4. SSL 必須

  5. PAM でパスワード認証

  6. maildir 形式

ports を更新

  1. /usr/ports を更新

    % sudo portsnap fetch
    % sudo portsnap extract
    
  2. dovecot2 のバージョンを確認

    % grep ^PORTVERSION /usr/ports/mail/dovecot2/Makefile
    PORTVERSION=    2.2.27
    

Dovecot インストール

  1. make

    % cd /usr/ports/mail/dovecot2
    % sudo make install
    
  2. Screen Shot 2016-12-27 at 9.51.24.png

    1. デフォルトの設定のまま続行

Dovecot 設定

  1. /usr/local/etc/dovecot/dovecot.conf を作成

    # only imap (no pop3)
    # lmtp is to be used by smtpd
    protocols = imap lmtp
    
    ssl = required
    ssl_cert = </etc/mail/certs/host.cert
    ssl_key = </etc/mail/certs/host.key
    
    # used in Message-Id and LMTP replies
    hostname = mail.mydomain.jp
    
    # use maildir rather than mbox
    mail_location = maildir:~/Maildir
    
    # don't let users log in as system users
    first_valid_uid = 1000
    first_valid_gid = 1000
    
    # PAM authentication
    passdb {
        driver = pam
        # use /etc/pam.d/imap
        args = %s
    }
    
    # Get uid, gid, home from /etc/passwd through nsswitch
    userdb {
        driver = passwd
    }
    
    #service auth {
        # smtp-auth
    #   unix_listener /var/spool/smtpd/private/auth {
    #       mode = 0666
    #   }
    #}
    
    # special mailboxes
    namespace inbox {
        inbox = yes
    
        mailbox Drafts {
            special_use = \Drafts
        }
    
        mailbox Junk {
            special_use = \Junk
        }
    
        mailbox Trash {
            special_use = \Trash
        }
    
        mailbox Sent {
            special_use = \Sent
        }
    
        mailbox virtual/All {
            special_use = \All
        }
    
        mailbox virtual/Flagged {
            special_use = \Flagged
        }
    }
    
  2. /etc/pam.d/imap は FreeBSD 11.0 にバンドルされているものをそのまま使う

    auth            required        pam_unix.so             no_warn try_first_pass
    account         required        pam_unix.so
    

Dovecot 起動

  1. サービスを有効にする

    1. /etc/rc.conf に追加

      dovecot_enable="YES"
      
  2. 起動

    $ sudo service dovecot start
    
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0