PROXY Protocol aware Proxy Server on Node.js

672ee2598bea695496f11022a9a9c4c8?s=47 moznion
April 27, 2019

PROXY Protocol aware Proxy Server on Node.js

This slides for Kyoto.js #16

672ee2598bea695496f11022a9a9c4c8?s=128

moznion

April 27, 2019
Tweet

Transcript

  1. PROXY Protocol Aware Proxy Server on Node.js Kyoto.js #16 @moznion

  2. @moznion Software engineer

  3. PROXY Protocol

  4. Proxy PROTOCOL - Transport Layer (L4) ൛ͷX-Forwarder-For - Proxy͢ΔࡍʹoriginalͷΞυϨεΛҡ࣋ͯ͠
 Ѽઌ΁ϑΥϫʔυ͢ΔͨΊͷϓϩτίϧ

    - HAProxy͕ఏএ (ۀքඪ४Έ͍ͨͳʁ) - http://www.haproxy.org/download/1.8/doc/proxy-protocol.txt - AWSͷELBͰ΋αϙʔτͯ͠Δ - V1ͱV2͕͋Δ (ޙड़)
  5. PROXY Protocol V1

  6. Proxy PROTOCOL V1 - ςΩετϓϩτίϧ - ϑΥʔϚοτ:
 PROXY <INET Protocol

    Family> <Source Address> <Destination Address> <Source Port> <Destination Port>\r\n - Θ͔Γ΍͍͢Ͱ͢Ͷ
  7. PROXY Protocol V2

  8. Proxy PROTOCOL V2 - όΠφϦϓϩτίϧ - આ໌ུ (ͪΐͬͱ໘౗͍͘͞) - V1ͱͷػೳ໘Ͱͷେ͖ͳࠩ͸UNIX

    Domain SocketΛαϙʔτ͍ͯ͠Δ͔Ͳ͏͔
  9. Example (V1)

  10. Example (V1) PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n GET /

    HTTP/1.1\r\n Host: 192.168.0.11\r\n \r\n
  11. Example (V1) PROXY TCP4 192.168.0.1 192.168.0.11 56324 443\r\n GET /

    HTTP/1.1\r\n Host: 192.168.0.11\r\n \r\n طଘͷ௨৴ͷΞλϚʹprepend͢Δ
  12. Proxy PROTOCOL - طଘͷ௨৴ͷΞλϚʹprepend͢Δ - γϯϓϧʂ - => ૹ৴ݩ΋ૹ৴ઌ΋ʮPROXY ProtocolΛ࢖͏ʯ

    ͱ͍͏͜ͱΛࣄલʹ஌͓ͬͯ͘ඞཁ༗Γ - ͞΋ͳ͍ͱͿͬյΕΔ
  13. Motivation

  14. nodeͰ΋΍Γ͍ͨ΍Μʁ
 ʢੈͷதʹ͸৭ʑͳ͜ͱ͕͋Δʣ

  15. proxy-protocol-js - ͱ͍͏Θ͚Ͱॻ͍ͨ - https://github.com/moznion/proxy-protocol-js - TypeScript੡ - V1/V2྆ରԠ -

    encode/decode྆ରԠ
  16. proxy-protocol-js - ۤ࿑ϙΠϯτ:

  17. Example Implementation and Demo

  18. https://github.com/moznion/proxy- protocol-socket-server-example