SlideShare a Scribd company logo
1 of 23
Nine ways to use network-side scripting to architect more scalable, secure, and fast applications Presented by: F5 Networks
Network-side scripting executes discrete application functions on the application delivery platform. Network Administrator Application Developer Application delivery platform Application
Cookie Encryption 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. Encrypted cookie is decrypted  and reinserted into the HTTP header Request sent to appropriate web application server where processing occurs normally Response is sent from web application server back to BIG-IP application delivery platform BIG-IP application delivery platform receives response, encrypts appropriate cookie and  reinserts into the HTTP header and returns to the browser
Cookie Encryption when RULE_INIT { # Generate Unique Key set ::key [AES::key] } when HTTP_RESPONSE { set decrypted [HTTP::cookie "MyCookie"] if { "" ne $decrypted } { # remove the original cookie, encrypt it, and then insert the encrypted value HTTP::cookie remove "MyCookie" set encrypted [b64encode [AES::encrypt $::key $decrypted]] HTTP::cookie insert name "MyCookie" value $encrypted } } when HTTP_REQUEST { set encrypted [HTTP::cookie "MyCookie"] if { "" ne $encrypted } {  # remove encrypted cookie, decrypt it, and insert the decrypted value. HTTP::cookie remove "MyCookie" set decrypted [AES::decrypt $::key [b64decode $encrypted]] HTTP::cookie insert name "MyCookie" value $decrypted } }
Session Persistence 1 2 3 4 1 2 3 4 A first web request received by BIG-IP application delivery platform. BIG-IP chooses a server a forwards the request  When the request returns BIG-IP notes the specified session id (JSESSIONID, PHPSESSIONID, etc..) in its session table along with the server and returns the request to the browser  A second request is received. The BIG-IP application delivery platform extracts the session id cookie  and determines to which server the request should be sent based on its session table Request is sent to the same server, preserving session state in the web application
Session Persistence ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
URI Rewrite 1 2 1 2 Web request received by BIG-IP application delivery platform. An iRule recognizes the URI and  executes code to change the URI  Request sent to appropriate web application server where processing occurs normally
URI Rewrite ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Application Switching 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and  determines to which server it should be sent.  Request sent to appropriate web application server where processing occurs normally Another request is received by BIG-IP application delivery platform. BIG-IP examines the request and determines to which server it should be sent Request sent to appropriate web application server where processing occurs normally GET /image.jpg GET /mypage.html
Application Switching ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Exception Handling 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and  determines to which server it should be sent.  Request sent to appropriate web application server where processing occurs normally BIG-IP recognizes that the response contains an error indicated by a 404 status or a 200 status with content containing an exception (a stack trace, for example)  BIG-IP retries the request on another server and when it comes back valid returns it to the browser
Exception Handling ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],when HTTP_RESPONSE { if { [HTTP::status] starts_with &quot;4&quot; } { incr retries log &quot;4xx error caught: retry $retries out of [active_members [LB::server pool]]“ if { $retries < [active_members [LB::server pool]] } { HTTP::retry $request } } }
Data Scrubbing  1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and  determines to which server it should be sent.  Request sent to appropriate web application server where processing occurs normally BIG-IP recognizes that the response contains a credit card number. The iRule “scrubs” the number  by replacing all digits in the credit card number with an X  BIG-IP returns the response with the “clean” data to the browser
Data Scrubbing  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
when HTTP_RESPONSE_DATA { # Find ALL the possible credit card numbers in one pass  set card_indices [regexp -all -inline -indices {(?:3[4|7]{2})(?:[ ,-]?(?:{5}(?:{1})?)){2}|(?:4{3})(?:[ ,-]?(?:{4})){3}|(?:5[1-5]{2})(?:[ ,-]?(?:{4})){3}|(?:6011)(?:[ ,-]?(?:{4})){3}} [HTTP::payload]]  foreach card_idx $card_indices { set card_start [lindex $card_idx 0] set card_end [lindex $card_idx 1] set card_len [expr {$card_end - $card_start + 1}] set card_number [string range [HTTP::payload] $card_start $card_end] # Remove dash or space if they exist and count the occurences in variable cutouts. set cutouts [regsub -all {[- ]} $card_number &quot;&quot; card_number] # Adjsut card_len variable but keep it for later use. set new_card_len [expr {$card_len - $cutouts}] set double [expr {$new_card_len & 1}]  set chksum 0  set isCard invalid # Calculate MOD10 for { set i 0 } { $i < $new_card_len } { incr i } {  set c [string index $card_number $i]  if {($i & 1) == $double} {  if {[incr c $c] >= 10} {incr c -9}  }  incr chksum $c  }  # Determine Card Type switch [string index $card_number 0] {  3 { set type AmericanExpress }  4 { set type Visa }  5 { set type MasterCard }  6 { set type Discover }  default { set type Unknown }  } # If valid card number, then mask out numbers with X's  if { ($chksum % 10) == 0 } {  set isCard valid  HTTP::payload replace $card_start $card_len [string repeat &quot;X&quot; $card_len] } # Log Results log local0. &quot;Found $isCard $type CC# $card_number&quot;  } }
Intelligent Compression 1 2 3 1 2 3 A first web request received by BIG-IP application delivery platform. BIG-IP  checks the client’s bandwidth and  chooses a server a forwards the request  The request is handled normally by the web application server/web server and returned to BIG-IP BIG-IP takes into consideration the bandwidth available and the type of content and determines whether it will be a performance plus or negative to apply compression, then acts on that decision and returns the response to the client
Intelligent Compression ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],when HTTP::REQUEST { if {[TCP::bandwidth] < XXX} { pool slowHTTP } }
LDAP Connection Proxy 1 2 3 4 1 2 3 4 Request received by BIG-IP application delivery platform. BIG-IP examines the request by looking at the TCP payload and finds the string that represents the unbind command.  BIG-IP releases the client binding to the LDAP server BIG-IP keeps the TCP connection to the LDAP server open for reuse The original unbind command is discarded and LDAP server’s overhead reduced
LDAP Connection Proxy when CLIENT_ACCEPTED {  TCP::collect } when CLIENT_DATA { binary scan [TCP::payload] xc ber_len if { $ber_len < 0 } { set ber_index [expr 2 + 128 + $ber_len] } else { set ber_index 2 } # message id binary scan [TCP::payload] @${ber_index}xcI ber_len ber_len_ext if { $ber_len < 0 } { set ext_len [expr 128 + $ber_len] set ber_len [expr (($ber_len_ext>>(4-$ext_len)*8)+(0x100^$ext_len))%(0x100^$ext_len)] } else { set ext_len 0 } incr ber_index [expr 2 + $ext_len + $ber_len] # ldap message binary scan [TCP::payload] @${ber_index}c ber_type  if { [expr $ber_type & 0x1f] == 2 } { log local0. &quot;unbind => detach&quot; TCP::payload replace 0 [TCP::payload length] &quot;&quot; LB::detach } TCP::release TCP::collect }
Homerize your errors 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and  determines to which server it should be sent.  Request sent to appropriate web application server where processing occurs normally BIG-IP recognizes that the response is a 404 not found. The iRule responds by rewriting the content and p lacing an embedded wav file of homer saying “Doh!” in the response. BIG-IP returns the response with the “clean” data to the browser
Homerize Your Errors when HTTP_REQUEST {  # Check for sensitive documents.  set check_content 1  # Don't allow data to be chunked.  if {[HTTP::version] == &quot;1.1&quot;} {  if {[HTTP::header is_keepalive]} {  # Adjust the Connection header.  HTTP::header replace &quot;Connection&quot; &quot;Keep-Alive&quot;  }  HTTP::version &quot;1.0&quot;  }  } when HTTP_RESPONSE {  #check to see if it is a 404 if { [HTTP::status] == &quot;404&quot; } { if {$check_content == 1} { set replace_now 1  # Calculate the amount to collect  set content_length 0  if {[HTTP::header exists &quot;Content-Length&quot;]} {  set content_length [HTTP::header &quot;Content-Length&quot;]  }  # If the header is missing, use a sufficiently large number  if {$content_length == 0} {  set content_length 4294967295  }  HTTP::collect $content_length  } }  } when HTTP_RESPONSE_DATA {  set payload [HTTP::payload [HTTP::payload length]]  set fun_payload &quot;<html><body><EMBED src =amp;quot;http://www.fortunecity.com/lavendar/poitier/135/nevertry.wavamp;quot;  width=amp;quot;144amp;quot; height=amp;quot;60amp;quot; autostart=amp;quot;trueamp;quot; loop=amp;quot;trueamp;quot;  hidden=amp;quot;trueamp;quot;>404 error Page not found</body></html>&quot;  #check to see if it should replace the content due to a 404 if {$replace_now == 1} { # Replace the content if there was any matches  HTTP::payload replace 0 [HTTP::payload length] $fun_payload  }  }
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],For more ideas and Information on F5’s network-side scripting capabilities and  technology, visit  DevCentral   (http://devcentral.f5.com)
THANK YOU!

More Related Content

What's hot

Beyond php it's not (just) about the code
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the codeWim Godden
 
Capstone HEDIS Database Documentation
Capstone HEDIS Database DocumentationCapstone HEDIS Database Documentation
Capstone HEDIS Database DocumentationStephen Cain Jr.
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Launching Beeline with Firebase
Launching Beeline with FirebaseLaunching Beeline with Firebase
Launching Beeline with FirebaseChetan Padia
 
When RSS Fails: Web Scraping with HTTP
When RSS Fails: Web Scraping with HTTPWhen RSS Fails: Web Scraping with HTTP
When RSS Fails: Web Scraping with HTTPMatthew Turland
 
User registration and login using stored procedure in php
User registration and login using stored procedure in phpUser registration and login using stored procedure in php
User registration and login using stored procedure in phpPHPGurukul Blog
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012Wim Godden
 
IDSECCONF2013 CTF online Write Up
IDSECCONF2013 CTF online Write Up IDSECCONF2013 CTF online Write Up
IDSECCONF2013 CTF online Write Up idsecconf
 
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I thinkWim Godden
 
CIS14: Developing with OAuth and OIDC Connect
CIS14: Developing with OAuth and OIDC ConnectCIS14: Developing with OAuth and OIDC Connect
CIS14: Developing with OAuth and OIDC ConnectCloudIDSummit
 
Introduction to OAuth
Introduction to OAuthIntroduction to OAuth
Introduction to OAuthPaul Osman
 
Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)Fabien Potencier
 

What's hot (20)

Beyond php it's not (just) about the code
Beyond php   it's not (just) about the codeBeyond php   it's not (just) about the code
Beyond php it's not (just) about the code
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
Capstone HEDIS Database Documentation
Capstone HEDIS Database DocumentationCapstone HEDIS Database Documentation
Capstone HEDIS Database Documentation
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
Launching Beeline with Firebase
Launching Beeline with FirebaseLaunching Beeline with Firebase
Launching Beeline with Firebase
 
When RSS Fails: Web Scraping with HTTP
When RSS Fails: Web Scraping with HTTPWhen RSS Fails: Web Scraping with HTTP
When RSS Fails: Web Scraping with HTTP
 
User registration and login using stored procedure in php
User registration and login using stored procedure in phpUser registration and login using stored procedure in php
User registration and login using stored procedure in php
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012Caching and tuning fun for high scalability @ LOAD2012
Caching and tuning fun for high scalability @ LOAD2012
 
IDSECCONF2013 CTF online Write Up
IDSECCONF2013 CTF online Write Up IDSECCONF2013 CTF online Write Up
IDSECCONF2013 CTF online Write Up
 
OAuth1.0
OAuth1.0OAuth1.0
OAuth1.0
 
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDBMongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
MongoDB .local Paris 2020: La puissance du Pipeline d'Agrégation de MongoDB
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
My app is secure... I think
My app is secure... I thinkMy app is secure... I think
My app is secure... I think
 
CIS14: Developing with OAuth and OIDC Connect
CIS14: Developing with OAuth and OIDC ConnectCIS14: Developing with OAuth and OIDC Connect
CIS14: Developing with OAuth and OIDC Connect
 
70562-Dumps
70562-Dumps70562-Dumps
70562-Dumps
 
Log mining
Log miningLog mining
Log mining
 
Introduction to OAuth
Introduction to OAuthIntroduction to OAuth
Introduction to OAuth
 
Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)Beyond symfony 1.2 (Symfony Camp 2008)
Beyond symfony 1.2 (Symfony Camp 2008)
 

