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

『プロフェッショナル SSL/TLS 読書会』 第 10 章

『プロフェッショナル SSL/TLS 読書会』 第 10 章

Ryo Sakuma

June 22, 2018
Tweet

More Decks by Ryo Sakuma

Other Decks in Technology

Transcript

  1. !IBTIFEIZQIFO w )BTI !IBTIFEIZQIFO  w 8FCEFWFMPQFS w +4 3VCZ

    4DBMB 3VTU 4FDVSJUZ FUDʜ w 44-ͱಉڃੜ
  2. )454֓ཁ w 3'$)5514USJDU5SBOTQPSU4FDVSJUZ *&5'   w <XFCαΠτଆ>
 )5514ͷΈڐՄ͍ͯ͠ΔࢫΛϢʔβ΁એݴͰ͖Δ w

    <Ϣʔβଆ>
 ΞΫηε࣌ʹϒϥ΢β΁)5514Λڧ੍Ͱ͖Δ w ϓϩτίϧ͸)551ϔομ Strict-Transport-Security: max-age=expireTime [; includeSubDomains]
  3. )454͕ແ͍ੈք w 63-όʔʹlFYBNQMFDPNJOEFYIUNMͱೖྗ
 ͞ΕͨΒɺ௨ৗϒϥ΢β͸)551ͰϦΫΤετ
 ࠷ॳ͔Β)5514͕ར༻Ͱ͖͔ͨ΋͠Εͳ͍ w ϒϥ΢β͕ग़͢ূ໌ॻΤϥʔΛϢʔβ͸ແࢹ͕ͪ͠ $MJDL5ISPVHI*OTFDVSJUZzGSPN3'$ 
 ຊ౰ʹෆਖ਼ͳূ໌ॻͰ΋௨աͯ͠͠·͏

    w ࠞࡏίϯςϯπ
 JNHͰεΩʔϜΛमਖ਼͠๨Ε෦෼తʹ)551ͷ݀ w $PPLJFͷ4FDVSFଐੑͱ%PNBJOଐੑ
 ଘࡏ͠ͳ͍αϒυϝΠϯ΁ͷ༠ಋ࣌ʹϢʔβ͕
 ূ໌ॻΤϥʔΛແࢹ͢Δͱ$PPLJF͕઄औ͞ΕΔ

  4. )454͕ղܾ͢Δ͜ͱ w )5514Λڧ੍Ͱ͖Δ w εΩʔϜͳ͠Ͱ63-όʔʹೖྗ͞Εͯ΋ )5514Ͱ௨৴Λ։࢝ w ূ໌ॻΤϥʔ࣌ʹʮྫ֎Λ௥Ճʯͤ͞ͳ͍
 l/P6TFS3FDPVSTFz 

    w εΩʔϜΛमਖ਼͠๨ΕͨϦιʔε͕͋ͬͯ΋
 ࣗಈͰ)5514ͰGFUDIͯ͘͠ΕΔ w AJODMVEF4VC%PNBJOTAΛซ༻͢Δ͜ͱͰ 
 ೚ҙͷαϒυϝΠϯ΋)5514ڧ੍Ͱ͖Δ w %PNBJO$PPLJFͷ4FDVSFଐੑ໰୊
  5. )454ͷ࢖͍ํ w ʮূ໌ॻΤϥʔͷͳ͍)5514ʯͷϨεϙϯεͰ
 A4USJDU5SBOTQPSU4FDVSJUZAϔομΛฦ͚ͩ͢ w NBYBHF͜ͷϙϦγʔ͕༗ޮͳඵ਺ w JODMVEF4VC%PNBJOTαϒυϝΠϯͰ΋༗ޮʹ w QSFMPBE<࢓༷ະఆٛ>ϒϥ΢βͷ)4541SFMPBE

    ର৅ͱͯ͠XFCαΠτΛਃ੥͢Δͱ͖ʹࢦఆ w ্هͷϔομΛϒϥ΢β͕ड͚औ͔ͬͯΒ༗ޮ Strict-Transport-Security: max-age=expireTime [; includeSubDomains] [; preload]
  6. )4541SFMPBE w 4USJDU5SBOTQPSU4FDVSJUZϔομΛड͚औΔલ͸ ґવͱͯ͠)5514ར༻Մೳੑ͸ෆ໌ w )454ΛσϓϩΠ͍ͯ͠Δ͜ͱΛ͋Β͔͡Ίϒϥ΢ βʹొ࿥͓͍ͯͯ͠ɺॳճ͔Β)454Λ༗ޮʹ͠ ͓ͯ͘ 5XJUUFS $ZCP[V

    FUD  w ϒϥ΢βϕϯμʔΛ୅දͯ͠(PPHMF͕ਃ੥ϑΥʔ ϜΛ؅ཧ͍ͯ͠Δ IUUQTITUTQSFMPBEPSH  w NBYBHF೥Ҏ্ɾJODMVEF4VCEPNBJOT  QSFMPBEଐੑඞਢ w l5-%1SFMPBEJOHz85'
  7. 4FDVSJUZ$POTJEFSBUJPOT 3'$͸l4FDVSJUZ$POTJEFSBUJPOTz͕໘ന͍ w ͳͥ4USJDU5SBOTQPSU4FDVSJUZϔομ͸
 ʮূ໌ॻΤϥʔͷͳ͍)5514ʯ͕ඞཁͳͷ͔  ຊདྷ)454͕༗ޮͳXFCαΠτͩͬͨ৔߹
 ূ໌ॻΤϥʔ͕ແࢹ͞Εͨঢ়ଶͰNBYBHFͷ ϔομΛฦ͞ΕΔͱ)454͕ແޮԽ͞ΕΔ 

    ຊདྷ)551͔͠ͳ͍XFCαΠτͩͬͨ৔߹
 )551Ϩεϙϯε͕վ᜵͞Εͯ)454Λ༗ޮʹ͞ Εͯ͠·͏ͱɺϦΫΤετ͕)5514ʹม׵͞Ε ͯ͠·͍%P4߈ܸ͕੒ཱ͢Δ  ࣾ಺ϓϩΩγαʔόͱ͸૬ੑѱ͍ΑͶ
  8. 4FDVSJUZ$POTJEFSBUJPOT ଞʹ΋ w AJODMVEF4VC%PNBJOTA͕%PNBJO$PPLJFͷ
 อޢʹ΋໾ཱͭ͜ͱ w 04ͷ࣌ܭΛਐΊΒΕΕ͹ϙϦγʔ͸౰વແޮԽ͞ Ε͏Δ͜ͱ w ِͷϧʔτূ໌ॻ

    %/4ΩϟογϡϙΠζχϯά ͷ߹Θٕͤ w ϒϥ΢β಺ʹอଘ͞ΕΔ֤XFCαΠτͷ)454
 ৘ใΛ࢖ͬͯ8FC5SBDLJOHͰ͖Δ͜ͱ
  9. $41֓ཁ w $POUFOU4FDVSJUZ1PMJDZ 8$XFCBQQTFD  w $41  $41-FWFM 

     w ݱࡏ$41-FWFM 8% ͷࡦఆத w ࢓༷ΑΓҾ༻
 l5IJTEPDVNFOUEFpOFTBNFDIBOJTNCZ XIJDIXFCEFWFMPQFSTDBODPOUSPMUIF SFTPVSDFTXIJDIBQBSUJDVMBSQBHFDBOGFUDI PSFYFDVUF BTXFMMBTBOVNCFSPGTFDVSJUZ SFMFWBOUQPMJDZEFDJTJPOTz w ϒϥ΢β͕औಘɾ࣮ߦ͢ΔϦιʔεͷ؅ཧ
 ͦͷଞԿͰ΋ʢ࣮ࡍ৭ʑ͋Γ͗͢Δʣ
  10. $41ͷ࢖༻ྫ w ϒϥ΢β͕࣮ߦ͢Δ+4ͷಡࠐݩʢΦϦδϯʣΛط ஌ͷ$%/ʹ੍ݶ͠ɺΠϯϥΠϯεΫϦϓτΛແޮ Խͯ͠944Λ๷͍͗ͨ TDSJQUTSD  w ϓϥάΠϯͷ࣮ߦΛېࢭ͍ͨ͠ PCKFDUTSD

     w A$POUFOU4FDVSJUZ1PMJDZAϔομ͕Ϩεϙϯεʹ ؚ·Ε͍ͯͨϖʔδͰ༗ޮʹͳΔ w ͓खܰʹࢼ͍ͨ͠ͱ͖͸
 <meta http-equiv="Content-Security-Policy"> Content-Security-Policy: script-src https://cdn.example.com/scripts/; object-src 'none'
  11. $41ͷσΟϨΫςΟϒ w IUUQTXXXXPSH53$41DTQEJSFDUJWFT w DIJMETSD w DPOOFDUTSD w EFGBVMUTSD w

    GPOUTSD w GSBNFTSD w JNHTSD w NBOJGFTUTSD w NFEJBTSD w PCKFDUTSD w TDSJQUTSD w TUZMFTSD w XPSLFSTSD w CBTFVSJ w QMVHJOUZQFT w TBOECPY w EJTPXOPQFOFS w GPSNBDUJPO w GSBNFBODFTUPST w SFQPSUVSJ w SFQPSUUP
  12. $41ͷσΟϨΫςΟϒ σΟϨΫςΟϒ͕ແݶʹ૿͖͑ͯͨͷͰɺ
 ֎෦࢓༷ͱͯ͠σΟϨΫςΟϒΛ௥ՃͰ͖ΔΑ͏ lNPEVMBSFYUFOTJCJMJUZzΛ೦಄ʹஔ͔Ε͍ͯΔ ྫ w ACMPDLBMMNJYFEDPOUFOUA w AVQHSBEFJOTFDVSFSFRVFTUTA w

    ASFRVJSFTSJGPSA 4VCSFTPVSDF*OUFHSJUZ  ৽͍͠σΟϨΫςΟϒͷڍಈͱͯ͠ఆٛ͢΂͖΋ͷ͕ 5FNQMBUF.FUIPE1BUUFSOతʹ$41ͷ࢓༷͕ఆٛ
 ͍ͯ͠ΔͨΊɺ֎෦࢓༷ʹΑΔ֦ு͕Մೳ
  13. "DLOPXMFEHFNFOUT͕೤͍ w l-PUTPGQFPQMFBSFBXFTPNF'PSJOTUBODF .BSJPBOEBMMPG$VSFʜz w ͝ଘ஌$VSFͷ%S*OH.BSJP)FJEFSJDI w )4$.JOJDIBMMFOHFl4I U JUT$41zͰ$41

    Λ୊ࡐͱͨ͠944$IBMMFOHFΛߟҊ͢ΔͳͲ
 ଟେͳߩݙ w $POUFOU4FDVSJUZ1PMJDZEFGBVMUTSDTFMG BKBYHPPHMFBQJTDPNͷঢ়گͰ944͢Δʹ͸ w IUUQTHJUIVCDPNDVSF944$IBMMFOHF8JLJXJLJ )4$.JOJDIBMMFOHF4I U JUT$41
  14. Subject: CN=hashedhyphen.com Subject Public Key Info: Public Key Algorithm: rsaEncryption

    RSA Public Key: (2048 bit) Modulus (2048 bit): 00:a8:f2:7d:cb:39:e3:d6:9c:30:7d:63:eb:cc:f2: ff:ea:40:07:b3:bb:30:21:4f:2a:1c:fb:ba:1b:f5: 1c:af:36:a6:03:f9:85:3f:50:5b:21:05:b6:f5:79: bb:e9:f9:f1:30:bc:28:07:85:13:0c:33:6e:8a:24: 33:9f:83:6d:f6:69:27:ee:4f:a8:13:b2:fe:52:e1: 06:cb:da:a0:85:df:b8:09:a3:97:1b:8d:e7:20:0b: 70:40:53:0a:ea:50:e7:60:03:70:ce:f4:35:4d:2c: 5c:ae:d0:4c:b8:7c:a3:d5:d7:13:c0:e0:d3:85:8b: 2d:7e:f2:0a:08:f1:06:9d:79:2d:40:c1:4d:93:71: 2d:d3:12:05:29:50:f6:a4:2e:7e:3d:27:7e:38:81: 51:21:0b:32:f7:37:b9:24:82:0b:e1:78:05:50:2c: e0:63:1d:d3:44:fb:57:be:ca:d0:e6:3f:31:1c:0c: 45:5c:43:df:69:cd:6f:fd:5c:2e:c9:e9:93:91:18: f7:e3:28:d3:2e:68:0f:bd:a7:59:1a:98:c9:08:61: 04:e7:e1:81:74:31:3d:43:1f:91:c7:90:c7:f6:54: 10:10:77:88:e8:fa:82:8f:8e:79:3d:05:e0:3a:96: c0:8e:60:28:e1:ab:1b:8e:51:36:45:c2:be:f8:2b: a2:ff Exponent: 65537 (0x10001)
  15. )1,1 w 3'$1VCMJD,FZ1JOOJOH&YUFOTJPOGPS )551   w ϓϩτίϧ͸)551ͷ1VCMJD,FZ1JOTϔομ w )454ͱಉ͘͡NBYBHFΛࢦఆ͠ɺϋογϡؔ਺

    ͷΞϧΰϦζϜͱ41,*ͷϋογϡ஋Λࢦఆͯ͠ϐ ϯχϯάΛද໌͢Δ Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
  16. )1,1 w ඞͣͭҎ্ϐϯχϯά͢Δඞཁ͕͋Δ w ͔֤ͭʑ͕ผʑͷূ໌ॻνΣʔϯʹ͋Δඞཁ w )1,1͕ಈ࡞ͤͣʹCVH[JMMBNP[JMMBPSHʹ ʮ)1,1ಈ͍ͯͳ͍Μ͚ͩͲόάʁʯͬͯฉ͍ͨΒ ʮূ໌ॻݸ͔͠ϐϯχϯάͯ͠ͳ͍΍Μ͚ʯ
 ͬͯࢦఠ͞Εͨࢥ͍ग़ʢஏ͔͍ͣ͠ʣ

    w 1VCMJD,FZ1JOT3FQPSU0OMZϔομΛ࢖͑͹ ESZSVOͰ͖Δ Public-Key-Pins: max-age=2592000; pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
  17. %"/&ͷϢʔεέʔε  ࣗݾॺ໊ূ໌ॻͷ҆શͳσϓϩΠ w ࠓ·Ͱͷ5-4ͩͱඞͣূ໌ॻΤϥʔ͕ग़Δ w ʮҰൠతͳʯϢʔβ͸ແࢹ͢Δ͚Ͳʜ·͋ w ໰୊͸ʮਖ਼͍͠ʯΤϥʔͱࣗݾূ໌ॻͷݕূΤϥʔ ͕۠ผ͔ͭͳ͍

    w %/44&$͕͋Ε͹ɺ໊લղܾ͢ΔυϝΠϯॴ༗ ऀͷਅਖ਼ੑΛ֬อͰ͖Δ͔ΒԿͰ΋҆શʹϐϯχ ϯάͰ͖ΔΑͶ w ಠࣗϧʔτূ໌ॻͩͬͯϐϯχϯάͰ͖ͪΌ͏
  18. %"/&ͷ࣮૷ɾσϓϩΠ w 5-4"ϨίʔυΛκʔϯϑΝΠϧͰఆٛ w $FSUJpDBUF6TBHF w  1,*95" $"ূ໌ॻ νΣʔϯ্

     w  1,*9&& &OE&OUJUZূ໌ॻ νΣʔϯઌ಄  w ʜ _443._tcp.www.example.com. IN TLSA ( 0 1 1 d2abde240d7cd3ee6b4b28c54df034b9 7983a1d16e8a410e4561cb106618e971 )
  19. %"/&ͷ࣮૷ɾσϓϩΠ w 5-4"ϨίʔυΛκʔϯϑΝΠϧͰఆٛ w 4FMFDUPS w  $FSU ূ໌ॻϐϯχϯά w

     41,* ެ։伴 41,* ϐϯχϯά _443._tcp.www.example.com. IN TLSA ( 0 1 1 d2abde240d7cd3ee6b4b28c54df034b9 7983a1d16e8a410e4561cb106618e971 )
  20. %"/&ͷ࣮૷ɾσϓϩΠ w 5-4"ϨίʔυΛκʔϯϑΝΠϧͰఆٛ w .BUDIJOH5ZQF w  'VMM ௚઀ൺֱ w

     4)" ϋογϡൺֱ w  4)" ϋογϡൺֱ PQUJPOBM _443._tcp.www.example.com. IN TLSA ( 0 1 1 d2abde240d7cd3ee6b4b28c54df034b9 7983a1d16e8a410e4561cb106618e971 )