SlideShare ist ein Scribd-Unternehmen logo
1 von 16
How netfilter saved my
                         bacon


                                   Fred Moyer
                                  @phredmoyer
                             Silver Lining Networks


Thursday, September 27, 12
Free WiFi!
                  Ad bar inserted at the top of page pays the WiFi bill
                           (Silver Lining Ad Bar shown here)


Thursday, September 27, 12
Others have built it, you may have used
                   theirs (notice this page didn’t load fully)

Thursday, September 27, 12
How does theirs work?
                    • Tinyproxy runs on the network gateway
                    • Inserts Javascript into the HTTP response
                             which splits the page into two frames, one
                             for the ad bar, one for the web page content
                    • Proxying HTTP responses through
                             userspace on network devices is *slow*
                    • Users get angry; this solution sucks
Thursday, September 27, 12
Ignorance is bliss; how I
                               built it from scratch
                    • iptables rules on the gateway device NAT
                             forwarded HTTP requests to co-located
                             mod_perl web proxy
                    • Better performance than tinyproxy
                    • Running all web traffic through colocation
                             doesn’t scale though (and is really
                             expensive)


Thursday, September 27, 12
Making it scale
                    •        Avoid sending static content requests (images,
                             videos, etc) through the colocated proxy

                    •        HTTP proxy rewrites static content links:

                             •   http://foo.com/image.jpg =>

                                 •   http://foo.com:8135/image.jpg

                    •        Redirect port 8135 to port 80 via router iptables
                             rule:

                             •   iptables -t NAT -A PREROUTING -i $LAN -p tcp
                                 --dport 8135 -j DNAT --to :80


Thursday, September 27, 12
Scalability achieved
                    • 95% of traffic offloaded from the co-
                             located proxy and fetched directly from the
                             destination
                    • Hillbilly architecture driven by desperation
                             and experimentation rather than elegant
                             planning
                    • Performance was much better than the
                             tinyproxy approach used by competitors


Thursday, September 27, 12
Yo dawg, I heard you
                                  like 400s
                    •        Whoops, it doesn’t completely work

                    •        Apache handles http://foo.com:8135 requests
                             to port 80 just fine

                    •        lighttpd throws a 400 Bad Request!

                    •        ~20% of static content requests returning 400s
                             makes users (and network operators) angry



Thursday, September 27, 12
Linux based routers use the sk_buff socket buffer
                    struct in kernel space. Maybe a netfilter module can
                          remove the :8135 from the hostname...

Thursday, September 27, 12
3 months of Netfilter coding




Thursday, September 27, 12
Architectural Overview
                                           gateway iptables
                                           redirect to proxy
 GET http://foo.com/                                                       HTTP proxy

                             iptables -t NAT -A PREROUTING -i $LAN -p tcp --dport 80
                               --dst ! 192.168.0.0/16 -j DNAT --to 69.36.240.29:80




Thursday, September 27, 12
Architectural Overview
                                      gateway iptables
                                      redirect to proxy
 GET http://foo.com/                                                HTTP proxy
                                     html response with ad,
                                  subrequest hrefs on port 8135



                                                                    index.html
                                                                  proxied request




                                                                     foo.com



Thursday, September 27, 12
Architectural Overview
                                      gateway iptables
                                      redirect to proxy
 GET http://foo.com/                                                HTTP proxy
                                     html response with ad,
                                  subrequest hrefs on port 8135



                                                                    index.html
      browser parses page,                                        proxied request
     makes image subrequest




 GET http://foo.com:8135/bar.jpg                                     foo.com



Thursday, September 27, 12
Architectural Overview
                                      gateway iptables
                                      redirect to proxy
 GET http://foo.com/                                                  HTTP proxy
                                     html response with ad,
                                  subrequest hrefs on port 8135



                                                                    index.html
      browser parses page,                                        proxied request
     makes image subrequest



                                           netfilter module removes
                                                :8135 hostport
 GET http://foo.com:8135/bar.jpg                                      foo.com
                                         subrequest bypasses proxy,
                                           fetches image directly