Similar to Nine Ways to Use Network-Side Scripting

Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesCarol McDonald
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with PerlDave Cross
 
Top 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platformTop 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platformAvi Networks
 
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guideZenita Smythe
 
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...Bart Uelen
 
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmenMCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmenVannaSchrader3
 
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docx
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docxMCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docx
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docxalfredacavx97
 
Presentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BPresentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BHapsoro Permana
 
Tugas pw [kelompok 25]
Tugas pw [kelompok 25]Tugas pw [kelompok 25]
Tugas pw [kelompok 25]guest0ad6a0
 
User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using phpRishabh Srivastava
 
PHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdfPHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdfHumphreyOwuor1
 
Networking lab
Networking labNetworking lab
Networking labRagu Ram
 
How to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfHow to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfAppweb Coders
 

Similar to Nine Ways to Use Network-Side Scripting (20)

REST API for your WP7 App
REST API for your WP7 AppREST API for your WP7 App
REST API for your WP7 App
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
 
Opensocial Codelab
Opensocial CodelabOpensocial Codelab
Opensocial Codelab
 
Modern Web Development with Perl
Modern Web Development with PerlModern Web Development with Perl
Modern Web Development with Perl
 
Top 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platformTop 10 F5 iRules to migrate to a modern load balancing platform
Top 10 F5 iRules to migrate to a modern load balancing platform
 
