内容へ移動
fl8 Wiki
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
現在位置:
Dokuwiki.fl8.jp
»
01_linux
»
03_mail
»
Postfix - OP25B環境でFQDNを持たないホストからメールを投げる方法(SMTPリレー)
トレース:
01_linux:03_mail:postfix_op25b環境でfqdnを持たないホストからメールを投げる方法
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== Postfix - OP25B環境でFQDNを持たないホストからメールを投げる方法(SMTPリレー) ====== LAN内でFreeBSD/Linux鯖を動かし、ジャーナルやアラートをインタネットメールで \\ 投げたい事ってありますよね。 昔は第三者中継なんて気にしてなかったので深く考えないでメールが出せました。 \\ 今は25/tcpのパケットを外に出すことすら難しく、FQDNが正しくセットされていな \\ い計算機からのメールを受け取ってくれる奇特なsmtpサーバは皆無です。 postfixはsmtp-auth(smtp認証)のクライアントになってメールを特定の中継smtp \\ サーバに投げつけてくれる機能がありました。 smtp-auth(smtp認証)がサポートされているsmtpサーバにsmtp-authでアクセスす るために ===== Transportのサーバ側 ===== <color #ed1c24>※サーバ側は、色んなクライアントいるし「smtpd_tls_security_level=may」が良いかも</color> smtpd_tls_security_level=encript だとTLSを強制。 smtpd_tls_security_level=may だとTLSが使える場合だけ使う。 ^値^意味^ |may|may を指定した場合は TLS は必須ではなく、TLS を使用するかどうかはクライアント側で決められます。 \\ そのため TLS に対応していないクライアントからの非暗号化の SMTP 通信も許可されます。 \\ こちらが一般的な設定になります。| |encrypt|encrypt は TLS が必須となり、TLS に対応していないクライアントからのメッセージは受け取りません。 \\ そのため機密情報などをやり取りするような、高いセキュリティレベルが求められる特別な MTA にのみ設定します。 | <code|/etc/postfix/master.cf> submission inet n - n - - smtpd -o smtpd_tls_security_level=may -o smtpd_sasl_auth_enable=yes -o smtpd_client_restrictions=permit_sasl_authenticated,reject -o milter_macro_daemon_name=ORIGINATING </code> ====== インストール ====== # yum -y install postfix ====== smtp認証ファイル用意 ====== hostname:port username:password # vi /etc/postfix/relay_password mail.flat8.co.jp:587 hogehoge:xxhoge ====== transportファイル用意 ====== # vi /etc/postfix/transport * smtp:dns.flat8.co.jp:587 ====== hashDB化 ====== # postmap /etc/postfix/relay_password # postmap /etc/postfix/transport === hashDB化したファイルを見るには === <code console> # strings /etc/postfix/transport.db smtp:dns.flat8.co.jp:587 </code> ====== main.cfに下記追加 ====== # vi /etc/postfix/main.cf smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/relay_password smtp_sasl_security_options = noanonymous transport_maps = hash:/etc/postfix/transport smtp_tls_CApath = /etc/ssl/certs smtp_tls_security_level=may smtp_tls_loglevel = 1 ===== Untrusted TLS ===== これは暗号化自体はされているけど、transportクライアントのOS側にLet's EncryptのCA証明書が入ってないから ※最近のブラウザは、Let's EncryptのCA証明書が入ってる。 <code> Apr 20 12:11:48 adm3004 postfix/smtp[23618]: setting up TLS connection to relay.hogehoge.com[xxx.xxx.72.82]:587 Apr 20 12:11:48 adm3004 postfix/smtp[23618]: certificate verification failed for relay.hogehoge.com[xxx.xxx.72.82]:587: untrusted issuer /O=Digital Signature Trust Co./CN=DST Root CA X3 Apr 20 12:11:48 adm3004 postfix/smtp[23618]: Untrusted TLS connection established to relay.hogehoge.com[xxx.xxx.72.82]:587: TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits) </code> /etc/ssl/certs以下にLet's EncryptのCS証明書を置いておく。 * ISRG Root X1 (self-signed) * Let’s Encrypt Authority X3 (IdenTrust cross-signed) * Let’s Encrypt Authority X3 (Signed by ISRG Root X1) <code> cd /etc/ssl/certs wget https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem.txt wget https://letsencrypt.org/certs/isrgrootx1.pem.txt wget https://letsencrypt.org/certs/letsencryptauthorityx3.pem.txt </code> ====== postfixをreload ====== # /usr/sbin/postfix reload ====== logwatchの送り先変更 ====== [[01_linux:01_net:logwatchの設定|]] ===== CentOS 6 の場合 ===== 下記のエラーが出て送信できない <code> SASL authentication failure: No worthy mechs found SASL authentication failed; cannot authenticate to server mail.flat8.co.j </code> === 対応方法 === 下記のライブラリをインストールしてあげると上手くい <code console> # yum install cyrus-sasl-md5 </code> [[https://smtps.jp/docs/integrate/si/postfix/index.html]] [[https://linux-svr.com/SSL%E8%A8%BC%E6%98%8E%E6%9B%B8/41.php]] {{tag>postfix mail transport}}
01_linux/03_mail/postfix_op25b環境でfqdnを持たないホストからメールを投げる方法.txt
· 最終更新: 2019/04/21 12:28 by
matsui
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