SlideShare ist ein Scribd-Unternehmen logo
1 von 27
SYN504 - UNLEASHING THE POWER OF THE
NETSCALER POLICY AND EXPRESSIONS ENGINE
MAY 6 – 4.00PM
Henrik Johansson
Twitter: @HenrikJay
Web: https://www.ngenx.com || https://henrikjay.com
Email: henrik.johansson@ngenx.com || henrik@henrikjay.com
Tweet about this session with hashtag
#SYN504 and #CitrixSynergy
CTP, CCIA and AWS certified Architect.
Director of Professional Services.
13+ years Citrix experience,17+ years IT.
NetScaler Wizard, Public Cloud, Security,
Evangelist and Speaker.
Speaker bio compressed
Henrik Johansson
Twitter: @HenrikJay
Web: https://www.ngenx.com || https://henrikjay.com
Email: henrik.johansson@ngenx.com || henrik@henrikjay.com
Founded in 2000, nGenx is a pioneer in cloud-based application delivery.
Throughout our history, we have always pushed the envelope with
technology while working to build bridges between all of our technology
partners, including Microsoft, Citrix, Cisco, Amazon Web Services, NetApp,
RES, Google Chrome, Dell/Compellent, Intuit and others. Working with these
partners, we have developed a dynamic set of cloud solutions.
nGenx – White label CSP
• What is a policy
• NetScaler Policies Use cases
• Classic vs default
• RegEx intro
• Optimizing expressions
Agenda at a glance
• Policies control how a feature evaluate data and thru that determine
what action to take for the data thru the use of logical expressions.
• A policy can trigger a simple effect like DROP, nothing (NOOP) or a
complex action/chain thru profiles.
What are NetScaler policies
Expression Hierarchy
HTTP
SYS
CLIENT
SERVER
REQ
RES
URL
METHOD
BODY
HEADER
…
STATUS
BODY
DATE
HEADER
…DAY
HOUR
…
EXPR
PATH
PROTOCOL
QUERY
SUFFIX
HOSTNAME
EQ
CONTAINS
BETWEEN
SKIP
TRUNCATE
SUBSTR
REGEX_MATCH
HTTP_URL_SAFE
TYPECAST_TEXT_T
…
DST
SRC
ID
VERSION
CLIENT_CERT
…
SRCPORT
PAYLOAD()
…
DNS
SRCPORT
DSTPORT
ID
THROUGHPUT
…
SRCMAC
DSTMAC
NTIME
CLASSIC
CHECK_LIMIT
HTTP_CALLOUT
IP
VLAN
SSL
TCP
UDP
INTERFACE
ETHER
IPv6
IP
VLAN
TCP
INTERFACE
ETHER
IPv6
Analytics
SIP
MySQL
MSSQL
• Enables you to route, modify, control traffic based on:
• Phone model, browser type, OS
• Control content delivery
• Block unsecure features on certain browsers
• Can be used to trigger other policies like:
• Redirect thru responder, Rewrite,
• Example:
add responder policy RESP_BLOCK_FF_POL "HTTP.REQ.HEADER("User-
Agent").SET_TEXT_MODE(IGNORECASE).CONTAINS("Mozilla")" DROP
Use case - Client/browser identification
• Enables you actively modify and rewrite content on the fly
• For example requested URL’s, text, metadata
• Example:
add rewrite action RW_RES_CMPMode_ACT insert_before
"HTTP.RES.BODY(10000).SUBSTR(”<meta")" q{"<meta http-equiv="X-UA-
Compatible" content="IE=EmulateIE7" />"}
Use case - Rewrites
• Use HTTP CallOut to verify client IP or username
• Fetch back end-pages for response replacement.
• Can be used to trigger other policies like:
• Redirect thru responder, Rewrite,
• Example:
set policy httpcallout CheckUser –ipaddress 10.10.10.10 –port 80 -returntype
text –httpmethod get –urlstemexpr '"/CheckIP&”+HTTP.REQ.USER.NAME"' -
resultexpr 'http.res.body(5)'
sys.http_callout(CheckUser)
Use case - White/blacklisting
Only support Classic
Support Default
• Authentication, Pre-authentication
• SSL
• Cache redirection
• VPN (session, traffic, and tunnel traffic)
• Content filtering (use Responder instead)
Classic to Default
• Application firewall policies
• Authorization policies
• Named expressions
• Compression policies
• Content switching policies
• User-defined, rule-based tokens/persistency
Manual
• root@ns# nspepi -e "RES.HTTP.HEADER Content-Type CONTAINS
application/msword"
• "HTTP.RES.HEADER("Content-
Type").AFTER_STR("application/msword").LENGTH.GT(0)”
• root@ns# nspepi -e "URL != '/*.gif'"
• "HTTP.REQ.URL.REGEX_MATCH(re#/(.*).gif#).NOT”
• Is this the most optimal rule?
Expression conversion
Full config
root@ns# cd /nsconfig
root@ns# nspepi -f ns.conf
OUTPUT: New configuration file created: new_ns.conf
OUTPUT: New warning file created: warn_ns.conf
root@ns#
Expression conversion
Remember:
• The commands that exceed 1499 character limit must be manually
updated.
• Multiple classic can share priority 0. Not supported in Default
• Error lines shown after command and in warning file
• Use as guidance
• Test…Test…and when done…Test again!
Expression conversion
What is RegEx
A regular expression is a sequence or pattern of characters that is matched
against a string of text when performing searches.
NetScaler uses PCRE
Patterns are selective and can search any part of the string.
Searches can use different entry points and look back and forward
RegEx uses delimeters to select text: re~test|test2~
These can be anything that is unique
RegEx
RegEx
Metacharacter Function Example What if Matches
^ Beginning-of-line anchor /^love/ Matches all lines beginning with love
$ End-of-line anchor /love$/ Matches all lines ending with love
. Matches one character /l..e/ Matches lines containing an l, followed by two characters,
followed by an e
* Matches zero or more of the
preceding characters
/ *love/ Matches lines with zero or more spaces, followed by the
pattern love
[] Matches one character in
the set
/[Ll]ove Matches lines containing love or Love
[x-y] Matches one character
within a range in the set
/[A-Z]ove/ Matches letters from A through Z followed by ove
[^] Matches one character not
on a set
/[^A-Z]/ Matches any character not in the range between A and Z.
 Used to escape a character /love./ Matches lines containing love, followed by a literal period
