Upgrade to Pro — share decks privately, control downloads, hide ads and more …

DNSルックアップの回数制限でハマった話

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

 DNSルックアップの回数制限でハマった話

Avatar for Ken Kato

Ken Kato

July 16, 2024
Tweet

More Decks by Ken Kato

Other Decks in Technology

Transcript

  1. © 2024 Wantedly, Inc. DNSルックアップの回数制限とは? DNSルックアップ:DNSを使用して必要な情報を検索すること • ドメイン名 -> IPアドレス

    (正引き) • IPアドレス -> ドメイン名 (逆引き) wantedly.com 3.113.203.192 DNSルックアップの上限は10回と決まっている。 • 制限の対象:「a」「 mx」「 include」「 redirect」 • 制限の対象外:「ip4」「ip6」
  2. © 2024 Wantedly, Inc. 対策前 $ dig TXT +short wantedly.com

    | grep spf | ggrep -oP 'include:\K[\-_a-z0-9.]+' _spf.google.com 1 email-wantedly2.wantedly.com 2 mail.zendesk.com 3 mktomail.com 4 _spf.salesforce.com 5 servers.mcsv.net 6 aspmx.pardot.com 7 cust-spf.exacttarget.com 8 $ dig TXT +short _spf.google.com | grep spf | ggrep -oP 'include:\K[\-_a-z0-9.]+' _netblocks.google.com 9 _netblocks2.google.com 10 _netblocks3.google.com 11 $ dig TXT +short aspmx.pardot.com | grep spf | ggrep -oP 'include:\K[\-_a-z0-9.]+' et._spf.pardot.com 12 $ dig TXT +short _spf.salesforce.com | grep spf | ggrep -oP exists:%{i.}.\K[\-_a-z0-9.]+' _spf.mta.salesforce.com 13 「include」に加えて「a」も 設定しているので、合計で 14回 DNSルックアップしている
  3. © 2024 Wantedly, Inc. 対策案 対策案は以下の2つ • 使用していないSPFレコードを削除する ◦ 全て使用していて、これ以上削除できるものがない

    • SPFレコードをフラット化する ◦ こちらを実施した SPFレコードのフラット化とは、includeの中身をあらかじめ展開すること。 $ dig TXT +short email-wantedly2. wantedly.com | grep spf | ggrep -oP ip[4|6]:[\-_:a-z0-9./]+' ip4:167.89.73.92 # この値をwantedly.com直下に「ip4」として持ってくる
  4. © 2024 Wantedly, Inc. 対策後 $ dig TXT +short wantedly.com

    | grep spf | ggrep -oP 'include:\K[\-_a-z0-9.]+' _spf.google.com 1 _spf.salesforce.com 2 aspmx.pardot.com 3 cust-spf.exacttarget.com 4 $ dig TXT +short _spf.google.com | grep spf | ggrep -oP 'include:\K[\-_a-z0-9.]+' _netblocks.google.com 5 _netblocks2.google.com 6 _netblocks3.google.com 7 $ dig TXT +short _spf.salesforce.com | grep spf | ggrep -oP exists:%{i.}.\K[\-_a-z0-9.]+' _spf.mta.salesforce.com 8 $ dig TXT +short aspmx.pardot.com | grep spf | ggrep -oP 'include:\K[\-_a-z0-9.]+' et._spf.pardot.com 9 「a」も設定しているので、 合計で10回DNSルックアップして いる