質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
Dovecot

Dovecotとは、POPやIMAPサーバーを提供するMDA(メール配送エージェント)の一つです。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

Q&A

1回答

12855閲覧

dovecotのimapによるユーザ認証について

hirdd

総合スコア50

Dovecot

Dovecotとは、POPやIMAPサーバーを提供するMDA(メール配送エージェント)の一つです。

Linux

Linuxは、Unixをベースにして開発されたオペレーティングシステムです。日本では「リナックス」と呼ばれています。 主にWebサーバやDNSサーバ、イントラネットなどのサーバ用OSとして利用されています。 上位500のスーパーコンピュータの90%以上はLinuxを使用しています。 携帯端末用のプラットフォームAndroidは、Linuxカーネル上に構築されています。

0グッド

0クリップ

投稿2017/05/21 11:25

現在、dovecotを使って、imapの挙動を確認しようとしている者です。MTAは、postfixを使用してメールの送信(telnetを使用)、受信ができている事は確認済みです。その後、dovecotをインストールし、plain textで認証ができるように以下のように設定をしました。しかし、いざ、telnetで143ポートにアクセスして、"login"しようとすると、以下のような結果になり、loginできません。原因が分からず、困っているのですが、どなたか詳しい方、ヒントを頂けませんでしょうか。

▪️telnet結果
XXX:~ user$ telnet 192.168.99.101 143
Trying 192.168.99.101...
Connected to 192.168.99.101.
Escape character is '^]'.

  • OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN AUTH=LOGIN] Dovecot ready.

1 login user1 パスワード

  • BYE Internal error occurred. Refer to server log for more information.

Connection closed by foreign host.

▪️dovecot設定ファイル変更内容
・dovecot.conf
protocols = imap pop3 lmtp
listen = *
・10-mail.comf
mail_location = maildir:~/Maildir 
・10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain log
・10-ssl.conf
ssl = no

▪️systemctl status内容
[root@rhel7 ~]# systemctl status dovecot
● dovecot.service - Dovecot IMAP/POP3 email server
Loaded: loaded (/usr/lib/systemd/system/dovecot.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2017-05-21 19:59:57 JST; 23min ago
Process: 1016 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited, status=0/SUCCESS)
Main PID: 1061 (dovecot)
CGroup: /system.slice/dovecot.service
├─1061 /usr/sbin/dovecot -F
├─1106 dovecot/anvil
└─1107 dovecot/log

May 21 20:02:23 rhel7.3.mydomain dovecot[1107]: imap: Error: user user1: Mail access for users with UID 501 not permitted (see first_valid_uid in config file, uid from userdb lookup).
May 21 20:02:23 rhel7.3.mydomain dovecot[1107]: imap: Error: Invalid user settings. Refer to server log for more information.
May 21 20:04:53 rhel7.3.mydomain auth[3713]: pam_unix(dovecot:auth): authentication failure; logname= uid=0 euid=0 tty=dovecot ruser=user2 rhost=192.168.99.1 user=user2
May 21 20:04:53 rhel7.3.mydomain auth[3713]: pam_succeed_if(dovecot:auth): requirement "uid >= 1000" not met by user "user2"
May 21 20:05:26 rhel7.3.mydomain dovecot[1107]: imap-login: Login: user=<user2>, method=PLAIN, rip=192.168.99.1, lip=192.168.99.101, mpid=3723, session=<SARiuQZQbwDAqGMB>
May 21 20:05:26 rhel7.3.mydomain dovecot[1107]: imap: Error: user user2: Mail access for users with UID 502 not permitted (see first_valid_uid in config file, uid from userdb lookup).
May 21 20:05:26 rhel7.3.mydomain dovecot[1107]: imap: Error: Invalid user settings. Refer to server log for more information.
May 21 20:20:35 rhel7.3.mydomain dovecot[1107]: imap-login: Login: user=<user1>, method=PLAIN, rip=192.168.99.1, lip=192.168.99.101, mpid=3981, session=<FVR/8QZQJwDAqGMB>
May 21 20:20:35 rhel7.3.mydomain dovecot[1107]: imap: Error: user user1: Mail access for users with UID 501 not permitted (see first_valid_uid in config file, uid from userdb lookup).
May 21 20:20:35 rhel7.3.mydomain dovecot[1107]: imap: Error: Invalid user settings. Refer to server log for more information.
Hint: Some lines were ellipsized, use -l to show in full.
[root@rhel7 ~]#

▪️/var/log/audit/audit.log内容
type=USER_ACCT msg=audit(1495365635.286:213): pid=3977 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:dovecot_auth_t:s0 msg='op=PAM:accounting grantors=pam_unix,pam_localuser acct="user1" exe="/usr/libexec/dovecot/auth" hostname=192.168.99.1 addr=192.168.99.1 terminal=dovecot res=success'

▪️OS
サーバ側:Red Hat Enterprise Linux Server release 7.3 (Maipo)
クライアント側:macOS

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

over

2017/05/22 00:25

user01、user02はpostfixやimap設定後に作成しましたか?そうである場合、ホームディレクトリ/該当ユーザ以下にMaildirが作成されていますか?またmaillogも原因を追究するのには有効な手段です。
guest

回答1

0

user user1: Mail access for users with UID 501 not permitted (see first_valid_uid in config file, uid from userdb lookup).

原因は上記ログに記載されているとおりです。
RHEL 7 ではデフォルトで first_valid_uid = 1000 と設定されているので、UID 1000 未満のユーザーはログインできません。

(/etc/dovecot/conf.d/10-mail.conf) # Valid UID range for users, defaults to 500 and above. This is mostly # to make sure that users can't log in as daemons or other system users. # Note that denying root logins is hardcoded to dovecot binary and can't # be done even if first_valid_uid is set to 0. first_valid_uid = 1000 #last_valid_uid = 0

投稿2017/05/22 00:40

TaichiYanagiya

総合スコア12141

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問