はじめての自宅サーバ構築 - Fedora/CentOS - Last Update 2008/07/25
It opened to 2004/09/19.
当サイトはFedora9で運用しています
Visitors
Pageviews
Today(IP/PV)
3,374,122
12,762,148
1,280/8,770
動作確認 [ FC1 / FC2 / FC3 / FC4 / FC5 / FC6 / Fedora7 / Fedora8 / Fedora9 / CentOS4 / CentOS5 ]
  1. sslとは・・・
  2. sslモジュールのインストール
  3. CA用秘密鍵(ca.key)の作成 〜 サーバ用証明書(server.crt)の作成
  4. postfix設定ファイルの変更
  5. dovecot設定ファイルの変更
  6. postfix(SMTP)とdovecot(POP)の再起動
  7. 公開前の準備
  8. クライアントメールソフトの設定
    設定例(Becky!)

■ sslとは・・・

SSL(Secure Sockets Layer)は簡単に言うと、データを暗号化してやり取りするやり方の決まりです。
SSLを使用すると送信するデータが暗号化されるので、プライバシーに関わる情報を第三者に見られずにやり取りすることができます。
postfix(smtp)+dovecot(pop)で通信の暗号化を行い通信する構築方法を紹介します。

■ sslモジュールのインストール

通信内容暗号化(OpenSSL & mod_SSL) 〜 Webページ編 〜の『sslモジュールのインストール』を参照して下さい。

■ CA用秘密鍵(ca.key)の作成 〜 サーバ用証明書(server.crt)の作成

通信内容暗号化(OpenSSL & mod_SSL) 〜 Webページ編 〜の『CA用秘密鍵(ca.key)の作成 〜 サーバ用証明書(server.crt)の作成』を参照して下さい。

■ postfix設定ファイルの変更

サーバ証明書とサーバ秘密鍵をpostfixで使用するため、シンボリックリンクを貼る

Webサーバ証明書にシンボリックリンクを貼る
# ln -s /etc/httpd/conf/server.crt /etc/postfix/server.crt

Webサーバ秘密鍵にシンボリックリンクを貼る
# ln -s /etc/httpd/conf/server.key /etc/postfix/server.key

postfix設定ファイル編集
# vi /etc/postfix/main.cf
最終行に以下を追加する
smtpd_tls_cert_file = /etc/postfix/server.crt
smtpd_tls_key_file = /etc/postfix/server.key
smtpd_use_tls = yes
【FedoraCore1 / FedoraCore2 / FedoraCore3 の場合】
smtpd_tls_session_cache_database = sdbm:/etc/postfix/smtpd_scache
【FedoraCore4 / FedoraCore5 / FedoraCore6 / Fedora7 / Fedora8 / Fedora9 / CentOS4 / CentOS5 の場合】
smtpd_tls_session_cache_database = btree:/etc/postfix/smtpd_scache

postfix設定ファイル編集
# vi /etc/postfix/master.cf
#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n       -       n       -       -       smtpd
#  -o smtpd_enforce_tls=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
先頭の"#"を外す(有効にする)
smtps     inet  n       -       n       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
※:「permit_sasl_authenticated,reject」の意味は、SASL認証したクライアントだけに中継を許可する
#628      inet  n       -       n       -       -       qmqpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup

■ dovecot設定ファイルの変更

dovecot設定ファイル編集
# vi /etc/dovecot.conf
# Disable SSL/TLS support.
先頭の"#"を外す(有効にする)
ssl_disable = no

# 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
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
先頭の"#"を外しWebサーバ証明書を指定する
ssl_cert_file = /etc/postfix/server.crt
先頭の"#"を外しWebサーバ秘密鍵を指定する
ssl_key_file = /etc/postfix/server.key

■ postfix(SMTP)とdovecot(POP)の再起動

postfixを再起動する
# /etc/rc.d/init.d/postfix restart
Shutting down postfix:                                     [  OK  ]
Starting postfix:                                          [  OK  ]

dovecotを再起動する
# /etc/rc.d/init.d/dovecot restart
Dovecot Imapを停止中:                                      [  OK  ]
Dovecot Imap を起動中:                                     [  OK  ]

■ 公開前の準備

WANから接続するに当たって、ルータの設定が必要です。
ルータのポート開閉は、ご自分のルータ取扱説明書をご覧ください。
DNS名で接続するには事前にドメイン名の取得を行っている必要があります。(以下は代表的なものであり、また、当サイトが使用させて頂いております)

■ クライアントメールソフトの設定

クライアントのメールソフトの接続に関する設定部分を以下の様に変更します。

■ 設定例(Becky!)

「基本設定」タブ(パスワード項目に注意)


「詳細」タブ(パスワード項目に注意)

■ 広告

ページ先頭へ

Copyright(©)2004-2008 First home server construction. All Right Reserved.