0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

postfix で DKIM の実装をしてみる

Posted at

対象とか

目的

上記の記事では sendmail を調理しました
今回は postfix で簡単便利に仕上げてみますw

っま、殆ど大差ないけん差異だけ書いとくけん、読みにくさはご勘弁m(__)m

mail/postfix のインスコ

ports skeleton からインスコの場合
cd /usr/ports/mail/postfix && make install && make clean
バイナリ pkg(8) からインスコの場合
pkg install postfix

パイプの作成場所の元ディレクトリに所有者とグループを標準のアカウントに変更ってトコが、postfix 用にオーナーを変えておく必要があるが、逆に postfix 側の実行権限を変えても良き🥰

この例じゃと postfix に寄せてるw
mkdir /var/run/milteropendkim && chown postfix:postfix /var/run/milteropendkim/opendkim.pipe
sysrc milteropendkim_gid=postfix
sysrc milteropendkim_uid=postfix
  • main.cf 書き換えるよ~✌
/usr/local/etc/postfix/main.cf
smtpd_milters = unix:/var/run/milteropendkim/opendkim.pipe
non_smtpd_milters = $smtpd_milters
milter_default_action = accept

あ、コレ、追記しんちゃい。

  • daemon の起動許可及び起動
    postfix も働かせよう
service postfix enable
service postfix start

当然じゃが、main.cf の基本的な設定は済ませんちゃいな(下記に雛型乗せとく)

ログの確認方法

正常時起動ログ
*日付* *ホスト名(短縮)* opendkim[PID]: OpenDKIM Filter v2.10.3 starting (args: -l -u postfix -P /var/run/milteropendkim/pid -x /usr/local/etc/mail/opendkim.conf)

-u の引数が milteropendkim_uid の内容となっていれば◎

postfix の main.cf 雛型?

postconf -n 実行結果
alias_database = hash:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
command_directory = /usr/local/sbin
compatibility_level = 3.9
daemon_directory = /usr/local/libexec/postfix
data_directory = /var/db/postfix
debug_peer_level = 2
home_mailbox = Maildir/
html_directory = /usr/local/share/doc/postfix
inet_protocols = ipv6
mail_owner = postfix
mailq_path = /usr/local/bin/mailq
manpage_directory = /usr/local/share/man
meta_directory = /usr/local/libexec/postfix
milter_default_action = accept
mydomain = *ホスト名*
mynetworks = [::1]/128 [2001:db8::]/48
mynetworks_style = host
newaliases_path = /usr/local/bin/newaliases
non_smtpd_milters = $smtpd_milters
queue_directory = /var/spool/postfix
readme_directory = /usr/local/share/doc/postfix
sample_directory = /usr/local/etc/postfix
sendmail_path = /usr/local/sbin/sendmail
setgid_group = maildrop
shlib_directory = /usr/local/lib/postfix
smtp_tls_CApath = /etc/ssl/certs
smtpd_milters = unix:/var/run/milteropendkim/opendkim.pipe
smtpd_tls_CAfile = /usr/local/share/certs/ca-root-nss.crt
smtpd_tls_auth_only = no
smtpd_tls_cert_file = /usr/local/etc/dehydrated/certs/*dehydratedで作ったディレクトリ名*/fullchain.pem
smtpd_tls_key_file = /usr/local/etc/dehydrated/certs/*dehydratedで作ったディレクトリ名*/privkey.pem
smtpd_tls_loglevel = 1
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = /var/db/postfix/smtpd_scache
unknown_local_recipient_reject_code = 550

誰かの役にたてたらいいな

時が経て記事の鮮度が落ちた時には是非追試記事を書いてみてください

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?