内容へ移動
ほげぴよwiki
ユーザ用ツール
ログイン
サイト用ツール
検索
ツール
文書の表示
以前のリビジョン
バックリンク
最近の変更
メディアマネージャー
サイトマップ
ログイン
>
最近の変更
メディアマネージャー
サイトマップ
トレース:
ubuntu-server-18-04:postfix
この文書は読取専用です。文書のソースを閲覧することは可能ですが、変更はできません。もし変更したい場合は管理者に連絡してください。
====== Postfix のインストール ====== SSH のログイン時にメールでアラートを飛ばしたいので、メールを送信するだけの目的で Postfix をインストールする。 ==== インストール環境 ==== * Ubuntu 18.04.3 LTS 64bit * お名前.com VPS (KVM) 1GB プラン ^ パッケージ名 ^ バージョン ^ | postfix | 3.3.0-1ubuntu0.2 | ===== インストール ===== 必要なパッケージをインストールする。インストール中の設定について質問されるが、エンターキーを押してデフォルトをとりあえず設定する。 <code> $ sudo apt install postfix </code> ===== 設定 ===== ==== 基本設定 ==== 以下のコマンドで Postfix を設定するダイアログを起動する。 <code> $ sudo dpkg-reconfigure postfix </code> * General type of mail configuration: Internet Site * System mail name: hogepiyo.com * Root and postmaster mail recipient: john #管理者ユーザー名# * Other destinations to accept mail for (blank for none): hogepiyo.com, localhost.localdomain, localhost * Force synchronous updates on mail queue?: No * Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 * Mailbox size limit (bytes): 0 * Local address extension character: + * Internet protocols to use: all ==== メールボックス形式の設定 ==== Postfix の設定は /etc/postfix/main.cf を直接編集するか、設定用のコマンドを使う。 メールボックス形式をデフォルトの mbox から Maildir に変更する。 <code> $ sudo postconf -e 'home_mailbox = Maildir/' </code> ==== メール送信テスト ==== 外部のメールアドレスにテストメールを送信して送信を確認する。 <code> $ echo "Subject: sendmail test" | sendmail -v example@gmail.com </code> ==== TLS でメールを暗号化して送信する ==== 特に重要ではないと思うが、メールを暗号化して送信したい場合は [[certbot]] で証明書を取得した後、以下のコマンドを実行する。 <code> $ sudo postconf -e 'smtpd_tls_cert_file = /etc/letsencrypt/live/example.com/fullchain.pem' $ sudo postconf -e 'smtpd_tls_key_file = /etc/letsencrypt/live/example.com/privkey.pem' $ sudo postconf -e 'smtp_tls_security_level = may' $ sudo postconf -e 'smtpd_tls_security_level = may' $ sudo postconf -e 'smtp_tls_note_starttls_offer = yes' $ sudo postconf -e 'smtpd_tls_loglevel = 1' $ sudo postconf -e 'smtpd_tls_received_header = yes' </code> ===== 参考 ===== [[https://help.ubuntu.com/lts/serverguide/postfix.html|公式ドキュメント Postfix]]
ubuntu-server-18-04/postfix.txt
· 最終更新: 2020/04/10 14:45 by
admin
ページ用ツール
文書の表示
以前のリビジョン
バックリンク
文書の先頭へ