利用していないドメインのメールに関するDNS設定を確認するシェルスクリプトです。
A POSIX shell script for checking DNS settings related to email on unused domains.
以下の設定となっているかを確認します。
- SPF:
v=spf1 -all(送信元サーバーなし) - DMARC:
p=reject(認証失敗メールを拒否) - Null MX:
MX 0 .(メール受信不可) - DNSSEC(DNSSEC署名の有無)
次のようなドメインを想定しています。
- メール送受信を行わないドメイン
- 将来利用する可能性があるため維持しているドメイン
- サービス終了後も所有を継続しているドメイン
- ブランド保護のため保持しているドメイン
- POSIX準拠シェル (
/bin/sh) dig
./unused-domain-check.sh example.com想定する設定の場合
========================================
unused-domain-check 0.1.0
Domain : example.com
========================================
[SPF]
INFO v=spf1 -all
PASS Policy: -all
[DMARC]
INFO v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s
PASS Policy: reject
PASS Subdomain policy: reject
PASS DKIM alignment: strict
PASS SPF alignment: strict
[MX]
PASS Null MX detected (0 .)
[DNSSEC]
INFO DNSSEC signatures detected
========================================
Overall Result
========================================
PASS Recommended configuration detected
想定する設定ではない場合
========================================
unused-domain-check 0.1.0
Domain : example.com
========================================
[SPF]
INFO v=spf1 ~all
WARN Expected: v=spf1 -all
[DMARC]
INFO v=DMARC1; p=none
WARN Expected: p=reject
WARN Expected: sp=reject
WARN Expected: adkim=s
WARN Expected: aspf=s
[MX]
WARN Mail exchanger(s) configured:
10 mail.example.com.
INFO Expected: 0 .
[DNSSEC]
INFO DNSSEC not detected
========================================
Overall Result
========================================
CHECK Recommended configuration not detected
Review WARN/FAIL messages above
| 終了コード | 意味 |
|---|---|
| 0 | 想定する設定となっています |
| 1 | 想定する設定と異なる設定があります |
| 64 | 引数が正しくありません |
-
RFC 7208 - Sender Policy Framework (SPF) https://www.rfc-editor.org/rfc/rfc7208
-
RFC 7489 - Domain-based Message Authentication, Reporting, and Conformance (DMARC) https://www.rfc-editor.org/rfc/rfc7489
-
RFC 7505 - A "Null MX" No Service Resource Record for Domains That Accept No Mail https://www.rfc-editor.org/rfc/rfc7505
-
RFC 4033 - DNS Security Introduction and Requirements https://www.rfc-editor.org/rfc/rfc4033
MIT License