PPT
PPTPPT
PPT
 
java and javascript api dev guide
java and javascript api dev guidejava and javascript api dev guide
java and javascript api dev guide
 
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
Tadhack madrid June 2014: Joris Swinnen and WebRTC Nederland "Invite my colle...
 
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmenMCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen
 
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docx
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docxMCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docx
MCIS 6163 Assignment 1MCIS 6163 Assignment 1.pdfAssignmen.docx
 
WCF - In a Week
WCF - In a WeekWCF - In a Week
WCF - In a Week
 
Web
WebWeb
Web
 
Presentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+BPresentasi Kelompok 25 PW A+B
Presentasi Kelompok 25 PW A+B
 
Tugas pw [kelompok 25]
Tugas pw [kelompok 25]Tugas pw [kelompok 25]
Tugas pw [kelompok 25]
 
4.4 PHP Session
4.4 PHP Session4.4 PHP Session
4.4 PHP Session
 
User authentication module using php
User authentication module using phpUser authentication module using php
User authentication module using php
 
Web Server.pdf
Web Server.pdfWeb Server.pdf
Web Server.pdf
 
PHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdfPHP-Cookies-Sessions.pdf
PHP-Cookies-Sessions.pdf
 
Networking lab
Networking labNetworking lab
Networking lab
 
