pikesaku’s blog

個人的な勉強メモです。記載内容について一切の責任は持ちません。

courier-imap(5.0.8)検証環境構築

環境

AWS EC2
AMI-ID: spel-minimal-centos-7-hvm-2019.04.1.x86_64-gp2 (ami-0022ebeda476ffd59)

参考URL

Courier-IMAP

courier-imapインストール調査

②INSTALLファイルRequirements内容調査

C++ compiler - A C++ compiler is required. The server is written in C, but there are some configuration scripts that use C++ code.

gcc-c++をインストール要

make - The GNU make is recommended. Solaris's make is to be avoided. xBSD already has a gmake port, install it and use it (use gmake everywhere this document refers to make).

→インストール済み

GDBM/DB - either the GDBM or the Berkeley DB library is required.

→gdbmはインストール済み。gdbm-develもインスタールが必要(courier-authlibのconfigure実行し必要な事が判明)

The GNU IDN library (http://www.gnu.org/software/libidn/).

→libidnはインストール済み。libidn-develもインスタールが必要(courier-imapのconfigure実行し必要な事が判明)

Gamin (http://www.gnome.org/~veillard/gamin/) or FAM(http://oss.sgi.com/projects/fam/) -- either one -- is optional. If Gamin or FAM is installed, it is used for an enhanced IMAP IDLE implementation that provides real-time folder status updates to concurrent IMAP clients that have the same folder opened.

→gaminをインストール要
FAM - ArchWiki
Gamin - ArchWiki

The Courier authentication library. Before installing Courier-IMAP, download and install https://www.courier-mta.org/authlib/.

→Courier authentication libraryをインストール要

The GNU IDN) library is required.

→libidnをインストールすれば良いと判断

The Courier unicode library. Before installing Courier-IMAP, download and install https://www.courier-mta.org/unicode/.

→Courier unicode libraryをインストール要

courier-authlibインストール調査

②INSTALLファイルRequirements内容調査

A modern version of gcc ([9]http://www.gnu.org/software/gcc/)

→インストール要

The GNU linker ([10]http://www.gnu.org/software/binutils/)

→インストール済み

Libtool ([11]http://www.gnu.org/software/libtool/). Additional, libtool's libltdl library, and its development files, must be installed. On some platforms this is a separate package. On Fedora, this is the libtool-ltdl-devel package, for example.

→libtool、libtool-ltdl、libtool-ltdl-develをインストール要

GNU make ([12]http://www.gnu.org/software/make/)

→インストール済み

The "expect" command. expect is usually included with most systems. Expect can be downloaded from http://expect.nist.gov/ if it's not installed on your system. This utility is used to change system login passwords, by scripting the passwd command. If you do not have expect installed you will not be able to change system login passwords. However non-system authentication modules (LDAP, PostgreSQL, and others) will work.

→expectをインストール要

Courier Unicode Library. Before installing Courier-IMAP, download and install [13]http://www.courier-mta.org/unicode/.

→Courier unicode libraryをインストール要

courier-unicodeインストール調査

②INSTALLファイルInstallation and usage内容調査

gcc Ver4.4以上が必要と判断。

環境構築

OSセットアップ

RHEL7のセットアップを楽にする - pikesaku’s blog

$ curl -o ./epel-release-latest-7.noarch.rpm   https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo rpm -ivh ./epel-release-latest-7.noarch.rpm
$ sudo yum install -y ansible git
$ git clone https://github.com/pikesaku/setup_rhel7.git
$ sudo ansible-playbook ./setup_rhel7/setup.yml
$ sudo yum install -y bzip2

必要パッケージインストール

$ sudo yum -y install gcc gcc-c++ gamin libtool libtool-ltdl libtool-ltdl-devel expect gdbm-devel libidn-devel openssl-devel

※openssl-develはcourier-imapインストールでmakeコマンド実行し判明。

courier-unicodeインストール

$ mkdir ~/src && cd ~/src
$ wget https://sourceforge.net/projects/courier/files/courier-unicode/2.1/courier-unicode-2.1.tar.bz2/download
$ tar xjfv ./download && rm -f ./download
$ cd courier-unicode-2.1
$ ./configure
$ make
$ sudo su
# make install
# echo "/usr/local/lib" > /etc/ld.so.conf.d/courier.conf
# ldconfig
# exit

※ldconfigはcourier-imapインストールでmake checkコマンド実行し判明。

courier-authlibインストール

$ cd ~/src
$ wget https://sourceforge.net/projects/courier/files/authlib/0.69.1/courier-authlib-0.69.1.tar.bz2/download
$ tar xjfv ./download && rm -f ./download
$ cd courier-authlib-0.69.1
$ ./configure
$ make
# sudo su
# make install
# make install-configure
# echo "/usr/local/lib/courier-authlib" >> /etc/ld.so.conf.d/courier.conf
# ldconfig
# exit

※ldconfigはcourier-imapインストールでmake checkコマンド実行し判明。

courier-imapインストール

$ cd ~/src
$ wget https://sourceforge.net/projects/courier/files/imap/5.0.8/courier-imap-5.0.8.tar.bz2/download
$ tar xjfv ./download && rm -f ./download
$ cd courier-imap-5.0.8
$ ./configure --with-notice=unicode
$ make
$ make check
# sudo su
# make install
# make install-configure
# exit

サービス起動

$ sudo su
# /usr/local/sbin/authdaemond start
# /usr/lib/courier-imap/libexec/imapd.rc start

おまけ(Posrfix main.cf)

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = all
inet_protocols = ipv4
mydestination = $myhostname, localhost.$mydomain, localhost, example.com
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
home_mailbox = Maildir/
debug_peer_level = 2
debugger_command =
	 PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
	 ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

RHEL7のセットアップを楽にする

目的

RHEL7の初期設定を楽にする

手順

①RHEL7をインストールしたホストをインターネットに接続可能にする
②以下コマンドを実行する。

$ curl -o ./epel-release-latest-7.noarch.rpm   https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo rpm -ivh ./epel-release-latest-7.noarch.rpm
$ sudo yum install -y ansible git
$ git clone https://github.com/pikesaku/setup_rhel7.git
$ sudo ansible-playbook ./setup_rhel7/setup.yml

ansibleでやってる内容

selinux無効化
default.targetをmulti-user.target
個人的必須パッケージインストール
サービス自動起動無効化(NetworkManager等)
サービス自動起動有効化
再起動

今後、ちょいちょい処理を増やしていく

O365 Exchange導入時に注意すべき事項

パスワード有効期限がデフォルトで設定される。

有効期限を無効かしたい場合、以下操作が必要
管理センター→設定→セキュリティ & のプライバシー
組織のパスワード有効期限ポリシーを設定します。 | Microsoft Docs

配送ステータスresolvedの意味

Exchange 管理センター→メールフロー→メッセージ追跡
上記で配送ステータスが、"Resolved"となりメールボックスに配送されない場合があり。
これは、
Exchange 管理センター→メールフロー
で宛先変換ルールで宛先変換された場合の動作

配布リストをExchange 管理センターから設定する際、メンバーアドレスはメールアドレスでなく、表示名でしか設定できない。

f:id:pikesaku:20200103103754p:plain

DKIMメモ

自ドメインのDNSとPostfixをSPF/DKIM対応させてみた - Qiita

ADSP(Author Domain Signing Practice)レコードは、DKIM署名が有効ではない(認証結果のスコアが「dkim=pass」ではない)メールの取り扱いを、メールの送信者側が設定できる機能(RFC5617)
f:id:pikesaku:20191116152054p:plain

Postfix新機能発見

===================================================================
delay_warning_time (デフォルト: 0h)
依然としてキューに入っているメールのメッセージヘッダを送信者が 受け取るまでの時間。

この機能を有効にするには、ゼロ以外の整数値を指定します。

時間単位: s (秒)、m (分)、h (時)、d (日)、w (週)。 デフォルトの時間単位は h (時) です。
===================================================================

指定時間内に送信できない場合に、送信者にワーニングメールを送る機能
こんな文面のメールが送られる。

This is the mail system at host HOSTNAME

####################################################################
# THIS IS A WARNING ONLY. YOU DO NOT NEED TO RESEND YOUR MESSAGE. #
####################################################################

Your message could not be delivered for more than 0 hour(s).
It will be retried until it is 5 day(s) old.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

The mail system

: connect to HOSTNAME[IP_ADDRESS]:25:
Connection timed out