POP3/IMAP4 のサービスを提供するときに、SSL を利用してサーバーとクライアントとの通信経路を暗号化することが可能です。サーバー、クライアントともに SSL に対応している必要がありますが、現在では多くのメールクライアントが SSL による暗号化通信をサポートしています。
SSL により暗号化された POP3/IMAP4 サーバーを構築するには、openssl コマンドを実行して、/var/ssl/certs ディレクトリに ipop3d.pem と imapd.pem という名前の鍵ファイルを作成します。ipop3d.pem は POP3 用の鍵ファイルであり、imapd.pem は IMAP4 用の鍵ファイルとなります。imapd.pem と ipop3d.pem の内容は同一のものでも別のものでも構いません。
鍵を生成するために以下のコマンドを実行します。openssl コマンドは、幾つかの質問をしてきますので、入力してください。
# cd /var/ssl/certs # openssl req -new -x509 -nodes -out imapd.pem -keyout imapd.pem Generating a 1024 bit RSA private key ...................................................++++++ ................++++++ writing new private key to 'imapd.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:JP State or Province Name (full name) [Some-State]:Tokyo Locality Name (eg, city) []:Shibuya Organization Name (eg, company) [Internet Widgits Pty Ltd]:Turbolinux Organizational Unit Name (eg, section) []:Doc Common Name (eg, YOUR name) []:Doc Administrator Email Address []:doc@turbolinux.co.jp |
作成後は、鍵ファイルが他のユーザーから参照されないようにファイルのパーミッションを変更します。
# chmod 600 ipop3d.pem # chmod 600 imapd.pem |
次に、サービスを開始します。これらのサービスは xinetd 経由で起動されます。SSL に対応した POP3 サービスを有効にするには、以下のコマンドを実行します。
# chkconfig pop3s on |
SSL に対応した IMAP4 サービスを有効にするには、以下のコマンドを実行します。
# chkconfig imaps on |
xinetd を再起動して、これらのサービスを有効にします。
# /etc/init.d/xinetd restart |
実際にクライアントが POP3/IMAP4 サーバーにアクセスするには、/etc/hosts.allow でアクセスを許可するホストを指定する必要があります。Turbolinux 11 Server の xinetd は、TCP Wrappers によるアクセス制御を行う仕様になっており、/etc/hosts.allow でのアクセス制御のあとに、xinetd でのアクセス制御を行います。
例えば、以下のように記述をすれば、すべてのホストからのアクセス要求を受け入れるようになります。TCP Wrappers の詳細については、項20.1 を参照してください。
ipop3d: ALL imapd: ALL |