2018/06 追è¨
å¤ãè¨äºã§ããã¡ããã¡ããã¢ã¯ã»ã¹ããã ãã¦ããã®ã§æ´æ°ã
æè¿ã¯å¸¸æSSLãIPv4æ¯æ¸ãCDNå°å
¥ãªã©ã®çç±ã§SNIãè¯ã使ãããããã«ãªã£ã¦ãã¦ãã¾ãã
ãã®å ´åããã¹ãå(URLå
¨ä½ã§ã¯ãªã)ã¯å¹³æã§éä¿¡ããã¾ãã
client å´ã§ãã£ããã£ãããã±ãã
curl -k https://sni.example.com/hogehoge
$ sudo ngrep -d en3 -q -W byline port 443 and host 192.0.2.1 interface: en3 (192.168.6.0/255.255.255.0) filter: (ip or ip6) and ( port 443 and host 192.0.2.1 ) T 192.168.6.108:55460 -> 192.0.2.1:443 [AP] ...........[1.K.gr8%.k...*MY.n.........SR....D...,.+.$.#. .....0./.(.'...........k.g.9.3.......=.<.5./. .............S.........sni.example.com.
SNIã¨ã¯
- ä¸ã¤ã®IPã«è¤æ°ã®è¨¼ææ¸ãé©ç¨
- ã¯ã¤ã«ãã«ã¼ã/ãã«ããã¡ã¤ã³ã§ã¯ãªããåå¥ã®è¨¼ææ¸ãè¤æ°é©ç¨
- https://ja.wikipedia.org/wiki/Server_Name_Indication
追è¨çµãã
æå·åãããæ´¾ã¨æå·åãããªãæ´¾ã«å¥ãã¦ã¦ãèãããã®ã§ã
ã¿ã¤ãã«ã®ãããªåãæ¹ã ã¨å°ãææ§ãªã®ã§ãçãæ¹ã«ãã£ã¦å¥ããã®ããªã
- HTTPSéä¿¡ä¸ã®URLæ
å ±ã¯æå·åããã
- çè´ããã¦ãURLã¯ã°ããªã
- web serverã®ãã°ã«ã¯URLã¯å¾©å·ããã¦è¨é²ããã
- ãã°ãæ®ããã¯è¨å®æ¬¡ç¬¬
(web serverã£ã¦æ¸ãã¦ãããªããapacheã®ãã¨ããèãã¦ãã¾ãããã§ããã¶ãä»ã®httpdã§ãåãã ã¨æã)
åé ã®èº«è¿ãªäººãã¡ã«ã¯ãHTTPSéä¿¡ä¸ã®URLãæå·åãããªãæ´¾ãããã®ã§ãâã®å 容ã§èª¬æããã
httpsã®ããã¼ã¨ãã¦ã¯
- clientãserverã®tcp 443 portã«æ¥ç¶
- serverã¯è¨¼ææ¸ã¨å ¬ééµãclientã«éä¿¡
- clientã¯serverã®è¨¼ææ¸ãæ¤è¨¼
- æ¤è¨¼ã§ããã(or è¦åãåºã¦ãç¡è¦ããã°)å ±ééµãçæããserverã®å ¬ééµã§æå·åãã¦serverã«éä¿¡
- serverã¯èªèº«ã®ç§å¯éµãç¨ãã¦ãæå·åãããå ±ééµã復å·
- client - serverã§æå·åã®ã»ãã·ã§ã³ã確ç«ãã以éå ±ééµã§æå·åãã¦HTTP over SSLéä¿¡ãè¡ããã (ããã§URLã¨HTTPããããããã£ãéããã)
ã¨ãããã¨ã ã¨æãã®ã§HTTPSéä¿¡ä¸ã®URLã¯æå·åãããã¨ã試ãã«mod_sslãåãã¦ããapacheã§ãã±ãããã£ããã£ãã¤ã¤ãclientã§sslæ¥ç¶ããã¨æå·åããã¦ãã®ããããã
- http
client
$ curl -I http://192.168.0.1/hoge
server: ngrep (tcpdump) ã§ãã£ããã£ããã
URLã ãã§ãªãã¦ãHTTP Requestå
¨ä½ãå¹³æã§ã¿ãã¦ãã
# ngrep -q -W byline dst\ port 80 and host 192.168.0.10 interface: eth0 (192.168.0.0/255.255.255.0) filter: (ip) and ( dst port 80 and host 192.168.0.10 ) T 192.168.0.10:25007 -> 192.168.0.1:80 [AP] HEAD /hoge HTTP/1.1. User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15. Host: 192.168.0.1. Accept: */*. .
client # ãªã¬ãªã¬è¨¼ææ¸ä½¿ã£ã¦ããã®ã§-k ãä»ãã
$ curl -k -I https://192.168.0.1/hoge
server: ngrep (tcpdump) ã§ãã£ããã£ãæå·åããã¦ãã¦HTTP Requestå ¨ä½ãããã¹ãã§è¦ããªããªã£ã¦ãã
# ngrep -q -W byline dst\ port 443 and host 192.168.0.10 interface: eth0 (192.168.0.0/255.255.255.0) filter: (ip) and ( dst port 443 and host 192.168.0.10 ) T 192.168.0.10:15168 -> 192.168.0.1:443 [AP] ....e...a..O........*3.t...!\.m=.V...(> :t...(.9.8.5..... .3.2./....................................192.168.0.1 T 192.168.0.10:15168 -> 192.168.0.1:443 [AP] .............nG.n..Z.\.v..\\F..2..A.T.b....*h;.....:zk.....T.?I../..)...jVl.VW......H.)....H.Fv.V......J."......*...........g....RF..L..W............0F...k......4.....]<.@.*9d.\.&...5.k...#."6..Fe.. T 192.168.0.10:15168 -> 192.168.0.1:443 [AP] ......+..L..&.&.Tn....4JC..9..Ta .j.{...S.p9....+A+i..J..t.Zebva~....."[email protected]...)...eU.....sb.....]....M....b...R..W..URo.Ko]&..*^5.g.xw...{q...8..W.~h...sz......,;h...r.{T+.B T 192.168.0.10:15168 -> 192.168.0.1:443 [AP] .... ...r..rB.O.......;..+......H,B.+
åé ã«ãæ¸ãããã©ãhttpsã§ã¢ã¯ã»ã¹ãã¦ããã°ã«ã¯URLã¯å¹³æã§æ®ããPOSTãã¼ã¿ãapacheã®mod_dumpioã¨ãã¢ããªã±ã¼ã·ã§ã³ã§å¹³æã§ãã°ã«æ®ããã®ã§ãéä¿¡ããæ å ±ãå®å ¨ã«ä½¿ããããã©ããã¯çµå±ãµã¼ãå´ã®éå¶æ¬¡ç¬¬ã£ã¦ããããã¨å½ç¶ãSSLã®ç§å¯éµãçã¾ãããããã¨çè´ï¼å¾©å·ãããã¨ä¸èº«ã¯ãã¬ããã£ã¦ä½ãè¨ãããã®ãããããªããªã£ã¦ãã¡ãã£ãã