このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
01_linux:03_mail:postfix_virtual [2014/10/30 00:19] – [postfixインストール] matsui | 01_linux:03_mail:postfix_virtual [2014/10/30 00:49] (現在) – matsui | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== Postfix Virtual Dovecot ====== | ||
+ | 単純なpostfixでバーチャルドメインの設定 | ||
+ | |||
+ | ====== postfixインストール ====== | ||
+ | <code console> | ||
+ | # yum install postfix dovecot | ||
+ | </ | ||
+ | |||
+ | |||
+ | <code console> | ||
+ | # cat / | ||
+ | |||
+ | queue_directory = / | ||
+ | command_directory = /usr/sbin | ||
+ | daemon_directory = / | ||
+ | mail_owner = postfix | ||
+ | myhostname = example.com | ||
+ | mydomain = example.com | ||
+ | myorigin = $mydomain | ||
+ | inet_interfaces = all | ||
+ | mydestination = $myhostname, | ||
+ | unknown_local_recipient_reject_code = 550 | ||
+ | mynetworks = 127.0.0.0/8 | ||
+ | alias_maps = hash:/ | ||
+ | alias_database = hash:/ | ||
+ | home_mailbox = Maildir/ | ||
+ | smtpd_banner = $myhostname ESMTP unknown | ||
+ | debug_peer_level = 2 | ||
+ | debugger_command = | ||
+ | | ||
+ | xxgdb $daemon_directory/ | ||
+ | sendmail_path = / | ||
+ | newaliases_path = / | ||
+ | mailq_path = / | ||
+ | setgid_group = postdrop | ||
+ | html_directory = no | ||
+ | manpage_directory = / | ||
+ | sample_directory = / | ||
+ | readme_directory = / | ||
+ | smtpd_sasl_auth_enable = yes | ||
+ | smtpd_sasl_type = dovecot | ||
+ | smtpd_sasl_path = private/ | ||
+ | smtpd_sasl_local_domain = $myhostname | ||
+ | smtpd_client_restrictions = | ||
+ | | ||
+ | | ||
+ | | ||
+ | smtpd_sender_restrictions = | ||
+ | | ||
+ | | ||
+ | | ||
+ | smtpd_recipient_restrictions = | ||
+ | | ||
+ | | ||
+ | # | ||
+ | | ||
+ | | ||
+ | | ||
+ | virtual_alias_maps= hash:/ | ||
+ | </ | ||
+ | |||
+ | ====== Dovecotインストール ====== | ||
+ | <box 70% left round orange> | ||
+ | # cat / | ||
+ | | ||
+ | mail_location = maildir: | ||
+ | protocols = imap imaps pop3 pop3s | ||
+ | protocol imap { | ||
+ | } | ||
+ | | ||
+ | protocol pop3 { | ||
+ | } | ||
+ | protocol lda { | ||
+ | postmaster_address = postmaster@example.com | ||
+ | } | ||
+ | auth default { | ||
+ | mechanisms = plain | ||
+ | passdb pam { | ||
+ | } | ||
+ | userdb passwd { | ||
+ | } | ||
+ | | ||
+ | client { | ||
+ | path = / | ||
+ | mode = 0660 | ||
+ | user = postfix | ||
+ | group = postfix | ||
+ | } | ||
+ | } | ||
+ | user = root | ||
+ | } | ||
+ | dict { | ||
+ | } | ||
+ | plugin { | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====== ヴァーチャルファイル作成 ====== | ||
+ | <box 70% left round orange> | ||
+ | # vi / | ||
+ | admin@aaaa.com | ||
+ | \\ | ||
+ | # postmap / | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== mailの送信元アドレスにホスト名が入る ===== | ||
+ | |||
+ | mailコマンドを使ってメールを送信すると送信元アドレスが [アカウント]@[ホスト].[ドメイン] となってしまう。 | ||
+ | |||
+ | 本当はmailコマンドで送った時、[アカウント]@[ドメイン]となって欲しい | ||
+ | main.cfでは、myorigin をちゃんと$mydomainを指定している。 | ||
+ | |||
+ | <code console> | ||
+ | # cat / | ||
+ | myorigin = $mydomain | ||
+ | </ | ||
+ | |||
+ | === 原因 === | ||
+ | mailコマンドが使用するmta設定がsendmailのままとなっていると、@以下に/ | ||
+ | |||
+ | # ls -l / | ||
+ | lrwxrwxrwx 1 root root 26 Oct 30 09:38 / | ||
+ | |||
+ | |||
+ | === 対応方法 === | ||
+ | |||
+ | 下記のコマンドで、MTAを切り替えてあげればOK | ||
+ | これで、ただしく@以下がmyorigin で送信されます。 | ||
+ | |||
+ | <code console> | ||
+ | # alternatives --config mta | ||
+ | 2 プログラムがあり ' | ||
+ | 選択 | ||
+ | ----------------------------------------------- | ||
+ | *+ 1 / | ||
+ | | ||
+ | Enter to keep the current selection[+], | ||
+ | </ | ||
+ | |||
+ | <code console> | ||
+ | # ls -l / | ||
+ | lrwxrwxrwx 1 root root 26 Oct 30 09:38 / | ||
+ | </ |