Thursday, September 27, 12
It works (finally)
                    •        ‘Host: foo.com:8135’ => ‘Host: foo.com’ in
                             kernel space. No user space copying.
                    •        < 500 ms additional latency for main page
                             requests through the co-located HTTP proxy
                    •        Blows tinyproxy out of the water
                    •        Product didn’t survive business needs though,
                             the ad revenue wasn’t there :(


Thursday, September 27, 12
Thank you Surge 2012

                    • Stuck in an architectural dead end?
                             Maybe this approach can help you.
                    • github.com/redhotpenguin/SL-Kernel
                    • www.skbuff.net/skbuff.html
                    • banu.com/tinyproxy

Thursday, September 27, 12

Weitere ähnliche Inhalte

Andere mochten auch

Germany and outbreak of ww2 1
Germany and outbreak of ww2 1Germany and outbreak of ww2 1
Germany and outbreak of ww2 1Ashraf Atique
 
case study starwood hotels and resorts worldwide discuss
case study starwood hotels and resorts worldwide discusscase study starwood hotels and resorts worldwide discuss
case study starwood hotels and resorts worldwide discussMediabistro
 
Geocapabilties: teacher leadership
Geocapabilties: teacher leadershipGeocapabilties: teacher leadership
Geocapabilties: teacher leadershipKarl Donert
 
London y sus secretos
London y sus secretosLondon y sus secretos
London y sus secretosbielcallarisa
 
Webquest género literario
Webquest género literarioWebquest género literario
Webquest género literarioKARLA PAREDES
 
The Stock Market Crash Of 1929
The Stock Market Crash Of 1929The Stock Market Crash Of 1929
The Stock Market Crash Of 1929Bryan Toth
 
Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹Ma Yu-Hui
 

Andere mochten auch (10)

Osas
OsasOsas
Osas
 
Germany and outbreak of ww2 1
Germany and outbreak of ww2 1Germany and outbreak of ww2 1
Germany and outbreak of ww2 1
 
case study starwood hotels and resorts worldwide discuss
case study starwood hotels and resorts worldwide discusscase study starwood hotels and resorts worldwide discuss
case study starwood hotels and resorts worldwide discuss
 
Geocapabilties: teacher leadership
Geocapabilties: teacher leadershipGeocapabilties: teacher leadership
Geocapabilties: teacher leadership
 
London y sus secretos
London y sus secretosLondon y sus secretos
London y sus secretos
 
Mono
MonoMono
Mono
 
Webquest género literario
Webquest género literarioWebquest género literario
Webquest género literario
 
The Stock Market Crash Of 1929
The Stock Market Crash Of 1929The Stock Market Crash Of 1929
The Stock Market Crash Of 1929
 
Distribution Telecom
Distribution   TelecomDistribution   Telecom
Distribution Telecom
 
Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹Linux 的檔案系統格式介紹
Linux 的檔案系統格式介紹
 

Ähnlich wie Surge 2012 fred_moyer_lightning

Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...Baruch Sadogursky
 
What is Digital Rebar Provision (and how RackN extends)?
What is Digital Rebar Provision (and how RackN extends)?What is Digital Rebar Provision (and how RackN extends)?
What is Digital Rebar Provision (and how RackN extends)?rhirschfeld
 
Ruby - Behind the Scenes
Ruby -  Behind the ScenesRuby -  Behind the Scenes
Ruby - Behind the ScenesKenneth Kalmer
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)Peter Lubbers
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)Stoyan Zhekov
 
Railswaycon 2009 - Summary
Railswaycon 2009 - SummaryRailswaycon 2009 - Summary
Railswaycon 2009 - Summarydaniel.mattes
 
Ruby Conf Preso
Ruby Conf PresoRuby Conf Preso
Ruby Conf PresoDan Yoder
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?Altoros
 
ActionEmbedding
ActionEmbeddingActionEmbedding
ActionEmbeddingphilcowans
 
Apache httpd 2.4 overview
Apache httpd 2.4 overviewApache httpd 2.4 overview
Apache httpd 2.4 overviewJim Jagielski
 