How to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdfHow to Create Login and Registration API in PHP.pdf
How to Create Login and Registration API in PHP.pdf
 

More from Lori MacVittie

So you think you can scale containers
So you think you can scale containersSo you think you can scale containers
So you think you can scale containersLori MacVittie
 
State of Application Delivery 2017 - Cloud Insights
State of Application Delivery 2017 - Cloud Insights State of Application Delivery 2017 - Cloud Insights
State of Application Delivery 2017 - Cloud Insights Lori MacVittie
 
State of Application Delivery 2017 - DevOps Insights
State of Application Delivery 2017 - DevOps Insights State of Application Delivery 2017 - DevOps Insights
State of Application Delivery 2017 - DevOps Insights Lori MacVittie
 
So you think you can scale
So you think you can scaleSo you think you can scale
So you think you can scaleLori MacVittie
 
Beyond POLB (Plain Old Load Balancing)
Beyond POLB (Plain Old Load Balancing) Beyond POLB (Plain Old Load Balancing)
Beyond POLB (Plain Old Load Balancing) Lori MacVittie
 
Pushing the DevOps envelope into the network with microservices
Pushing the DevOps envelope into the network with microservicesPushing the DevOps envelope into the network with microservices
Pushing the DevOps envelope into the network with microservicesLori MacVittie
 
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015Lori MacVittie
 
