Implementing a Captive Portal in Scala

Implementing a Captive Portal in Scala

社内勉強会で話したもの

1f745ff900e1be51aedae18cae76593c?s=128

Kurochan

June 19, 2019
Tweet

Transcript

  1. 3.

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

    Policy Based Routing͕͋Δ͕ɺ੍ޚ͕Ή͔ͣͦ͠͏ • iptables? • Ͱ͖ͳ͘͸ͳͦ͞͏ɺScalaͰ੍ޚ͢ΔͷͲ͏͢ΔΜ͚ͩͬ… • Segment Routing? • ࠷৽ٕज़?ա͗ͯͲ͜·Ͱ࢖͑Δͷ͔Α͘Θ͔Βͳ͍… • OpenFlow? • ͳΜ͔ฉ͍ͨ͜ͱ͋Δɺ͍͚ͦ͏ͳؾ͕͖ͯͨ͠
  2. 4.

    OpenFlow • Software Defined Network(ͷͨΊͷ௨৴ϓϩτίϧ) • SDN: Ϋϥ΢υͷཁૉٕज़ͱͯ͠΋ͯ͸΍͞Ε͍ͯΔ(ͨ?) • ίϯτϩʔϧϓϨʔϯͱσʔλϓϨʔϯΛ෼཭

    • ίϯτϩʔϧϓϨʔϯ͕ࣗ༝ʹ࣮૷Ͱ͖Δ • 2011೥ʹversion 1.1͕ग़ͨ + https://www.nic.ad.jp/ja/newsletter/No52/0800.html
  3. 5.

    OpenFlowͷ֓ཁ • 5෼ͰΘ͔Δɺ͜Ε·ͰͷSDNಈ޲ • https://qiita.com/ttsubo/items/9062addd7c24d5adfcf3 • Ͳ͏ॲཧ͍͍͔ͯ͠Θ͔Βͳ͍ύέοτ => ίϯτϩʔϥʔʹసૹ •

    ίϯτϩʔϥʔ => ड͚औͬͨύέοτͷॲཧΛεΠονʹࢦࣔ • ίϯτϩʔϥʔ => ॲཧͷύλʔϯΛ
 ༧ΊεΠονʹڭ͓͑ͯ͘
 (ίϯτϩʔϥʹసૹ͞Εͳ͍ͷͰߴ଎)
  4. 6.

    OpenFlowίϯτϩʔϥʔͷطଘͷ࣮૷ • Python: Ryu • Ruby: Trema • Java: Floodlight

    • Java: OpenDaylight • ࠓճ͸ϑϨʔϜϫʔΫΛ࢖Θͳ͍Ͱ
 ࣗલͰ࣮૷ͯ͠ΈΔ • OpenDaylightͷϝοηʔδͷύʔα͚ͩطଘ࣮૷Λྲྀ༻
  5. 10.

    ༧උ࣮ݧ • ScalaͰͲΕ͘Β͍ύέοτΛॲཧͰ͖Δͷ͔࣮ݧͯ͠ΈΔ • Packet in => Packet out ͢Δ͚ͩͷίϯτϩʔϥʔΛ


    netty + Akka StreamsͰ࣮૷ • OpenFlowController + Open vSwitch: c5.2xlarge • iperf3Ͱଌఆ
  6. 17.

    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. 20.

    Implementing a Captive Portal in Scala • server: netty •

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