Desperately seeking a lightweight Perl framework
Desperately seeking a lightweight Perl frameworkDesperately seeking a lightweight Perl framework
Desperately seeking a lightweight Perl frameworkPeter Edwards
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Arun Gupta
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityPeter Lubbers
 
Puppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with PuppetPuppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with PuppetNan Liu
 
BeAPI API Framework
BeAPI API FrameworkBeAPI API Framework
BeAPI API FrameworkOwen Rubel
 
2012-04-21-ignite-offline-mobile-app-has-great-potential
2012-04-21-ignite-offline-mobile-app-has-great-potential2012-04-21-ignite-offline-mobile-app-has-great-potential
2012-04-21-ignite-offline-mobile-app-has-great-potentialKenichi Murahashi
 

Ähnlich wie Surge 2012 fred_moyer_lightning (20)

Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
 
What is Digital Rebar Provision (and how RackN extends)?
What is Digital Rebar Provision (and how RackN extends)?What is Digital Rebar Provision (and how RackN extends)?
What is Digital Rebar Provision (and how RackN extends)?
 
Ruby - Behind the Scenes
Ruby -  Behind the ScenesRuby -  Behind the Scenes
Ruby - Behind the Scenes
 
Reverse proxy magic
Reverse proxy magicReverse proxy magic
Reverse proxy magic
 
Where is my scalable API?
Where is my scalable API?Where is my scalable API?
Where is my scalable API?
 
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
HTML5 Real Time and WebSocket Code Lab (SFHTML5, GTUGSF)
 
Ruby off Rails (english)
Ruby off Rails (english)Ruby off Rails (english)
Ruby off Rails (english)
 
Vertx
VertxVertx
Vertx
 
Railswaycon 2009 - Summary
Railswaycon 2009 - SummaryRailswaycon 2009 - Summary
Railswaycon 2009 - Summary
 
Ruby Conf Preso
Ruby Conf PresoRuby Conf Preso
Ruby Conf Preso
 
Where is my scalable api?
Where is my scalable api?Where is my scalable api?
Where is my scalable api?
 
ActionEmbedding
ActionEmbeddingActionEmbedding
ActionEmbedding
 
Apache httpd 2.4 overview
Apache httpd 2.4 overviewApache httpd 2.4 overview
Apache httpd 2.4 overview
 
Desperately seeking a lightweight Perl framework
Desperately seeking a lightweight Perl frameworkDesperately seeking a lightweight Perl framework
Desperately seeking a lightweight Perl framework
 
Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014Nuts and Bolts of WebSocket Devoxx 2014
Nuts and Bolts of WebSocket Devoxx 2014
 
HTML5 Real-Time and Connectivity
HTML5 Real-Time and ConnectivityHTML5 Real-Time and Connectivity
HTML5 Real-Time and Connectivity
 
Puppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with PuppetPuppet Conf 2012 - Managing Network Devices with Puppet
Puppet Conf 2012 - Managing Network Devices with Puppet
 
BeAPI API Framework
BeAPI API FrameworkBeAPI API Framework
BeAPI API Framework
 
2012-04-21-ignite-offline-mobile-app-has-great-potential
2012-04-21-ignite-offline-mobile-app-has-great-potential2012-04-21-ignite-offline-mobile-app-has-great-potential
2012-04-21-ignite-offline-mobile-app-has-great-potential
 
Html5 tx - preso
Html5 tx - presoHtml5 tx - preso
Html5 tx - preso
 

Mehr von Fred Moyer

Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+Fred Moyer
 
Practical service level objectives with error budgeting
Practical service level objectives with error budgetingPractical service level objectives with error budgeting
Practical service level objectives with error budgetingFred Moyer
 
SREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done RightSREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done RightFred Moyer
 
Scale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done RightScale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done RightFred Moyer
 
Latency SLOs Done Right
Latency SLOs Done RightLatency SLOs Done Right
Latency SLOs Done RightFred Moyer
 
Latency SLOs done right
Latency SLOs done rightLatency SLOs done right
Latency SLOs done rightFred Moyer
 
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and IstioComprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and IstioFred Moyer
 
Comprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istioComprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istioFred Moyer
 
Effective management of high volume numeric data with histograms
Effective management of high volume numeric data with histogramsEffective management of high volume numeric data with histograms
Effective management of high volume numeric data with histogramsFred Moyer
 
Statistics for dummies
Statistics for dummiesStatistics for dummies
Statistics for dummiesFred Moyer
 
GrafanaCon EU 2018
GrafanaCon EU 2018GrafanaCon EU 2018
GrafanaCon EU 2018Fred Moyer
 
Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017Fred Moyer
 
Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016Fred Moyer
 
Better service monitoring through histograms
Better service monitoring through histogramsBetter service monitoring through histograms
Better service monitoring through histogramsFred Moyer
 
The Breakup - Logically Sharding a Growing PostgreSQL Database
The Breakup - Logically Sharding a Growing PostgreSQL DatabaseThe Breakup - Logically Sharding a Growing PostgreSQL Database
The Breakup - Logically Sharding a Growing PostgreSQL DatabaseFred Moyer
 
Learning go for perl programmers
Learning go for perl programmersLearning go for perl programmers
Learning go for perl programmersFred Moyer
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache DispatchFred Moyer
 
Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008Fred Moyer
 
Data::FormValidator Simplified
Data::FormValidator SimplifiedData::FormValidator Simplified
Data::FormValidator SimplifiedFred Moyer
 

Mehr von Fred Moyer (20)

Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+Reliable observability at scale: Error Budgets for 1,000+
Reliable observability at scale: Error Budgets for 1,000+
 
Practical service level objectives with error budgeting
Practical service level objectives with error budgetingPractical service level objectives with error budgeting
Practical service level objectives with error budgeting
 
SREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done RightSREcon americas 2019 - Latency SLOs Done Right
SREcon americas 2019 - Latency SLOs Done Right
 
Scale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done RightScale17x - Latency SLOs Done Right
Scale17x - Latency SLOs Done Right
 
Latency SLOs Done Right
Latency SLOs Done RightLatency SLOs Done Right
Latency SLOs Done Right
 
Latency SLOs done right
Latency SLOs done rightLatency SLOs done right
Latency SLOs done right
 
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and IstioComprehensive Container Based Service Monitoring with Kubernetes and Istio
Comprehensive Container Based Service Monitoring with Kubernetes and Istio
 
Comprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istioComprehensive container based service monitoring with kubernetes and istio
Comprehensive container based service monitoring with kubernetes and istio
 
Effective management of high volume numeric data with histograms
Effective management of high volume numeric data with histogramsEffective management of high volume numeric data with histograms
Effective management of high volume numeric data with histograms
 
Statistics for dummies
Statistics for dummiesStatistics for dummies
Statistics for dummies
 
GrafanaCon EU 2018
GrafanaCon EU 2018GrafanaCon EU 2018
GrafanaCon EU 2018
 
Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017Fredmoyer postgresopen 2017
Fredmoyer postgresopen 2017
 
Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016Better service monitoring through histograms sv perl 09012016
Better service monitoring through histograms sv perl 09012016
 
Better service monitoring through histograms
Better service monitoring through histogramsBetter service monitoring through histograms
Better service monitoring through histograms
 
The Breakup - Logically Sharding a Growing PostgreSQL Database
The Breakup - Logically Sharding a Growing PostgreSQL DatabaseThe Breakup - Logically Sharding a Growing PostgreSQL Database
The Breakup - Logically Sharding a Growing PostgreSQL Database
 
Learning go for perl programmers
Learning go for perl programmersLearning go for perl programmers
Learning go for perl programmers
 
Qpsmtpd
QpsmtpdQpsmtpd
Qpsmtpd
 
Apache Dispatch
Apache DispatchApache Dispatch
Apache Dispatch
 
Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008Ball Of Mud Yapc 2008
Ball Of Mud Yapc 2008
 
Data::FormValidator Simplified
Data::FormValidator SimplifiedData::FormValidator Simplified
Data::FormValidator Simplified
 

