1. bakachou

    No comment

    bakachou
Changes in body
Source | HTML | Preview
@@ -1,157 +1,160 @@
#はじめに
Dovecot をお手軽に起動して POP サーバを起動する手順です。
セキュアサーバの設定などは置いといて、自分のローカル環境などで POP サーバを立てたいなどお手軽に設定する手順なので注意してください。
環境は Red Hat Linux 7 です。
```bash
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.7 (Maipo)
```
# インストール
Dovecot とそれに必要なライブラリをインストールする。
```bash
yum -y install dovecot
yum -y install cyrus-sasl
```
インストールできたかの確認
```bash
rpm -q dovecot
dovecot-2.2.36-6.el7.x86_64
```
# 設定
以下の3つのファイルを修正する
* /etc/dovecot/conf.d/10-mail.conf
* /etc/dovecot/conf.d/10-auth.conf
* /etc/dovecot/conf.d/10-ssl.conf
## /etc/dovecot/conf.d/10-mail.conf の設定
```bash
diff -u /etc/dovecot/conf.d/10-mail.conf.orig /etc/dovecot/conf.d/10-mail.conf
--- /etc/dovecot/conf.d/10-mail.conf.orig 2020-08-05 00:52:01.488157996 -0400
+++ /etc/dovecot/conf.d/10-mail.conf 2020-08-05 00:53:15.719860050 -0400
@@ -28,6 +28,7 @@
# <doc/wiki/MailLocation.txt>
#
#mail_location =
+mail_location = maildir:~/Maildir # 各ユーザのホームディレクトリにある Maildir
# If you need to set multiple mailbox locations or want to change default
# namespace settings, you can do it by defining namespace sections.
@@ -194,6 +195,7 @@
# may lead to root exploit. Usually this should be done only if you don't
# allow shell access for users. <doc/wiki/Chrooting.txt>
#valid_chroot_dirs =
+valid_chroot_dirs = /home
# Default chroot directory for mail processes. This can be overridden for
# specific users in user database by giving /./ in user's home directory
@@ -410,3 +412,5 @@
# negate an exclusion (e.g. content-type=!foo/* content-type=foo/bar).
# exclude-inlined - Exclude any Content-Disposition=inline MIME part.
#mail_attachment_detection_options =
+
+
```
## /etc/dovecot/conf.d/10-auth.conf の設定
```bash
diff -u /etc/dovecot/conf.d/10-auth.conf.orig /etc/dovecot/conf.d/10-auth.conf
--- /etc/dovecot/conf.d/10-auth.conf.orig 2020-08-05 00:53:29.224444797 -0400
+++ /etc/dovecot/conf.d/10-auth.conf 2020-08-05 00:54:24.904733010 -0400
@@ -8,6 +8,7 @@
# connection is considered secure and plaintext authentication is allowed.
# See also ssl=required setting.
#disable_plaintext_auth = yes
+disable_plaintext_auth = no # PLAINTEXT での認証もできるように修正
# Authentication cache size (e.g. 10M). 0 means it's disabled. Note that
# bsdauth, PAM and vpopmail require cache_key to be set for caching to be used.
```
## /etc/dovecot/conf.d/10-ssl.conf の設定
```bash
diff -u /etc/dovecot/conf.d/10-ssl.conf.orig /etc/dovecot/conf.d/10-ssl.conf
--- /etc/dovecot/conf.d/10-ssl.conf.orig 2020-08-05 00:54:47.618035671 -0400
+++ /etc/dovecot/conf.d/10-ssl.conf 2020-08-05 00:55:07.192434703 -0400
@@ -5,7 +5,8 @@
# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
# disable plain pop3 and imap, allowed are only pop3+TLS, pop3s, imap+TLS and imaps
# plain imap and pop3 are still allowed for local connections
-ssl = required
+#ssl = required
+ssl = no # SSL の利用しないように変更
# 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
```
# デーモン起動
```bash
systemctl start saslauthd
systemctl enable saslauthd
systemctl start dovecot
systemctl enable dovecot
```
# メール受信確認
+[Postfix お手軽設定&起動&利用](https://qiita.com/bakachou/items/7830b32f017a9702d932) で送信したメールを確認してみる
+
+
```bash
telnet localhost 110
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user <ユーザ名>
+OK
pass <パスワード>
+OK Logged in.
stat
+OK 1 546
list
+OK 1 messages:
1 546
.
petr 1
-ERR Unknown command: PETR
RETR 1
+OK 546 octets
Return-Path: <<メールアドレス>>
X-Original-To: <メールアドレス>
Delivered-To: <メールアドレス>
Received: from <ホスト名> (localhost [IPv6:::1])
by <ホスト名> (Postfix) with SMTP id 9279EC00DBF
for <<メールアドレス>>; Thu, 6 Aug 2020 01:20:07 +0000 (UTC)
Message-Id: <20200806012015.9279EC00DBF@<ホスト名>>
Date: Thu, 6 Aug 2020 01:20:07 +0000 (UTC)
From: <メールアドレス>
aaaaa
.
DELE 1
+OK Marked to be deleted.
quit
+OK Logging out, messages deleted.
Connection closed by foreign host.
```
あれ? PETR って大文字じゃないとダメなの?