The Internet of Security Things (A Story about Change)
The Internet of Security Things (A Story about Change) The Internet of Security Things (A Story about Change)
The Internet of Security Things (A Story about Change) Lori MacVittie
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes EverythingLori MacVittie
 
5 ways to use node.js in the network
5 ways to use node.js in the network5 ways to use node.js in the network
5 ways to use node.js in the networkLori MacVittie
 
What are Software Defined Application Services
What are Software Defined Application ServicesWhat are Software Defined Application Services
What are Software Defined Application ServicesLori MacVittie
 
Operationalize all the network things
Operationalize all the network thingsOperationalize all the network things
Operationalize all the network thingsLori MacVittie
 
Programming proxies to do what we need so we don't have to talk to the networ...
Programming proxies to do what we need so we don't have to talk to the networ...Programming proxies to do what we need so we don't have to talk to the networ...
Programming proxies to do what we need so we don't have to talk to the networ...Lori MacVittie
 
Dynamic Infrastructure
Dynamic InfrastructureDynamic Infrastructure
Dynamic InfrastructureLori MacVittie
 
Web 2 And Application Delivery Public
Web 2 And Application Delivery PublicWeb 2 And Application Delivery Public
Web 2 And Application Delivery PublicLori MacVittie
 

More from Lori MacVittie (16)

So you think you can scale containers
So you think you can scale containersSo you think you can scale containers
So you think you can scale containers
 
State of Application Delivery 2017 - Cloud Insights
State of Application Delivery 2017 - Cloud Insights State of Application Delivery 2017 - Cloud Insights
State of Application Delivery 2017 - Cloud Insights
 
State of Application Delivery 2017 - DevOps Insights
State of Application Delivery 2017 - DevOps Insights State of Application Delivery 2017 - DevOps Insights
State of Application Delivery 2017 - DevOps Insights
 
So you think you can scale
So you think you can scaleSo you think you can scale
So you think you can scale
 
Devops is all greek
Devops is all greekDevops is all greek
Devops is all greek
 
Beyond POLB (Plain Old Load Balancing)
Beyond POLB (Plain Old Load Balancing) Beyond POLB (Plain Old Load Balancing)
Beyond POLB (Plain Old Load Balancing)
 
Pushing the DevOps envelope into the network with microservices
Pushing the DevOps envelope into the network with microservicesPushing the DevOps envelope into the network with microservices
Pushing the DevOps envelope into the network with microservices
 
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
Architectural Patterns for Scaling Microservices and APIs - GlueCon 2015
 
The Internet of Security Things (A Story about Change)
The Internet of Security Things (A Story about Change) The Internet of Security Things (A Story about Change)
The Internet of Security Things (A Story about Change)
 
HTTP/2 Changes Everything
HTTP/2 Changes EverythingHTTP/2 Changes Everything
HTTP/2 Changes Everything
 
5 ways to use node.js in the network
5 ways to use node.js in the network5 ways to use node.js in the network
5 ways to use node.js in the network
 
What are Software Defined Application Services
What are Software Defined Application ServicesWhat are Software Defined Application Services
What are Software Defined Application Services
 
Operationalize all the network things
Operationalize all the network thingsOperationalize all the network things
Operationalize all the network things
 
Programming proxies to do what we need so we don't have to talk to the networ...
Programming proxies to do what we need so we don't have to talk to the networ...Programming proxies to do what we need so we don't have to talk to the networ...
Programming proxies to do what we need so we don't have to talk to the networ...
 
Dynamic Infrastructure
Dynamic InfrastructureDynamic Infrastructure
Dynamic Infrastructure
 
Web 2 And Application Delivery Public
Web 2 And Application Delivery PublicWeb 2 And Application Delivery Public
Web 2 And Application Delivery Public
 

Recently uploaded

React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
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
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
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
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
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
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
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
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 

Recently uploaded (20)

React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
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...
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
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
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
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
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
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
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 