Kürzlich hochgeladen

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Kürzlich hochgeladen (20)

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

Surge 2012 fred_moyer_lightning

  • 1. How netfilter saved my bacon Fred Moyer @phredmoyer Silver Lining Networks Thursday, September 27, 12
  • 2. Free WiFi! Ad bar inserted at the top of page pays the WiFi bill (Silver Lining Ad Bar shown here) Thursday, September 27, 12
  • 3. Others have built it, you may have used theirs (notice this page didn’t load fully) Thursday, September 27, 12
  • 4. How does theirs work? • Tinyproxy runs on the network gateway • Inserts Javascript into the HTTP response which splits the page into two frames, one for the ad bar, one for the web page content • Proxying HTTP responses through userspace on network devices is *slow* • Users get angry; this solution sucks Thursday, September 27, 12
  • 5. Ignorance is bliss; how I built it from scratch • iptables rules on the gateway device NAT forwarded HTTP requests to co-located mod_perl web proxy • Better performance than tinyproxy • Running all web traffic through colocation doesn’t scale though (and is really expensive) Thursday, September 27, 12
  • 6. Making it scale • Avoid sending static content requests (images, videos, etc) through the colocated proxy • HTTP proxy rewrites static content links: • http://foo.com/image.jpg => • http://foo.com:8135/image.jpg • Redirect port 8135 to port 80 via router iptables rule: • iptables -t NAT -A PREROUTING -i $LAN -p tcp --dport 8135 -j DNAT --to :80 Thursday, September 27, 12
  • 7. Scalability achieved • 95% of traffic offloaded from the co- located proxy and fetched directly from the destination • Hillbilly architecture driven by desperation and experimentation rather than elegant planning • Performance was much better than the tinyproxy approach used by competitors Thursday, September 27, 12
  • 8. Yo dawg, I heard you like 400s • Whoops, it doesn’t completely work • Apache handles http://foo.com:8135 requests to port 80 just fine • lighttpd throws a 400 Bad Request! • ~20% of static content requests returning 400s makes users (and network operators) angry Thursday, September 27, 12
  • 9. Linux based routers use the sk_buff socket buffer struct in kernel space. Maybe a netfilter module can remove the :8135 from the hostname... Thursday, September 27, 12
  • 10. 3 months of Netfilter coding Thursday, September 27, 12
  • 11. Architectural Overview gateway iptables redirect to proxy GET http://foo.com/ HTTP proxy iptables -t NAT -A PREROUTING -i $LAN -p tcp --dport 80 --dst ! 192.168.0.0/16 -j DNAT --to 69.36.240.29:80 Thursday, September 27, 12
  • 12. Architectural Overview gateway iptables redirect to proxy GET http://foo.com/ HTTP proxy html response with ad, subrequest hrefs on port 8135 index.html proxied request foo.com Thursday, September 27, 12
  • 13. Architectural Overview gateway iptables redirect to proxy GET http://foo.com/ HTTP proxy html response with ad, subrequest hrefs on port 8135 index.html browser parses page, proxied request makes image subrequest GET http://foo.com:8135/bar.jpg foo.com Thursday, September 27, 12
  • 14. Architectural Overview gateway iptables redirect to proxy GET http://foo.com/ HTTP proxy html response with ad, subrequest hrefs on port 8135 index.html browser parses page, proxied request makes image subrequest netfilter module removes :8135 hostport GET http://foo.com:8135/bar.jpg foo.com subrequest bypasses proxy, fetches image directly Thursday, September 27, 12
  • 15. It works (finally) • ‘Host: foo.com:8135’ => ‘Host: foo.com’ in kernel space. No user space copying. • < 500 ms additional latency for main page requests through the co-located HTTP proxy • Blows tinyproxy out of the water • Product didn’t survive business needs though, the ad revenue wasn’t there :( Thursday, September 27, 12
  • 16. Thank you Surge 2012 • Stuck in an architectural dead end? Maybe this approach can help you. • github.com/redhotpenguin/SL-Kernel • www.skbuff.net/skbuff.html • banu.com/tinyproxy Thursday, September 27, 12