0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Postfixと連携するDovecotをインストールする

Posted at

急遽Webメール環境が必要となり、併せてIMAPサーバも必要になったため、Dovecotのインストールを行いました。

Dovecotの設定だけでなく、Postfix側でも連携するための設定が必要だったため、メモ記事となります。

また、本記事は既にPostfixでメール送受信ができるようになっていることを前提としております。ご注意下さい。

Dovecotのインストール

dnf install dovecot
Last metadata expiration check: 0:39:00 ago on Sat 21 Dec 2024 05:49:49 PM JST.
Dependencies resolved.
================================================================================
 Package        Arch     Version                              Repository   Size
================================================================================
Installing:
 dovecot        x86_64   1:2.3.16-6.el8_10                    appstream   5.2 M
Installing dependencies:
 clucene-core   x86_64   2.3.3.4-31.20130812.e8e3d20git.el8   appstream   598 k
Transaction Summary
================================================================================
Install  2 Packages
Total download size: 5.8 M
Installed size: 20 M
Is this ok [y/N]:y
Downloading Packages:
(1/2): clucene-core-2.3.3.4-31.20130812.e8e3d20 2.4 MB/s | 598 kB     00:00
(2/2): dovecot-2.3.16-6.el8_10.x86_64.rpm       7.7 MB/s | 5.2 MB     00:00
--------------------------------------------------------------------------------
Total                                           4.4 MB/s | 5.8 MB     00:01
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1
  Installing       : clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_   1/2
  Running scriptlet: dovecot-1:2.3.16-6.el8_10.x86_64                       2/2
  Installing       : dovecot-1:2.3.16-6.el8_10.x86_64                       2/2
  Running scriptlet: dovecot-1:2.3.16-6.el8_10.x86_64                       2/2
  Verifying        : clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_   1/2
  Verifying        : dovecot-1:2.3.16-6.el8_10.x86_64                       2/2
Installed:
  clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_64
  dovecot-1:2.3.16-6.el8_10.x86_64
Complete!

Dovecotサービスを自動起動するよう設定します。

systemctl enable dovecot

Dovecotの設定

プロトコルの指定

view /etc/dovecot/dovecot.conf

(途中省略)
protocols = imap pop3
(途中省略)

平文認証の有効化

view /etc/dovecot/conf.d/10-auth.conf

(途中省略)
disable_plaintext_auth = no
(途中省略)
auth_mechanisms = plain login
(途中省略)

メール保存先の指定

view /etc/dovecot/conf.d/10-mail.conf

(途中省略)
mail_location = maildir:~/Maildir
(途中省略)

PostfixでSMTP-AUTHを行うための設定

# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
  mode = 0666
  user = postfix
  group = postfix
}

Dovecotの起動

systemctl start dovecot
ss -an

(途中省略)
tcp   LISTEN     0      100                                     0.0.0.0:110 0.0.0.0:*
tcp   LISTEN     0      100                                     0.0.0.0:143 0.0.0.0:*
(途中省略)

Postfixの設定

view /etc/postfix/main.cf

(途中省略)
inet_interfaces = all
(途中省略)
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
(途中省略)
local_recipient_maps = unix:passwd.byname $alias_maps
(途中省略)
home_mailbox = Maildir/
(途中省略)
smtpd_banner = $myhostname ESMTP
(途中省略)
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions =
    permit_mynetworks,
    permit_sasl_authenticated,
    reject_unauth_destination

Postfixの設定確認

postfix check

Postfixの再起動

systemctl stop postfix
systemctl start postfix

以上です。お疲れ様でした!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?