Nine Ways to Use Network-Side Scripting

  • 1. Nine ways to use network-side scripting to architect more scalable, secure, and fast applications Presented by: F5 Networks
  • 2. Network-side scripting executes discrete application functions on the application delivery platform. Network Administrator Application Developer Application delivery platform Application
  • 3. Cookie Encryption 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. Encrypted cookie is decrypted and reinserted into the HTTP header Request sent to appropriate web application server where processing occurs normally Response is sent from web application server back to BIG-IP application delivery platform BIG-IP application delivery platform receives response, encrypts appropriate cookie and reinserts into the HTTP header and returns to the browser
  • 4. Cookie Encryption when RULE_INIT { # Generate Unique Key set ::key [AES::key] } when HTTP_RESPONSE { set decrypted [HTTP::cookie &quot;MyCookie&quot;] if { &quot;&quot; ne $decrypted } { # remove the original cookie, encrypt it, and then insert the encrypted value HTTP::cookie remove &quot;MyCookie&quot; set encrypted [b64encode [AES::encrypt $::key $decrypted]] HTTP::cookie insert name &quot;MyCookie&quot; value $encrypted } } when HTTP_REQUEST { set encrypted [HTTP::cookie &quot;MyCookie&quot;] if { &quot;&quot; ne $encrypted } { # remove encrypted cookie, decrypt it, and insert the decrypted value. HTTP::cookie remove &quot;MyCookie&quot; set decrypted [AES::decrypt $::key [b64decode $encrypted]] HTTP::cookie insert name &quot;MyCookie&quot; value $decrypted } }
  • 5. Session Persistence 1 2 3 4 1 2 3 4 A first web request received by BIG-IP application delivery platform. BIG-IP chooses a server a forwards the request When the request returns BIG-IP notes the specified session id (JSESSIONID, PHPSESSIONID, etc..) in its session table along with the server and returns the request to the browser A second request is received. The BIG-IP application delivery platform extracts the session id cookie and determines to which server the request should be sent based on its session table Request is sent to the same server, preserving session state in the web application
  • 6.
  • 7. URI Rewrite 1 2 1 2 Web request received by BIG-IP application delivery platform. An iRule recognizes the URI and executes code to change the URI Request sent to appropriate web application server where processing occurs normally
  • 8.
  • 9. Application Switching 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and determines to which server it should be sent. Request sent to appropriate web application server where processing occurs normally Another request is received by BIG-IP application delivery platform. BIG-IP examines the request and determines to which server it should be sent Request sent to appropriate web application server where processing occurs normally GET /image.jpg GET /mypage.html
  • 10.
  • 11. Exception Handling 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and determines to which server it should be sent. Request sent to appropriate web application server where processing occurs normally BIG-IP recognizes that the response contains an error indicated by a 404 status or a 200 status with content containing an exception (a stack trace, for example) BIG-IP retries the request on another server and when it comes back valid returns it to the browser
  • 12.
  • 13. Data Scrubbing 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and determines to which server it should be sent. Request sent to appropriate web application server where processing occurs normally BIG-IP recognizes that the response contains a credit card number. The iRule “scrubs” the number by replacing all digits in the credit card number with an X BIG-IP returns the response with the “clean” data to the browser
  • 14.
  • 15. when HTTP_RESPONSE_DATA { # Find ALL the possible credit card numbers in one pass set card_indices [regexp -all -inline -indices {(?:3[4|7]{2})(?:[ ,-]?(?:{5}(?:{1})?)){2}|(?:4{3})(?:[ ,-]?(?:{4})){3}|(?:5[1-5]{2})(?:[ ,-]?(?:{4})){3}|(?:6011)(?:[ ,-]?(?:{4})){3}} [HTTP::payload]] foreach card_idx $card_indices { set card_start [lindex $card_idx 0] set card_end [lindex $card_idx 1] set card_len [expr {$card_end - $card_start + 1}] set card_number [string range [HTTP::payload] $card_start $card_end] # Remove dash or space if they exist and count the occurences in variable cutouts. set cutouts [regsub -all {[- ]} $card_number &quot;&quot; card_number] # Adjsut card_len variable but keep it for later use. set new_card_len [expr {$card_len - $cutouts}] set double [expr {$new_card_len & 1}] set chksum 0 set isCard invalid # Calculate MOD10 for { set i 0 } { $i < $new_card_len } { incr i } { set c [string index $card_number $i] if {($i & 1) == $double} { if {[incr c $c] >= 10} {incr c -9} } incr chksum $c } # Determine Card Type switch [string index $card_number 0] { 3 { set type AmericanExpress } 4 { set type Visa } 5 { set type MasterCard } 6 { set type Discover } default { set type Unknown } } # If valid card number, then mask out numbers with X's if { ($chksum % 10) == 0 } { set isCard valid HTTP::payload replace $card_start $card_len [string repeat &quot;X&quot; $card_len] } # Log Results log local0. &quot;Found $isCard $type CC# $card_number&quot; } }
  • 16. Intelligent Compression 1 2 3 1 2 3 A first web request received by BIG-IP application delivery platform. BIG-IP checks the client’s bandwidth and chooses a server a forwards the request The request is handled normally by the web application server/web server and returned to BIG-IP BIG-IP takes into consideration the bandwidth available and the type of content and determines whether it will be a performance plus or negative to apply compression, then acts on that decision and returns the response to the client
  • 17.
  • 18. LDAP Connection Proxy 1 2 3 4 1 2 3 4 Request received by BIG-IP application delivery platform. BIG-IP examines the request by looking at the TCP payload and finds the string that represents the unbind command. BIG-IP releases the client binding to the LDAP server BIG-IP keeps the TCP connection to the LDAP server open for reuse The original unbind command is discarded and LDAP server’s overhead reduced
  • 19. LDAP Connection Proxy when CLIENT_ACCEPTED { TCP::collect } when CLIENT_DATA { binary scan [TCP::payload] xc ber_len if { $ber_len < 0 } { set ber_index [expr 2 + 128 + $ber_len] } else { set ber_index 2 } # message id binary scan [TCP::payload] @${ber_index}xcI ber_len ber_len_ext if { $ber_len < 0 } { set ext_len [expr 128 + $ber_len] set ber_len [expr (($ber_len_ext>>(4-$ext_len)*8)+(0x100^$ext_len))%(0x100^$ext_len)] } else { set ext_len 0 } incr ber_index [expr 2 + $ext_len + $ber_len] # ldap message binary scan [TCP::payload] @${ber_index}c ber_type if { [expr $ber_type & 0x1f] == 2 } { log local0. &quot;unbind => detach&quot; TCP::payload replace 0 [TCP::payload length] &quot;&quot; LB::detach } TCP::release TCP::collect }
  • 20. Homerize your errors 1 2 3 4 1 2 3 4 Web request received by BIG-IP application delivery platform. BIG-IP examines the request and determines to which server it should be sent. Request sent to appropriate web application server where processing occurs normally BIG-IP recognizes that the response is a 404 not found. The iRule responds by rewriting the content and p lacing an embedded wav file of homer saying “Doh!” in the response. BIG-IP returns the response with the “clean” data to the browser
  • 21. Homerize Your Errors when HTTP_REQUEST { # Check for sensitive documents. set check_content 1 # Don't allow data to be chunked. if {[HTTP::version] == &quot;1.1&quot;} { if {[HTTP::header is_keepalive]} { # Adjust the Connection header. HTTP::header replace &quot;Connection&quot; &quot;Keep-Alive&quot; } HTTP::version &quot;1.0&quot; } } when HTTP_RESPONSE { #check to see if it is a 404 if { [HTTP::status] == &quot;404&quot; } { if {$check_content == 1} { set replace_now 1 # Calculate the amount to collect set content_length 0 if {[HTTP::header exists &quot;Content-Length&quot;]} { set content_length [HTTP::header &quot;Content-Length&quot;] } # If the header is missing, use a sufficiently large number if {$content_length == 0} { set content_length 4294967295 } HTTP::collect $content_length } } } when HTTP_RESPONSE_DATA { set payload [HTTP::payload [HTTP::payload length]] set fun_payload &quot;<html><body><EMBED src =amp;quot;http://www.fortunecity.com/lavendar/poitier/135/nevertry.wavamp;quot; width=amp;quot;144amp;quot; height=amp;quot;60amp;quot; autostart=amp;quot;trueamp;quot; loop=amp;quot;trueamp;quot; hidden=amp;quot;trueamp;quot;>404 error Page not found</body></html>&quot; #check to see if it should replace the content due to a 404 if {$replace_now == 1} { # Replace the content if there was any matches HTTP::payload replace 0 [HTTP::payload length] $fun_payload } }
  • 22.