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

Implementing a Captive Portal in Scala

Kurochan
June 19, 2019

Implementing a Captive Portal in Scala

社内勉強会で話したもの

Kurochan

June 19, 2019
Tweet

More Decks by Kurochan

Other Decks in Technology

Transcript

  1. ScalaͰύέοτΛಈతʹॻ͖׵͑Δํ๏ • libpcap? • Ͱ͖ͳ͘͸ͳ͍͚Ͳ͠ΜͲͦ͏ɺ΋͏ͪΐͬͱָ͕͍ͨ͠ • ϧʔςΟϯάϓϩτίϧʁ • ѼઌͰϧʔςΟϯά͸Ͱ͖Δ͕ɺૹ৴ݩͰϧʔςΟϯά͸Ͱ͖ͳ͍ •

    Policy Based Routing͕͋Δ͕ɺ੍ޚ͕Ή͔ͣͦ͠͏ • iptables? • Ͱ͖ͳ͘͸ͳͦ͞͏ɺScalaͰ੍ޚ͢ΔͷͲ͏͢ΔΜ͚ͩͬ… • Segment Routing? • ࠷৽ٕज़?ա͗ͯͲ͜·Ͱ࢖͑Δͷ͔Α͘Θ͔Βͳ͍… • OpenFlow? • ͳΜ͔ฉ͍ͨ͜ͱ͋Δɺ͍͚ͦ͏ͳؾ͕͖ͯͨ͠
  2. OpenFlow • Software Defined Network(ͷͨΊͷ௨৴ϓϩτίϧ) • SDN: Ϋϥ΢υͷཁૉٕज़ͱͯ͠΋ͯ͸΍͞Ε͍ͯΔ(ͨ?) • ίϯτϩʔϧϓϨʔϯͱσʔλϓϨʔϯΛ෼཭

    • ίϯτϩʔϧϓϨʔϯ͕ࣗ༝ʹ࣮૷Ͱ͖Δ • 2011೥ʹversion 1.1͕ग़ͨ + https://www.nic.ad.jp/ja/newsletter/No52/0800.html
  3. OpenFlowͷ֓ཁ • 5෼ͰΘ͔Δɺ͜Ε·ͰͷSDNಈ޲ • https://qiita.com/ttsubo/items/9062addd7c24d5adfcf3 • Ͳ͏ॲཧ͍͍͔ͯ͠Θ͔Βͳ͍ύέοτ => ίϯτϩʔϥʔʹసૹ •

    ίϯτϩʔϥʔ => ड͚औͬͨύέοτͷॲཧΛεΠονʹࢦࣔ • ίϯτϩʔϥʔ => ॲཧͷύλʔϯΛ
 ༧ΊεΠονʹڭ͓͑ͯ͘
 (ίϯτϩʔϥʹసૹ͞Εͳ͍ͷͰߴ଎)
  4. OpenFlowίϯτϩʔϥʔͷطଘͷ࣮૷ • Python: Ryu • Ruby: Trema • Java: Floodlight

    • Java: OpenDaylight • ࠓճ͸ϑϨʔϜϫʔΫΛ࢖Θͳ͍Ͱ
 ࣗલͰ࣮૷ͯ͠ΈΔ • OpenDaylightͷϝοηʔδͷύʔα͚ͩطଘ࣮૷Λྲྀ༻
  5. ༧උ࣮ݧ • ScalaͰͲΕ͘Β͍ύέοτΛॲཧͰ͖Δͷ͔࣮ݧͯ͠ΈΔ • Packet in => Packet out ͢Δ͚ͩͷίϯτϩʔϥʔΛ


    netty + Akka StreamsͰ࣮૷ • OpenFlowController + Open vSwitch: c5.2xlarge • iperf3Ͱଌఆ
  6. Captive Portalը໘ʹભҠͤ͞Δ࢓૊Έ • Captive Portal Detection • OS͕Captive PortalΛݕग़͢ΔͨΊʹཪଆͰҎԼͷURLΛͨͨ͘ •

    Android: http://connectivitycheck.gstatic.com/generate_204 • iOS/Mac: http://captive.apple.com/hotspot-detect.html • Windows: http://www.msftncsi.com/ncsi.txt • ظ଴͞ΕΔϨεϙϯε͕ฦ͖ͬͯͨ => Πϯλʔωοτ઀ଓ͕͋Δ • Ϩεϙϯε͕͔͑ͬͯ͜ͳ͍ => Πϯλʔωοτ઀ଓ͕ͳ͍ • ϦμΠϨΫτ͞Εͨ => Captive PortalΛݕ஌
  7. Implementing a Captive Portal in Scala • server: netty •

    controller: Akka Streams • http: Akka Http OpenFlow Switch server http controller