このページの翻訳:
- 日本語 (ja)
- English (en)
最近の更新
- 02 Apache2で自己認証ssl [中間証明書の整合性確認]
最近の更新
単純なpostfixでバーチャルドメインの設定
# yum install postfix dovecot
# cat /etc/postfix/main.cf queue_directory = /var/spool/postfix command_directory = /usr/sbin daemon_directory = /usr/libexec/postfix mail_owner = postfix myhostname = example.com mydomain = example.com myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain unknown_local_recipient_reject_code = 550 mynetworks = 127.0.0.0/8 alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases home_mailbox = Maildir/ smtpd_banner = $myhostname ESMTP unknown debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin xxgdb $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.3.3/samples readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES smtpd_sasl_auth_enable = yes smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_local_domain = $myhostname smtpd_client_restrictions = reject_rbl_client spamcop.net, reject_rbl_client dynablock.wirehub.net, permit smtpd_sender_restrictions = reject_non_fqdn_sender, reject_unknown_sender_domain, permit smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, #check_client_access hash:/etc/postfix/pop-before-smtp, reject_unlisted_recipient, reject_non_fqdn_recipient, reject_unauth_destination virtual_alias_maps= hash:/etc/postfix/virtual
# cat /etc/dovecot.conf mail_location = maildir:~/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 { } socket listen { client { path = /var/spool/postfix/private/auth mode = 0660 user = postfix group = postfix } } user = root } dict { } plugin { }
mailコマンドを使ってメールを送信すると送信元アドレスが [アカウント]@[ホスト].[ドメイン] となってしまう。
本当はmailコマンドで送った時、[アカウント]@[ドメイン]となって欲しい
main.cfでは、myorigin をちゃんと$mydomainを指定している。
# cat /etc/postfix/main.cf myorigin = $mydomain
mailコマンドが使用するmta設定がsendmailのままとなっていると、@以下に/etc/sysconf/networkのHOSTNAMEを使用する仕様
# ls -l /etc/alternatives/mta
lrwxrwxrwx 1 root root 26 Oct 30 09:38 /etc/alternatives/mta → /usr/sbin/sendmail.postfix
下記のコマンドで、MTAを切り替えてあげればOK
これで、ただしく@以下がmyorigin で送信されます。
# alternatives --config mta 2 プログラムがあり 'mta' を提供します。 選択 コマンド ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enter to keep the current selection[+], or type selection number:
# ls -l /etc/alternatives/mta lrwxrwxrwx 1 root root 26 Oct 30 09:38 /etc/alternatives/mta -> /usr/sbin/sendmail.postfix