RegEx
Metacharacter Function Definition
d Match any digit [0-9]
w Match any word character [A-Za-z0-9_]
s Match any whitespace character [ tn]
D Match any NON-digit [^d]
W Match any NON-word character [^w]
S Match any NON-whitespace
character
[^s]
Example
I have a lovely time on our little picnic.
Lovers were all around us. It is springtime. Oh
love, how much I adore you. Do you know
the extent of my love? Oh, by the way, I think
I lost my gloves somewhere out in that field of
clover. Did you see them? I can only hope love
is forever. I live for you. It's hard to get back in the
groove.
/ove[^a-zA-Z0-9]/
RegEx
• What are you trying to find, don’t evaluate full result
• http.req.url.suffix.contains("jpeg”)
• http.req.url.suffix.eq("jpeg")
• Regex takes more resources, but can match multiple values
• Match multiple items in single request
• HTTP.REQ.HOSTNAME.SERVER.REGEX_MATCH(re~host1|host2~)
• HTTP.REQ.HEADER("Example").AFTER_STR("more”)
• Is better then
• HTTP.REQ.HEADER("Example").AFTER_REGEX(re/more/)
Policy optimization
• A PatternSet is an excellent way to match multiple values
• Example: Checking for filetypes or hosts
add policy patset PatSet_AllowedHosts
bind policy patset PatSet_AllowedHosts host1 -index 1
bind policy patset PatSet_AllowedHosts host3 -index 2
HTTP.REQ.HOSTNAME.SET_TEXT_MODE(IGNORECASE).CONTAINS_ANY("PatSet
_AllowedHosts")"
Policy optimization – PatternSet
• StringMap can be used for dynamic renaming
add policy stringmap SM_Name
bind policy stringmap SM_Name site1.domain.com ”Desktop1"
bind policy stringmap SM_Name site2.domain.com “Desktop2”
add rewrite action RW_RES_DesktopName_ACT replace_all
"HTTP.RES.BODY(100000)"
"HTTP.REQ.HOSTNAME.SERVER.MAP_STRING("SM_Name”)" -pattern
"re~(Other Desktop)|(Real Desktop)~" -bypassSafetyCheck YES
Policy optimization - StringMap
• Expression policy simplifies reusing frequently used expressions
add policy expression Exp1
"!HTTP.REQ.HOSTNAME.SET_TEXT_MODE(IGNORECASE).CONTAINS_ANY("PatS
et_AllowedHosts")"
add responder policy RESP_DROP_Unsecure_Hosts_POL Exp1 DROP
Policy optimization - ExpressionPolicy
• Always use the correct policy expression
Example:
HTTP.REQ.URL.QUERY
Performs better than
HTTP.REQ.URL.AFTER_STR("?")
which is based on string parsing that have to look thru the whole query
Policy optimization – Correct policy
• TypeCasting allow you to convert data
HTTP.REQ.HEADER("Example").AFTER_STR(",").BEFORE_STR(",")
Can be optimized by changing into
HTTP.REQ.HEADER("Example").TYPECAST_LIST_T(',').GET(1)
SET_TEXT_MODE(IGNORECASE) is excellent when working with rewrite
Policy optimization - TypeCasting
Citrix NetScaler Policy Expression Reference - Release 10.1
http://support.citrix.com/article/CTX137705
Typecasting
http://support.citrix.com/proddocs/topic/ns-main-appexpert-10-1-map/ns-
typecasting-data-wrapper-con.html#ns-typecasting-data-wrapper-con
Online resources
Henrik Johansson
Twitter: @HenrikJay
Web: https://www.ngenx.com || https://henrikjay.com
Email: henrik.johansson@ngenx.com || henrik@henrikjay.com
Questions?
Before you leave…
Conference surveys are available online at www.citrixsynergy.com starting
Thursday, May 8 at 9:00 a.m.
ᵒ Provide your feedback by 6:00 p.m. that day to be entered to win one of many prizes
Download presentations starting Monday, May 19, from your My Event
Planning Tool

Weitere ähnliche Inhalte

Was ist angesagt?

How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....Denis Gundarev
 
Mise en place d'un système de messagerie sécurisée pour une PME/PMI
Mise en place d'un système de messagerie sécurisée pour une PME/PMIMise en place d'un système de messagerie sécurisée pour une PME/PMI
Mise en place d'un système de messagerie sécurisée pour une PME/PMIPapa Cheikh Cisse
 
Citrix adc technical overview
Citrix adc   technical overviewCitrix adc   technical overview
Citrix adc technical overviewRoshan Dias
 
NGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX, Inc.
 
Administration des services réseaux
Administration des services réseauxAdministration des services réseaux
Administration des services réseauxFethi Kiwa
 
Advanced Tools and Techniques for Troubleshooting NetScaler Appliances
Advanced Tools and Techniques for Troubleshooting NetScaler AppliancesAdvanced Tools and Techniques for Troubleshooting NetScaler Appliances
Advanced Tools and Techniques for Troubleshooting NetScaler AppliancesDavid McGeough
 
Introduction to Nginx
Introduction to NginxIntroduction to Nginx
Introduction to NginxKnoldus Inc.
 
LTM essentials
LTM essentialsLTM essentials
LTM essentialsbharadwajv
 
Top 10 Reasons Why F5 Makes Sense
Top 10 Reasons Why F5 Makes SenseTop 10 Reasons Why F5 Makes Sense
Top 10 Reasons Why F5 Makes SenseF5 Networks
 
Big ip f5 ltm load balancing methods
Big ip f5 ltm load balancing methodsBig ip f5 ltm load balancing methods
Big ip f5 ltm load balancing methodsUtpal Sinha
 
Tp snmp-packet-tracer
Tp snmp-packet-tracerTp snmp-packet-tracer
Tp snmp-packet-tracerChris Dogny
 
オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~
オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~
オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~vxsejapan
 
Nginx Internals
Nginx InternalsNginx Internals
Nginx InternalsJoshua Zhu
 

Was ist angesagt? (20)

How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
How to hack Citrix (So, You Just Inherited Someone Else's Citrix Environment....
 
HCARevision_Svendeprøve_Rapport
HCARevision_Svendeprøve_RapportHCARevision_Svendeprøve_Rapport
HCARevision_Svendeprøve_Rapport
 
Mise en place d'un système de messagerie sécurisée pour une PME/PMI
Mise en place d'un système de messagerie sécurisée pour une PME/PMIMise en place d'un système de messagerie sécurisée pour une PME/PMI
Mise en place d'un système de messagerie sécurisée pour une PME/PMI
 
802.11w Tutorial
802.11w Tutorial802.11w Tutorial
802.11w Tutorial
 
Citrix adc technical overview
Citrix adc   technical overviewCitrix adc   technical overview
Citrix adc technical overview
 
NGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEANGINX ADC: Basics and Best Practices – EMEA
NGINX ADC: Basics and Best Practices – EMEA
 
CloudStack Networking
CloudStack NetworkingCloudStack Networking
CloudStack Networking
 
Administration des services réseaux
Administration des services réseauxAdministration des services réseaux
Administration des services réseaux
 
Advanced Tools and Techniques for Troubleshooting NetScaler Appliances
Advanced Tools and Techniques for Troubleshooting NetScaler AppliancesAdvanced Tools and Techniques for Troubleshooting NetScaler Appliances
Advanced Tools and Techniques for Troubleshooting NetScaler Appliances
 
Linux05 DHCP Server
Linux05 DHCP ServerLinux05 DHCP Server
Linux05 DHCP Server
 
Introduction to Nginx
Introduction to NginxIntroduction to Nginx
Introduction to Nginx
 
LTM essentials
LTM essentialsLTM essentials
LTM essentials
 
Cryptologie
Cryptologie Cryptologie
Cryptologie
 
Wireshark
WiresharkWireshark
Wireshark
 
Top 10 Reasons Why F5 Makes Sense
Top 10 Reasons Why F5 Makes SenseTop 10 Reasons Why F5 Makes Sense
Top 10 Reasons Why F5 Makes Sense
 
Big ip f5 ltm load balancing methods
Big ip f5 ltm load balancing methodsBig ip f5 ltm load balancing methods
Big ip f5 ltm load balancing methods
 
Tp snmp-packet-tracer
Tp snmp-packet-tracerTp snmp-packet-tracer
Tp snmp-packet-tracer
 
オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~
オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~
オンプレミスからパブリッククラウドへの 移行ツールの最適解 ~Veritas Resiliency Platform(VRP)~
 
Nginx Internals
Nginx InternalsNginx Internals
Nginx Internals
 
Nginx Essential
Nginx EssentialNginx Essential
Nginx Essential
 

Ähnlich wie Syn504 unleashing the power of the net scaler policy and expressions engine - final

Sun certifiedwebcomponentdeveloperstudyguide
Sun certifiedwebcomponentdeveloperstudyguideSun certifiedwebcomponentdeveloperstudyguide
Sun certifiedwebcomponentdeveloperstudyguideAlberto Romero Jiménez
 
06 response-headers
06 response-headers06 response-headers
06 response-headerssnopteck
 
WEB-MODULE 4.pdf
WEB-MODULE 4.pdfWEB-MODULE 4.pdf
WEB-MODULE 4.pdfDeepika A B
 
Lecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.pptLecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.pptTempMail233488
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...WebStackAcademy
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Karel Minarik
 
Restful webservices
Restful webservicesRestful webservices
Restful webservicesKong King
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHPShweta A
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4Ben Abdallah Helmi
 
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best PracticesJitendra Zaa
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Muhamad Al Imran
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Muhamad Al Imran
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsSagara Gunathunga
 
Backend Development - Django
Backend Development - DjangoBackend Development - Django
Backend Development - DjangoAhmad Sakhleh
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersKevin Hazzard
 
Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearchTaylor Lovett
 

Ähnlich wie Syn504 unleashing the power of the net scaler policy and expressions engine - final (20)

Sun certifiedwebcomponentdeveloperstudyguide
Sun certifiedwebcomponentdeveloperstudyguideSun certifiedwebcomponentdeveloperstudyguide
Sun certifiedwebcomponentdeveloperstudyguide
 
06 response-headers
06 response-headers06 response-headers
06 response-headers
 
WEB-MODULE 4.pdf
WEB-MODULE 4.pdfWEB-MODULE 4.pdf
WEB-MODULE 4.pdf
 
qwe.ppt
qwe.pptqwe.ppt
qwe.ppt
 
Lecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.pptLecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.ppt
 
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4... Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 4...
 
Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]Elasticsearch And Ruby [RuPy2012]
Elasticsearch And Ruby [RuPy2012]
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
 
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4
 
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best Practices
 
Elasticsearch as a Database?
Elasticsearch as a Database?Elasticsearch as a Database?
Elasticsearch as a Database?
 
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
Php i basic chapter 3 (syahir chaer's conflicted copy 2013-04-22)
 
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
Php i basic chapter 3 (afifah rosli's conflicted copy 2013-04-23)
 
Php i basic chapter 3
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
 
Java colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rsJava colombo-deep-dive-into-jax-rs
Java colombo-deep-dive-into-jax-rs
 
Backend Development - Django
Backend Development - DjangoBackend Development - Django
Backend Development - Django
 
The ASP.NET Web API for Beginners
The ASP.NET Web API for BeginnersThe ASP.NET Web API for Beginners
The ASP.NET Web API for Beginners
 
Ajax
AjaxAjax
Ajax
 
Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearch
 

Kürzlich hochgeladen

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Kürzlich hochgeladen (20)

Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Syn504 unleashing the power of the net scaler policy and expressions engine - final

  • 1. SYN504 - UNLEASHING THE POWER OF THE NETSCALER POLICY AND EXPRESSIONS ENGINE MAY 6 – 4.00PM Henrik Johansson Twitter: @HenrikJay Web: https://www.ngenx.com || https://henrikjay.com Email: henrik.johansson@ngenx.com || henrik@henrikjay.com
  • 2. Tweet about this session with hashtag #SYN504 and #CitrixSynergy
  • 3. CTP, CCIA and AWS certified Architect. Director of Professional Services. 13+ years Citrix experience,17+ years IT. NetScaler Wizard, Public Cloud, Security, Evangelist and Speaker. Speaker bio compressed Henrik Johansson Twitter: @HenrikJay Web: https://www.ngenx.com || https://henrikjay.com Email: henrik.johansson@ngenx.com || henrik@henrikjay.com
  • 4. Founded in 2000, nGenx is a pioneer in cloud-based application delivery. Throughout our history, we have always pushed the envelope with technology while working to build bridges between all of our technology partners, including Microsoft, Citrix, Cisco, Amazon Web Services, NetApp, RES, Google Chrome, Dell/Compellent, Intuit and others. Working with these partners, we have developed a dynamic set of cloud solutions. nGenx – White label CSP
  • 5. • What is a policy • NetScaler Policies Use cases • Classic vs default • RegEx intro • Optimizing expressions Agenda at a glance
  • 6. • Policies control how a feature evaluate data and thru that determine what action to take for the data thru the use of logical expressions. • A policy can trigger a simple effect like DROP, nothing (NOOP) or a complex action/chain thru profiles. What are NetScaler policies
  • 8. • Enables you to route, modify, control traffic based on: • Phone model, browser type, OS • Control content delivery • Block unsecure features on certain browsers • Can be used to trigger other policies like: • Redirect thru responder, Rewrite, • Example: add responder policy RESP_BLOCK_FF_POL "HTTP.REQ.HEADER("User- Agent").SET_TEXT_MODE(IGNORECASE).CONTAINS("Mozilla")" DROP Use case - Client/browser identification
  • 9. • Enables you actively modify and rewrite content on the fly • For example requested URL’s, text, metadata • Example: add rewrite action RW_RES_CMPMode_ACT insert_before "HTTP.RES.BODY(10000).SUBSTR(”<meta")" q{"<meta http-equiv="X-UA- Compatible" content="IE=EmulateIE7" />"} Use case - Rewrites
  • 10. • Use HTTP CallOut to verify client IP or username • Fetch back end-pages for response replacement. • Can be used to trigger other policies like: • Redirect thru responder, Rewrite, • Example: set policy httpcallout CheckUser –ipaddress 10.10.10.10 –port 80 -returntype text –httpmethod get –urlstemexpr '"/CheckIP&”+HTTP.REQ.USER.NAME"' - resultexpr 'http.res.body(5)' sys.http_callout(CheckUser) Use case - White/blacklisting
  • 11. Only support Classic Support Default • Authentication, Pre-authentication • SSL • Cache redirection • VPN (session, traffic, and tunnel traffic) • Content filtering (use Responder instead) Classic to Default • Application firewall policies • Authorization policies • Named expressions • Compression policies • Content switching policies • User-defined, rule-based tokens/persistency
  • 12. Manual • root@ns# nspepi -e "RES.HTTP.HEADER Content-Type CONTAINS application/msword" • "HTTP.RES.HEADER("Content- Type").AFTER_STR("application/msword").LENGTH.GT(0)” • root@ns# nspepi -e "URL != '/*.gif'" • "HTTP.REQ.URL.REGEX_MATCH(re#/(.*).gif#).NOT” • Is this the most optimal rule? Expression conversion
  • 13. Full config root@ns# cd /nsconfig root@ns# nspepi -f ns.conf OUTPUT: New configuration file created: new_ns.conf OUTPUT: New warning file created: warn_ns.conf root@ns# Expression conversion
  • 14. Remember: • The commands that exceed 1499 character limit must be manually updated. • Multiple classic can share priority 0. Not supported in Default • Error lines shown after command and in warning file • Use as guidance • Test…Test…and when done…Test again! Expression conversion
  • 15. What is RegEx A regular expression is a sequence or pattern of characters that is matched against a string of text when performing searches. NetScaler uses PCRE Patterns are selective and can search any part of the string. Searches can use different entry points and look back and forward RegEx uses delimeters to select text: re~test|test2~ These can be anything that is unique RegEx
  • 16. RegEx Metacharacter Function Example What if Matches ^ Beginning-of-line anchor /^love/ Matches all lines beginning with love $ End-of-line anchor /love$/ Matches all lines ending with love . Matches one character /l..e/ Matches lines containing an l, followed by two characters, followed by an e * Matches zero or more of the preceding characters / *love/ Matches lines with zero or more spaces, followed by the pattern love [] Matches one character in the set /[Ll]ove Matches lines containing love or Love [x-y] Matches one character within a range in the set /[A-Z]ove/ Matches letters from A through Z followed by ove [^] Matches one character not on a set /[^A-Z]/ Matches any character not in the range between A and Z. Used to escape a character /love./ Matches lines containing love, followed by a literal period
  • 17. RegEx Metacharacter Function Definition d Match any digit [0-9] w Match any word character [A-Za-z0-9_] s Match any whitespace character [ tn] D Match any NON-digit [^d] W Match any NON-word character [^w] S Match any NON-whitespace character [^s]
  • 18. Example I have a lovely time on our little picnic. Lovers were all around us. It is springtime. Oh love, how much I adore you. Do you know the extent of my love? Oh, by the way, I think I lost my gloves somewhere out in that field of clover. Did you see them? I can only hope love is forever. I live for you. It's hard to get back in the groove. /ove[^a-zA-Z0-9]/ RegEx
  • 19. • What are you trying to find, don’t evaluate full result • http.req.url.suffix.contains("jpeg”) • http.req.url.suffix.eq("jpeg") • Regex takes more resources, but can match multiple values • Match multiple items in single request • HTTP.REQ.HOSTNAME.SERVER.REGEX_MATCH(re~host1|host2~) • HTTP.REQ.HEADER("Example").AFTER_STR("more”) • Is better then • HTTP.REQ.HEADER("Example").AFTER_REGEX(re/more/) Policy optimization
  • 20. • A PatternSet is an excellent way to match multiple values • Example: Checking for filetypes or hosts add policy patset PatSet_AllowedHosts bind policy patset PatSet_AllowedHosts host1 -index 1 bind policy patset PatSet_AllowedHosts host3 -index 2 HTTP.REQ.HOSTNAME.SET_TEXT_MODE(IGNORECASE).CONTAINS_ANY("PatSet _AllowedHosts")" Policy optimization – PatternSet
  • 21. • StringMap can be used for dynamic renaming add policy stringmap SM_Name bind policy stringmap SM_Name site1.domain.com ”Desktop1" bind policy stringmap SM_Name site2.domain.com “Desktop2” add rewrite action RW_RES_DesktopName_ACT replace_all "HTTP.RES.BODY(100000)" "HTTP.REQ.HOSTNAME.SERVER.MAP_STRING("SM_Name”)" -pattern "re~(Other Desktop)|(Real Desktop)~" -bypassSafetyCheck YES Policy optimization - StringMap
  • 22. • Expression policy simplifies reusing frequently used expressions add policy expression Exp1 "!HTTP.REQ.HOSTNAME.SET_TEXT_MODE(IGNORECASE).CONTAINS_ANY("PatS et_AllowedHosts")" add responder policy RESP_DROP_Unsecure_Hosts_POL Exp1 DROP Policy optimization - ExpressionPolicy
  • 23. • Always use the correct policy expression Example: HTTP.REQ.URL.QUERY Performs better than HTTP.REQ.URL.AFTER_STR("?") which is based on string parsing that have to look thru the whole query Policy optimization – Correct policy
  • 24. • TypeCasting allow you to convert data HTTP.REQ.HEADER("Example").AFTER_STR(",").BEFORE_STR(",") Can be optimized by changing into HTTP.REQ.HEADER("Example").TYPECAST_LIST_T(',').GET(1) SET_TEXT_MODE(IGNORECASE) is excellent when working with rewrite Policy optimization - TypeCasting
  • 25. Citrix NetScaler Policy Expression Reference - Release 10.1 http://support.citrix.com/article/CTX137705 Typecasting http://support.citrix.com/proddocs/topic/ns-main-appexpert-10-1-map/ns- typecasting-data-wrapper-con.html#ns-typecasting-data-wrapper-con Online resources
  • 26. Henrik Johansson Twitter: @HenrikJay Web: https://www.ngenx.com || https://henrikjay.com Email: henrik.johansson@ngenx.com || henrik@henrikjay.com Questions?
  • 27. Before you leave… Conference surveys are available online at www.citrixsynergy.com starting Thursday, May 8 at 9:00 a.m. ᵒ Provide your feedback by 6:00 p.m. that day to be entered to win one of many prizes Download presentations starting Monday, May 19, from your My Event Planning Tool

Hinweis der Redaktion

  1. Info on tweets This session will focus some time on requirements for implementing HDX Insight and why but quickly move on and show live demos How to implement and especially how easy it is.
  2. Will change…
  3. Before moving on with some of the actual code, lets take a look at some use cases for policies and expressions
  4. Before moving on with some of the actual code, lets take a look at some use cases for policies and expressions
  5. Before moving on with some of the actual code, lets take a look at some use cases for policies and expressions