ブラウザの JavaScript がオフ(ブロックまたは許可しない)に設定されているため、このページは正常に機能しません。
自宅サーバー Wiki*
[
ホーム
]
一覧
最終更新
バックアップ
ヘルプ
Top
>
postfix
>
複製
?
ms
postfix をテンプレートにして作成
これらのキーワードがハイライトされています:
開始行:
root@swisspc:~# apt-get install postfix
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
openssl ssl-cert
提案パッケージ:
ca-certificates procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre
sasl2-bin
推奨パッケージ:
mail-reader resolvconf
以下のパッケージが新たにインストールされます:
openssl postfix ssl-cert
アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 1 個。
1908kB のアーカイブを取得する必要があります。
展開後に追加で 4645kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com dapper/main ssl-cert 1.0.13 [9526B]
取得:2 http://security.ubuntu.com dapper-security/main openssl 0.9.8a-7ubuntu0.3 [976kB]
取得:3 http://security.ubuntu.com dapper-security/main postfix 2.2.10-1ubuntu0.1 [923kB]
9528B を 0s で取得しました (16.1kB/s)
パッケージを事前設定しています ...
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ │ │ You have several choices for general configuration at this point. If you have
│ your debconf priority set to 'low' or 'medium', you will be asked more questions ?? │ later. You can always run "dpkg-reconfigure --priority=low postfix" at a later ?? │ point if you want to see these questions again.
│ <Ok>
│ │ └────────────────────────────────────────────
Ubuntu の設定
┌───────┤ Postfix Configuration ├───────┐
│ General type of configuration? │
│ │
│ 設定しない │
│ インターネットサイト │
│ スマートホスト付きインターネット │
│ サテライトシステム │
│ ローカルのみ │
│ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────┘
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ `メール名' は、送出されるニュースおよびメールのメッセージ (ユーザ名と @ 記号のあと │ │ に付く) で表示されるアドレスのホスト名部分です。 │ │
未選択パッケージ openssl を選択しています。
(データベースを読み込んでいます... 現在 14121 個のファイルとディレクトリがインストールされています。)
(.../openssl_0.9.8a-7ubuntu0.3_i386.deb から) openssl を展開しています...
Creating directory /etc/ssl
未選択パッケージ ssl-cert を選択しています。
(.../ssl-cert_1.0.13_all.deb から) ssl-cert を展開しています...
未選択パッケージ postfix を選択しています。
(.../postfix_2.2.10-1ubuntu0.1_i386.deb から) postfix を展開しています...
openssl (0.9.8a-7ubuntu0.3) を設定しています ...
ssl-cert (1.0.13) を設定しています ...
postfix (2.2.10-1ubuntu0.1) を設定しています ...
Adding group `postfix' (110)...
Done.
Adding system user `postfix'...
Adding new user `postfix' (104) with group `postfix'.
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (111)...
Done.
setting myhostname: swisspc
setting alias maps
setting alias database
mailname is not a fully qualified domain name. Not changing /etc/mailname.
setting destinations: swisspc, localhost.localdomain, , localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Stopping Postfix Mail Transport Agent postfix
...done.
* Starting Postfix Mail Transport Agent postfix
...done.
root: swisspc# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: swisspc
swisspc:~# vi /etc/postfix/virtual
skier-ch.info anything
skier@skier-ch.info skier
-基本方針
postfix & courier-imap を使用
外から:
SMTP over SSL(465)
IMAP over SSL(993)
中から:
SMTP(25)
IMAP(143)
POP3(110)
POP3 over SSL(992)
root@skier-ch:~# apt-get install postfix dovecot
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
dovecot-common dovecot-imapd dovecot-pop3d libkrb53 libmysqlclient12 libpq4
mysql-common openssl
Suggested packages:
krb5-doc krb5-user ca-certificates procmail postfix-mysql postfix-pgsql postfix-ldap
postfix-pcre
Recommended packages:
mail-reader resolvconf
The following NEW packages will be installed:
dovecot dovecot-common dovecot-imapd dovecot-pop3d libkrb53 libmysqlclient12 libpq4
mysql-common openssl postfix
0 upgraded, 10 newly installed, 0 to remove and 2 not upgraded.
Need to get 3328kB of archives.
After unpacking 8208kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://security.ubuntu.com breezy-security/main mysql-common 4.0.24-10ubuntu2.3 [35.0kB]
Get:2 http://security.ubuntu.com breezy-security/main libmysqlclient12 4.0.24-10ubuntu2.3 [292kB]
Get:3 http://security.ubuntu.com breezy-security/main libkrb53 1.3.6-4ubuntu0.1 [329kB]
Get:4 http://security.ubuntu.com breezy-security/main libpq4 8.0.3-15ubuntu2.2 [65.1kB]
Get:5 http://security.ubuntu.com breezy-security/main openssl 0.9.7g-1ubuntu1.2 [904kB]
Get:6 http://security.ubuntu.com breezy-security/main dovecot-common 0.99.14-1ubuntu1.1 [241kB]
Get:7 http://security.ubuntu.com breezy-security/main dovecot-imapd 0.99.14-1ubuntu1.1 [284kB]
Get:8 http://security.ubuntu.com breezy-security/main dovecot-pop3d 0.99.14-1ubuntu1.1 [259kB]
Get:9 http://security.ubuntu.com breezy-security/main dovecot 0.99.14-1ubuntu1.1 [7742B]
Get:10 http://security.ubuntu.com breezy-security/main postfix 2.2.4-1ubuntu2.1 [911kB]
Fetched 3328kB in 1m41s (32.8kB/s)
Preconfiguring packages ...
Ubuntu Configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Postfix Configuration tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x x
x You have several choices for general configuration at this point. If you have
x your debconf priority set to 'low' or 'medium', you will be asked more questions a
x later. You can always run "dpkg-reconfigure --priority=low postfix" at a later a
x point if you want to see these questions again. a
x a
x No configuration - IF YOU WANT THE INSTALL TO LEAVE YOUR CONFIG ALONE, CHOOSE THIS a
x OPTION. No configuration changes will be done now: If you have not already a
x configured Postfix, your mail system will be broken and should not be used. You a
x must then do the configuration yourself by editing /usr/share/postfix/main.cf.dist a
x and saving your changes as /etc/postfix/main.cf, or by running dpkg-reconfigure a
x Postfix. main.cf will not be modified by the Postfix install process. a
x a
x Internet site - mail is sent and received directly using SMTP. If your needs don't a
x fit neatly into any category, you probably want to start with this one and then a
x edit the config file by hand. a
x a
x Internet site using smarthost - You receive Internet mail on this machine, either a
x directly by SMTP or by running a utility such as fetchmail. Outgoing mail is sent a
x using a smarthost. optionally with addresses rewritten. This is probably what you a
x want for a dialup system. a
x a
x Satellite system - All mail is sent to another machine, called a "smart host" for a
x delivery. root and postmaster mail is delivered according to /etc/aliases. No mail a
x is received locally. a
x a
x
x <Ok>
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Ubuntu Configuration
lqqqqu Postfix Configuration tqqqqqk
x General type of configuration? x
x x
x No configuration x
x Internet Site x
x Internet with smarthost x
x Satellite system x
x Local only x
x x
x x
x <Ok> <Cancel> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Ubuntu Configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Postfix Configuration tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Your `mail name' is the hostname portion of the address to be shown on outgoing x
x news and mail messages (following the username and @ sign). x
x x
x This name will be used by other programs besides Postfix; it should be the single, x
x full domain name (FQDN) from which mail will appear to originate. x
x x
x Mail name? x
x x
x swisspc.info_______________________________________________________________________ x
x x
x <Ok> <Cancel> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Selecting previously deselected package mysql-common.
(Reading database ... 13405 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_4.0.24-10ubuntu2.3_all.deb) ...
Selecting previously deselected package libmysqlclient12.
Unpacking libmysqlclient12 (from .../libmysqlclient12_4.0.24-10ubuntu2.3_i386.deb) ...
Selecting previously deselected package libkrb53.
Unpacking libkrb53 (from .../libkrb53_1.3.6-4ubuntu0.1_i386.deb) ...
Selecting previously deselected package libpq4.
Unpacking libpq4 (from .../libpq4_8.0.3-15ubuntu2.2_i386.deb) ...
Selecting previously deselected package openssl.
Unpacking openssl (from .../openssl_0.9.7g-1ubuntu1.2_i386.deb) ...
Creating directory /etc/ssl
Selecting previously deselected package dovecot-common.
Unpacking dovecot-common (from .../dovecot-common_0.99.14-1ubuntu1.1_i386.deb) ...
Selecting previously deselected package dovecot-imapd.
Unpacking dovecot-imapd (from .../dovecot-imapd_0.99.14-1ubuntu1.1_i386.deb) ...
Selecting previously deselected package dovecot-pop3d.
Unpacking dovecot-pop3d (from .../dovecot-pop3d_0.99.14-1ubuntu1.1_i386.deb) ...
Selecting previously deselected package dovecot.
Unpacking dovecot (from .../dovecot_0.99.14-1ubuntu1.1_all.deb) ...
Selecting previously deselected package postfix.
Unpacking postfix (from .../postfix_2.2.4-1ubuntu2.1_i386.deb) ...
Setting up mysql-common (4.0.24-10ubuntu2.3) ...
Setting up libmysqlclient12 (4.0.24-10ubuntu2.3) ...
Setting up libkrb53 (1.3.6-4ubuntu0.1) ...
Setting up libpq4 (8.0.3-15ubuntu2.2) ...
Setting up openssl (0.9.7g-1ubuntu1.2) ...
Setting up dovecot-common (0.99.14-1ubuntu1.1) ...
Creating generic self-signed certificate: /etc/ssl/certs/dovecot.pem
(replace with hand-crafted or authorized one if needed).
sed: can't read /etc/inetd.conf: No such file or directory
Setting up dovecot-imapd (0.99.14-1ubuntu1.1) ...
sed: can't read /etc/inetd.conf: No such file or directory
Setting up dovecot-pop3d (0.99.14-1ubuntu1.1) ...
sed: can't read /etc/inetd.conf: No such file or directory
Setting up dovecot (0.99.14-1ubuntu1.1) ...
Setting up postfix (2.2.4-1ubuntu2.1) ...
Adding group `postfix' (110)...
Done.
Adding system user `postfix'...
Adding new user `postfix' (104) with group `postfix'.
Not creating home directory.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (111)...
Done.
setting myhostname: localhost.localdomain
setting alias maps
setting alias database
changing /etc/mailname
setting myorigin
setting destinations: swisspc.info, localhost.localdomain, localhost.localdomain, localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Starting Postfix Mail Transport Agent...
...done.
root@skier-ch:~#
先ずは必要そうなモノをインストール
-SMTP-AUTH
# aptitude install postfix-tls libsasl2-modules sasl2-bin courier-imap-ssl
(中略)
以下の新しいパッケージが自動的にインストールされます:
courier-authdaemon courier-base courier-imap courier-ssl fam
libasn1-6-heimdal libdb4.1 libfam0c102 libgssapi1-heimdal
libkrb-1-kerberos4kth libkrb5-17-heimdal libroken16-kerberos4kth
以下の新しいパッケージがインストールされます:
courier-authdaemon courier-base courier-imap courier-imap-ssl courier-ssl
fam libasn1-6-heimdal libdb4.1 libfam0c102 libgssapi1-heimdal
libkrb-1-kerberos4kth libkrb5-17-heimdal libroken16-kerberos4kth
libsasl2-modules postfix-tls sasl2-bin
途中で、webベースで管理するためにディレクトリを作成しますか?って聞いてくるのですが
よくわからないのでNoとしました。
インストールが終わりサクサクっと基本設定とエイリアスの設定を
alias_maps = hash:/etc/postfix:aliases
alias_database = hash:/etc/postfix/aliases
newaliases_path = /usr/bin/newaliases
/etc/postfixに
webmaster: root
形式で書いて
# newaliases
すると
/etc/postfix/aliases.db
ってファイルができてエイリアスが有効になります。
次にSMTP認証をできるように/etc/postfix/main.cfに追加します。
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_auth_destination,
permit_sasl_authenticated,
reject
smtpd_local_domain = $mydomain
smtpd_sasl_security_options = noanonymous, noplaintext
# outlook用
# broken_sasl_auth_client = yes
パスワードを作ります。
# saslpasswd2 -c -u u-o-u.net usename
Password:***********
Again (for verification):***********
# chmod 640 /etc/sasldb
Postfixは、/etc/sasldb2を見に来る事ができないそうなので、
# ln /etc/sasldb2 /var/spool/postfix/etc/sasldb2
# chmod 640 /var/spool/postfix/etc/sasldb2
postfixをsaslグループに追加
# usrmod -G sasl postfix
/etc/postfix/sasl/
にsmtpd.confファイルを作る。
pwcheck_method: sasldb
これで、SMTP-AUTHまではOKなのでここらで、ルーターの設定を変えて外部とつなげます。
で、不正中継のチェック
$ telnet relay-test.mail-abuse.org
(中略)
System appeared to reject relay attempts
Connection closed by foreign host.
OKです。ダメな場合は
System appeared to accept (ダメな数) relay attempts
Connection closed by foreign host.
と、でるそうです。
ここからはSSLへの対応です。
秘密鍵 server.keyを作ります。
# openssl genrsa -out server.key 1024
オレオレ証明書を作ります。
# openssl req -new -x509 -key server.key -out server.crt
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Okayama
Locality Name (eg, city) []:Okayama
Organization Name (eg, company) [Internet Widgits Pty Ltd]:oreore_CA
rganizational Unit Name (eg, section) []:Admin
Common Name (eg, YOUR name) []:CheshireCat
Email Address []:webmaster@u-o-u.net
/etc/postfix/main.cfをsslに対応させます。
### smtp over ssl ###
smtpd_tls_cert_file = /etc/postfix/key/server.crt
smtpd_tls_key_file = /etc/postfix/key/server.key
smtpd_tls_session_cache_database = sdbm:/etc/postfix/ssl/smtpd_scache
smtpd_tls_loglevel = 3
smtpd_use_tls = yes
/etc/postfix/master.cfも対応させます。
tlsmgr fifo - - n 300 1 tlsmgr
smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
のコメントを外します。
これで、SMTP-AUTH over SSLになったはずです。。。
Courier-imap SSL対応
postfixで使った鍵と証明書で
# cat server.key server.crt > /etc/courier/imapd.pem
/etc/courier/imap-sslを
IMAPDSSLSTART=YES
IMAPDSTARTTLS=YES
TLS_CERTFILE=/etc/courier/courier.pem
とするそうなんですが、初めからなってました。
ここで気が付きました。
courier-pop
がインストールされてません。ママさん用に入れておきます。が、外部からはアクセスできません。
# aptitude install courier-pop
root@swisspc:~# apt-get install postfix
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
openssl ssl-cert
提案パッケージ:
ca-certificates procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre
sasl2-bin
推奨パッケージ:
mail-reader resolvconf
以下のパッケージが新たにインストールされます:
openssl postfix ssl-cert
アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 1 個。
1908kB のアーカイブを取得する必要があります。
展開後に追加で 4645kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com dapper/main ssl-cert 1.0.13 [9526B]
取得:2 http://security.ubuntu.com dapper-security/main openssl 0.9.8a-7ubuntu0.3 [976kB]
取得:3 http://security.ubuntu.com dapper-security/main postfix 2.2.10-1ubuntu0.1 [923kB]
9528B を 0s で取得しました (15.7kB/s)
パッケージを事前設定しています ...
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ │ │ You have several choices for general configuration at this point. If you have
│ your debconf priority set to 'low' or 'medium', you will be asked more questions ?? │ later. You can always run "dpkg-reconfigure --priority=low postfix" at a later ?? │ point if you want to see these questions again.
│ <Ok>
│ │ └────────────────────────────────────────────
Ubuntu の設定
┌───────┤ Postfix Configuration ├───────┐
│ General type of configuration? │
│ │
│ 設定しない │
│ インターネットサイト │
│ スマートホスト付きインターネットg │
│ サテライトシステム │
│ ローカルのみ │
│ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────┘
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ `メール名' は、送出されるニュースおよびメールのメッセージ (ユーザ名と @ 記号のあと │ │ に付く) で表示されるアドレスのホスト名部分です。 │ │
未選択パッケージ openssl を選択しています。
(データベースを読み込んでいます... 現在 14121 個のファイルとディレクトリがインストールされています。)
(.../openssl_0.9.8a-7ubuntu0.3_i386.deb から) openssl を展開しています...
Creating directory /etc/ssl
未選択パッケージ ssl-cert を選択しています。
(.../ssl-cert_1.0.13_all.deb から) ssl-cert を展開しています...
未選択パッケージ postfix を選択しています。
(.../postfix_2.2.10-1ubuntu0.1_i386.deb から) postfix を展開しています...
openssl (0.9.8a-7ubuntu0.3) を設定しています ...
ssl-cert (1.0.13) を設定しています ...
postfix (2.2.10-1ubuntu0.1) を設定しています ...
Adding group `postfix' (110)...
Done.
Adding system user `postfix'...
Adding new user `postfix' (104) with group `postfix'.
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (111)...
Done.
setting myhostname: swisspc
setting alias maps
setting alias database
changing /etc/mailname
setting myorigin
setting destinations: swisspcc.info, swisspc, localhost.localdomain, localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Stopping Postfix Mail Transport Agent postfix
...done.
* Starting Postfix Mail Transport Agent postfix
...done.
root@swisspc:~#
root@swisspc:~# apt-get install dovecot-*
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
注意: 正規表現 'dovecot-*' に対して dovecot-imapd を選択しました
注意: 正規表現 'dovecot-*' に対して dovecot-pop3d を選択しました
注意: 正規表現 'dovecot-*' に対して dovecot を選択しました
注意: 正規表現 'dovecot-*' に対して dovecot-common を選択しました
以下の特別パッケージがインストールされます:
dovecot-imapd dovecot-pop3d
以下のパッケージが新たにインストールされます:
dovecot-imapd dovecot-pop3d
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 1 個。
943kB のアーカイブを取得する必要があります。
展開後に追加で 1671kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com dapper-updates/main dovecot-imapd 1.0.beta3-3ubuntu5.3 [486kB]
取得:2 http://jp.archive.ubuntu.com dapper-updates/main dovecot-pop3d 1.0.beta3-3ubuntu5.3 [457kB]
943kB を 0s で取得しました (1132kB/s)
未選択パッケージ dovecot-imapd を選択しています。
(データベースを読み込んでいます... 現在 14747 個のファイルとディレクトリがインストールされています。)
(.../dovecot-imapd_1.0.beta3-3ubuntu5.3_i386.deb から) dovecot-imapd を展開しています...
未選択パッケージ dovecot-pop3d を選択しています。
(.../dovecot-pop3d_1.0.beta3-3ubuntu5.3_i386.deb から) dovecot-pop3d を展開しています...
dovecot-imapd (1.0.beta3-3ubuntu5.3) を設定しています ...
Starting mail server: dovecotWarning: Fixing permissions of /var/run/dovecot to be world-readable
Warning: Corrected permissions for login directory /var/run/dovecot/login
.
dovecot-pop3d (1.0.beta3-3ubuntu5.3) を設定しています ...
Starting mail server: dovecot.
root@swisspc:~# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
^]
telnet> quit
Connection closed.
root@swisspc:~#
終了行:
root@swisspc:~# apt-get install postfix
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
openssl ssl-cert
提案パッケージ:
ca-certificates procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre
sasl2-bin
推奨パッケージ:
mail-reader resolvconf
以下のパッケージが新たにインストールされます:
openssl postfix ssl-cert
アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 1 個。
1908kB のアーカイブを取得する必要があります。
展開後に追加で 4645kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com dapper/main ssl-cert 1.0.13 [9526B]
取得:2 http://security.ubuntu.com dapper-security/main openssl 0.9.8a-7ubuntu0.3 [976kB]
取得:3 http://security.ubuntu.com dapper-security/main postfix 2.2.10-1ubuntu0.1 [923kB]
9528B を 0s で取得しました (16.1kB/s)
パッケージを事前設定しています ...
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ │ │ You have several choices for general configuration at this point. If you have
│ your debconf priority set to 'low' or 'medium', you will be asked more questions ?? │ later. You can always run "dpkg-reconfigure --priority=low postfix" at a later ?? │ point if you want to see these questions again.
│ <Ok>
│ │ └────────────────────────────────────────────
Ubuntu の設定
┌───────┤ Postfix Configuration ├───────┐
│ General type of configuration? │
│ │
│ 設定しない │
│ インターネットサイト │
│ スマートホスト付きインターネット │
│ サテライトシステム │
│ ローカルのみ │
│ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────┘
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ `メール名' は、送出されるニュースおよびメールのメッセージ (ユーザ名と @ 記号のあと │ │ に付く) で表示されるアドレスのホスト名部分です。 │ │
未選択パッケージ openssl を選択しています。
(データベースを読み込んでいます... 現在 14121 個のファイルとディレクトリがインストールされています。)
(.../openssl_0.9.8a-7ubuntu0.3_i386.deb から) openssl を展開しています...
Creating directory /etc/ssl
未選択パッケージ ssl-cert を選択しています。
(.../ssl-cert_1.0.13_all.deb から) ssl-cert を展開しています...
未選択パッケージ postfix を選択しています。
(.../postfix_2.2.10-1ubuntu0.1_i386.deb から) postfix を展開しています...
openssl (0.9.8a-7ubuntu0.3) を設定しています ...
ssl-cert (1.0.13) を設定しています ...
postfix (2.2.10-1ubuntu0.1) を設定しています ...
Adding group `postfix' (110)...
Done.
Adding system user `postfix'...
Adding new user `postfix' (104) with group `postfix'.
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (111)...
Done.
setting myhostname: swisspc
setting alias maps
setting alias database
mailname is not a fully qualified domain name. Not changing /etc/mailname.
setting destinations: swisspc, localhost.localdomain, , localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Stopping Postfix Mail Transport Agent postfix
...done.
* Starting Postfix Mail Transport Agent postfix
...done.
root: swisspc# /etc/aliases
mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: swisspc
swisspc:~# vi /etc/postfix/virtual
skier-ch.info anything
skier@skier-ch.info skier
-基本方針
postfix & courier-imap を使用
外から:
SMTP over SSL(465)
IMAP over SSL(993)
中から:
SMTP(25)
IMAP(143)
POP3(110)
POP3 over SSL(992)
root@skier-ch:~# apt-get install postfix dovecot
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
dovecot-common dovecot-imapd dovecot-pop3d libkrb53 libmysqlclient12 libpq4
mysql-common openssl
Suggested packages:
krb5-doc krb5-user ca-certificates procmail postfix-mysql postfix-pgsql postfix-ldap
postfix-pcre
Recommended packages:
mail-reader resolvconf
The following NEW packages will be installed:
dovecot dovecot-common dovecot-imapd dovecot-pop3d libkrb53 libmysqlclient12 libpq4
mysql-common openssl postfix
0 upgraded, 10 newly installed, 0 to remove and 2 not upgraded.
Need to get 3328kB of archives.
After unpacking 8208kB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://security.ubuntu.com breezy-security/main mysql-common 4.0.24-10ubuntu2.3 [35.0kB]
Get:2 http://security.ubuntu.com breezy-security/main libmysqlclient12 4.0.24-10ubuntu2.3 [292kB]
Get:3 http://security.ubuntu.com breezy-security/main libkrb53 1.3.6-4ubuntu0.1 [329kB]
Get:4 http://security.ubuntu.com breezy-security/main libpq4 8.0.3-15ubuntu2.2 [65.1kB]
Get:5 http://security.ubuntu.com breezy-security/main openssl 0.9.7g-1ubuntu1.2 [904kB]
Get:6 http://security.ubuntu.com breezy-security/main dovecot-common 0.99.14-1ubuntu1.1 [241kB]
Get:7 http://security.ubuntu.com breezy-security/main dovecot-imapd 0.99.14-1ubuntu1.1 [284kB]
Get:8 http://security.ubuntu.com breezy-security/main dovecot-pop3d 0.99.14-1ubuntu1.1 [259kB]
Get:9 http://security.ubuntu.com breezy-security/main dovecot 0.99.14-1ubuntu1.1 [7742B]
Get:10 http://security.ubuntu.com breezy-security/main postfix 2.2.4-1ubuntu2.1 [911kB]
Fetched 3328kB in 1m41s (32.8kB/s)
Preconfiguring packages ...
Ubuntu Configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Postfix Configuration tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x x
x You have several choices for general configuration at this point. If you have
x your debconf priority set to 'low' or 'medium', you will be asked more questions a
x later. You can always run "dpkg-reconfigure --priority=low postfix" at a later a
x point if you want to see these questions again. a
x a
x No configuration - IF YOU WANT THE INSTALL TO LEAVE YOUR CONFIG ALONE, CHOOSE THIS a
x OPTION. No configuration changes will be done now: If you have not already a
x configured Postfix, your mail system will be broken and should not be used. You a
x must then do the configuration yourself by editing /usr/share/postfix/main.cf.dist a
x and saving your changes as /etc/postfix/main.cf, or by running dpkg-reconfigure a
x Postfix. main.cf will not be modified by the Postfix install process. a
x a
x Internet site - mail is sent and received directly using SMTP. If your needs don't a
x fit neatly into any category, you probably want to start with this one and then a
x edit the config file by hand. a
x a
x Internet site using smarthost - You receive Internet mail on this machine, either a
x directly by SMTP or by running a utility such as fetchmail. Outgoing mail is sent a
x using a smarthost. optionally with addresses rewritten. This is probably what you a
x want for a dialup system. a
x a
x Satellite system - All mail is sent to another machine, called a "smart host" for a
x delivery. root and postmaster mail is delivered according to /etc/aliases. No mail a
x is received locally. a
x a
x
x <Ok>
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Ubuntu Configuration
lqqqqu Postfix Configuration tqqqqqk
x General type of configuration? x
x x
x No configuration x
x Internet Site x
x Internet with smarthost x
x Satellite system x
x Local only x
x x
x x
x <Ok> <Cancel> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Ubuntu Configuration
lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu Postfix Configuration tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Your `mail name' is the hostname portion of the address to be shown on outgoing x
x news and mail messages (following the username and @ sign). x
x x
x This name will be used by other programs besides Postfix; it should be the single, x
x full domain name (FQDN) from which mail will appear to originate. x
x x
x Mail name? x
x x
x swisspc.info_______________________________________________________________________ x
x x
x <Ok> <Cancel> x
x x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Selecting previously deselected package mysql-common.
(Reading database ... 13405 files and directories currently installed.)
Unpacking mysql-common (from .../mysql-common_4.0.24-10ubuntu2.3_all.deb) ...
Selecting previously deselected package libmysqlclient12.
Unpacking libmysqlclient12 (from .../libmysqlclient12_4.0.24-10ubuntu2.3_i386.deb) ...
Selecting previously deselected package libkrb53.
Unpacking libkrb53 (from .../libkrb53_1.3.6-4ubuntu0.1_i386.deb) ...
Selecting previously deselected package libpq4.
Unpacking libpq4 (from .../libpq4_8.0.3-15ubuntu2.2_i386.deb) ...
Selecting previously deselected package openssl.
Unpacking openssl (from .../openssl_0.9.7g-1ubuntu1.2_i386.deb) ...
Creating directory /etc/ssl
Selecting previously deselected package dovecot-common.
Unpacking dovecot-common (from .../dovecot-common_0.99.14-1ubuntu1.1_i386.deb) ...
Selecting previously deselected package dovecot-imapd.
Unpacking dovecot-imapd (from .../dovecot-imapd_0.99.14-1ubuntu1.1_i386.deb) ...
Selecting previously deselected package dovecot-pop3d.
Unpacking dovecot-pop3d (from .../dovecot-pop3d_0.99.14-1ubuntu1.1_i386.deb) ...
Selecting previously deselected package dovecot.
Unpacking dovecot (from .../dovecot_0.99.14-1ubuntu1.1_all.deb) ...
Selecting previously deselected package postfix.
Unpacking postfix (from .../postfix_2.2.4-1ubuntu2.1_i386.deb) ...
Setting up mysql-common (4.0.24-10ubuntu2.3) ...
Setting up libmysqlclient12 (4.0.24-10ubuntu2.3) ...
Setting up libkrb53 (1.3.6-4ubuntu0.1) ...
Setting up libpq4 (8.0.3-15ubuntu2.2) ...
Setting up openssl (0.9.7g-1ubuntu1.2) ...
Setting up dovecot-common (0.99.14-1ubuntu1.1) ...
Creating generic self-signed certificate: /etc/ssl/certs/dovecot.pem
(replace with hand-crafted or authorized one if needed).
sed: can't read /etc/inetd.conf: No such file or directory
Setting up dovecot-imapd (0.99.14-1ubuntu1.1) ...
sed: can't read /etc/inetd.conf: No such file or directory
Setting up dovecot-pop3d (0.99.14-1ubuntu1.1) ...
sed: can't read /etc/inetd.conf: No such file or directory
Setting up dovecot (0.99.14-1ubuntu1.1) ...
Setting up postfix (2.2.4-1ubuntu2.1) ...
Adding group `postfix' (110)...
Done.
Adding system user `postfix'...
Adding new user `postfix' (104) with group `postfix'.
Not creating home directory.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (111)...
Done.
setting myhostname: localhost.localdomain
setting alias maps
setting alias database
changing /etc/mailname
setting myorigin
setting destinations: swisspc.info, localhost.localdomain, localhost.localdomain, localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Starting Postfix Mail Transport Agent...
...done.
root@skier-ch:~#
先ずは必要そうなモノをインストール
-SMTP-AUTH
# aptitude install postfix-tls libsasl2-modules sasl2-bin courier-imap-ssl
(中略)
以下の新しいパッケージが自動的にインストールされます:
courier-authdaemon courier-base courier-imap courier-ssl fam
libasn1-6-heimdal libdb4.1 libfam0c102 libgssapi1-heimdal
libkrb-1-kerberos4kth libkrb5-17-heimdal libroken16-kerberos4kth
以下の新しいパッケージがインストールされます:
courier-authdaemon courier-base courier-imap courier-imap-ssl courier-ssl
fam libasn1-6-heimdal libdb4.1 libfam0c102 libgssapi1-heimdal
libkrb-1-kerberos4kth libkrb5-17-heimdal libroken16-kerberos4kth
libsasl2-modules postfix-tls sasl2-bin
途中で、webベースで管理するためにディレクトリを作成しますか?って聞いてくるのですが
よくわからないのでNoとしました。
インストールが終わりサクサクっと基本設定とエイリアスの設定を
alias_maps = hash:/etc/postfix:aliases
alias_database = hash:/etc/postfix/aliases
newaliases_path = /usr/bin/newaliases
/etc/postfixに
webmaster: root
形式で書いて
# newaliases
すると
/etc/postfix/aliases.db
ってファイルができてエイリアスが有効になります。
次にSMTP認証をできるように/etc/postfix/main.cfに追加します。
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions =
permit_mynetworks,
permit_auth_destination,
permit_sasl_authenticated,
reject
smtpd_local_domain = $mydomain
smtpd_sasl_security_options = noanonymous, noplaintext
# outlook用
# broken_sasl_auth_client = yes
パスワードを作ります。
# saslpasswd2 -c -u u-o-u.net usename
Password:***********
Again (for verification):***********
# chmod 640 /etc/sasldb
Postfixは、/etc/sasldb2を見に来る事ができないそうなので、
# ln /etc/sasldb2 /var/spool/postfix/etc/sasldb2
# chmod 640 /var/spool/postfix/etc/sasldb2
postfixをsaslグループに追加
# usrmod -G sasl postfix
/etc/postfix/sasl/
にsmtpd.confファイルを作る。
pwcheck_method: sasldb
これで、SMTP-AUTHまではOKなのでここらで、ルーターの設定を変えて外部とつなげます。
で、不正中継のチェック
$ telnet relay-test.mail-abuse.org
(中略)
System appeared to reject relay attempts
Connection closed by foreign host.
OKです。ダメな場合は
System appeared to accept (ダメな数) relay attempts
Connection closed by foreign host.
と、でるそうです。
ここからはSSLへの対応です。
秘密鍵 server.keyを作ります。
# openssl genrsa -out server.key 1024
オレオレ証明書を作ります。
# openssl req -new -x509 -key server.key -out server.crt
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Okayama
Locality Name (eg, city) []:Okayama
Organization Name (eg, company) [Internet Widgits Pty Ltd]:oreore_CA
rganizational Unit Name (eg, section) []:Admin
Common Name (eg, YOUR name) []:CheshireCat
Email Address []:webmaster@u-o-u.net
/etc/postfix/main.cfをsslに対応させます。
### smtp over ssl ###
smtpd_tls_cert_file = /etc/postfix/key/server.crt
smtpd_tls_key_file = /etc/postfix/key/server.key
smtpd_tls_session_cache_database = sdbm:/etc/postfix/ssl/smtpd_scache
smtpd_tls_loglevel = 3
smtpd_use_tls = yes
/etc/postfix/master.cfも対応させます。
tlsmgr fifo - - n 300 1 tlsmgr
smtps inet n - n - - smtpd -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
のコメントを外します。
これで、SMTP-AUTH over SSLになったはずです。。。
Courier-imap SSL対応
postfixで使った鍵と証明書で
# cat server.key server.crt > /etc/courier/imapd.pem
/etc/courier/imap-sslを
IMAPDSSLSTART=YES
IMAPDSTARTTLS=YES
TLS_CERTFILE=/etc/courier/courier.pem
とするそうなんですが、初めからなってました。
ここで気が付きました。
courier-pop
がインストールされてません。ママさん用に入れておきます。が、外部からはアクセスできません。
# aptitude install courier-pop
root@swisspc:~# apt-get install postfix
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
openssl ssl-cert
提案パッケージ:
ca-certificates procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre
sasl2-bin
推奨パッケージ:
mail-reader resolvconf
以下のパッケージが新たにインストールされます:
openssl postfix ssl-cert
アップグレード: 0 個、新規インストール: 3 個、削除: 0 個、保留: 1 個。
1908kB のアーカイブを取得する必要があります。
展開後に追加で 4645kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com dapper/main ssl-cert 1.0.13 [9526B]
取得:2 http://security.ubuntu.com dapper-security/main openssl 0.9.8a-7ubuntu0.3 [976kB]
取得:3 http://security.ubuntu.com dapper-security/main postfix 2.2.10-1ubuntu0.1 [923kB]
9528B を 0s で取得しました (15.7kB/s)
パッケージを事前設定しています ...
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ │ │ You have several choices for general configuration at this point. If you have
│ your debconf priority set to 'low' or 'medium', you will be asked more questions ?? │ later. You can always run "dpkg-reconfigure --priority=low postfix" at a later ?? │ point if you want to see these questions again.
│ <Ok>
│ │ └────────────────────────────────────────────
Ubuntu の設定
┌───────┤ Postfix Configuration ├───────┐
│ General type of configuration? │
│ │
│ 設定しない │
│ インターネットサイト │
│ スマートホスト付きインターネットg │
│ サテライトシステム │
│ ローカルのみ │
│ │
│ │
│ <Ok> <Cancel> │
│ │
└───────────────────────────────────────┘
Ubuntu の設定
┌──────────────────────────────┤ Postfix Configuration ├
│ `メール名' は、送出されるニュースおよびメールのメッセージ (ユーザ名と @ 記号のあと │ │ に付く) で表示されるアドレスのホスト名部分です。 │ │
未選択パッケージ openssl を選択しています。
(データベースを読み込んでいます... 現在 14121 個のファイルとディレクトリがインストールされています。)
(.../openssl_0.9.8a-7ubuntu0.3_i386.deb から) openssl を展開しています...
Creating directory /etc/ssl
未選択パッケージ ssl-cert を選択しています。
(.../ssl-cert_1.0.13_all.deb から) ssl-cert を展開しています...
未選択パッケージ postfix を選択しています。
(.../postfix_2.2.10-1ubuntu0.1_i386.deb から) postfix を展開しています...
openssl (0.9.8a-7ubuntu0.3) を設定しています ...
ssl-cert (1.0.13) を設定しています ...
postfix (2.2.10-1ubuntu0.1) を設定しています ...
Adding group `postfix' (110)...
Done.
Adding system user `postfix'...
Adding new user `postfix' (104) with group `postfix'.
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (111)...
Done.
setting myhostname: swisspc
setting alias maps
setting alias database
changing /etc/mailname
setting myorigin
setting destinations: swisspcc.info, swisspc, localhost.localdomain, localhost
setting relayhost:
setting mynetworks: 127.0.0.0/8
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
Postfix is now set up with a default configuration. If you need to make
changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).
After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
Running newaliases
* Stopping Postfix Mail Transport Agent postfix
...done.
* Starting Postfix Mail Transport Agent postfix
...done.
root@swisspc:~#
root@swisspc:~# apt-get install dovecot-*
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています... 完了
注意: 正規表現 'dovecot-*' に対して dovecot-imapd を選択しました
注意: 正規表現 'dovecot-*' に対して dovecot-pop3d を選択しました
注意: 正規表現 'dovecot-*' に対して dovecot を選択しました
注意: 正規表現 'dovecot-*' に対して dovecot-common を選択しました
以下の特別パッケージがインストールされます:
dovecot-imapd dovecot-pop3d
以下のパッケージが新たにインストールされます:
dovecot-imapd dovecot-pop3d
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 1 個。
943kB のアーカイブを取得する必要があります。
展開後に追加で 1671kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com dapper-updates/main dovecot-imapd 1.0.beta3-3ubuntu5.3 [486kB]
取得:2 http://jp.archive.ubuntu.com dapper-updates/main dovecot-pop3d 1.0.beta3-3ubuntu5.3 [457kB]
943kB を 0s で取得しました (1132kB/s)
未選択パッケージ dovecot-imapd を選択しています。
(データベースを読み込んでいます... 現在 14747 個のファイルとディレクトリがインストールされています。)
(.../dovecot-imapd_1.0.beta3-3ubuntu5.3_i386.deb から) dovecot-imapd を展開しています...
未選択パッケージ dovecot-pop3d を選択しています。
(.../dovecot-pop3d_1.0.beta3-3ubuntu5.3_i386.deb から) dovecot-pop3d を展開しています...
dovecot-imapd (1.0.beta3-3ubuntu5.3) を設定しています ...
Starting mail server: dovecotWarning: Fixing permissions of /var/run/dovecot to be world-readable
Warning: Corrected permissions for login directory /var/run/dovecot/login
.
dovecot-pop3d (1.0.beta3-3ubuntu5.3) を設定しています ...
Starting mail server: dovecot.
root@swisspc:~# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
^]
telnet> quit
Connection closed.
root@swisspc:~#
ページ名: