ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
SYN504 - UNLEASHING THE POWER OF THE
NETSCALER POLICY AND EXPRESSIONS ENGINE
MAY 6 ¨C 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 ¨C 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 ¨Cipaddress 10.10.10.10 ¨Cport 80 -returntype
text ¨Chttpmethod get ¨Curlstemexpr '"/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 ¨C 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 ¨C 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

More Related Content

What's hot (7)

ASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg File
SAP Technology
?
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
Rodolfo Assis (Brute)
?
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
wahidullah mudaser
?
DNS hijacking using cloud providers ¨C No verification needed
DNS hijacking using cloud providers ¨C No verification neededDNS hijacking using cloud providers ¨C No verification needed
DNS hijacking using cloud providers ¨C No verification needed
Frans Ros¨¦n
?
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
Ali MasudianPour
?
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
Gregory Boissinot
?
??? ??? ???? ??? ????
??? ???   ???? ??? ??????? ???   ???? ??? ????
??? ??? ???? ??? ????
King Saud University
?
ASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg File
SAP Technology
?
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
wahidullah mudaser
?
DNS hijacking using cloud providers ¨C No verification needed
DNS hijacking using cloud providers ¨C No verification neededDNS hijacking using cloud providers ¨C No verification needed
DNS hijacking using cloud providers ¨C No verification needed
Frans Ros¨¦n
?
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
Ali MasudianPour
?
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
Gregory Boissinot
?

Similar to Syn504 unleashing the power of the net scaler policy and expressions engine - final (20)

Sun certifiedwebcomponentdeveloperstudyguide
Sun certifiedwebcomponentdeveloperstudyguideSun certifiedwebcomponentdeveloperstudyguide
Sun certifiedwebcomponentdeveloperstudyguide
Alberto Romero Jim¨¦nez
?
06 response-headers
06 response-headers06 response-headers
06 response-headers
snopteck
?
WEB-MODULE 4.pdf
WEB-MODULE 4.pdfWEB-MODULE 4.pdf
WEB-MODULE 4.pdf
Deepika A B
?
Lecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.pptLecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.ppt
TempMail233488
?
qwe.ppt
qwe.pptqwe.ppt
qwe.ppt
Heru762601
?
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 webservices
Kong King
?
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
Shweta A
?
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4
Ben Abdallah Helmi
?
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best Practices
Jitendra Zaa
?
Elasticsearch as a Database?
Elasticsearch as a Database?Elasticsearch as a Database?
Elasticsearch as a Database?
Amazon Web Services
?
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
Php i basic chapter 3Php i basic chapter 3
Php i basic chapter 3
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-rs
Sagara Gunathunga
?
Backend Development - Django
Backend Development - DjangoBackend Development - Django
Backend Development - Django
Ahmad 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 Beginners
Kevin Hazzard
?
Ajax
AjaxAjax
Ajax
Yoga Raja
?
Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearch
Taylor Lovett
?
06 response-headers
06 response-headers06 response-headers
06 response-headers
snopteck
?
Lecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.pptLecture 15 - MySQL- PHP 1.ppt
Lecture 15 - MySQL- PHP 1.ppt
TempMail233488
?
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 webservices
Kong King
?
Introduction To PHP
Introduction To PHPIntroduction To PHP
Introduction To PHP
Shweta A
?
SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4SCWCD : The servlet container : CHAP : 4
SCWCD : The servlet container : CHAP : 4
Ben Abdallah Helmi
?
Apex Testing and Best Practices
Apex Testing and Best PracticesApex Testing and Best Practices
Apex Testing and Best Practices
Jitendra 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-rs
Sagara Gunathunga
?
Backend Development - Django
Backend Development - DjangoBackend Development - Django
Backend Development - Django
Ahmad 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 Beginners
Kevin Hazzard
?
Wordpress search-elasticsearch
Wordpress search-elasticsearchWordpress search-elasticsearch
Wordpress search-elasticsearch
Taylor Lovett
?

Recently uploaded (20)

How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
ScyllaDB
?
Gojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptxGojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptx
V3cube
?
Transform Your Future with Front-End Development Training
Transform Your Future with Front-End Development TrainingTransform Your Future with Front-End Development Training
Transform Your Future with Front-End Development Training
Vtechlabs
?
Wondershare Dr.Fone Crack Free Download 2025
Wondershare Dr.Fone Crack Free Download 2025Wondershare Dr.Fone Crack Free Download 2025
Wondershare Dr.Fone Crack Free Download 2025
maharajput103
?
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Jonathan Bowen
?
What Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI AgentsWhat Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI Agents
Zilliz
?
Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025
kherorpacca00126
?
Q4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor PresentationQ4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor Presentation
Dropbox
?
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
?
[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps
[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps
[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps
Safe Software
?
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
ScyllaDB
?
Technology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptxTechnology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptx
kaylagaze
?
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIATHE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
Srivaanchi Nathan
?
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial PresentationMIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND CTI
?
Wondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 LatestWondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 Latest
udkg888
?
UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2
DianaGray10
?
BoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is DynamicBoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is Dynamic
Ortus Solutions, Corp
?
Unlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤EUnlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤E
Expeed Software
?
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
?
UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1
DianaGray10
?
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
How Discord Indexes Trillions of Messages: Scaling Search Infrastructure by V...
ScyllaDB
?
Gojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptxGojek Clone Multi-Service Super App.pptx
Gojek Clone Multi-Service Super App.pptx
V3cube
?
Transform Your Future with Front-End Development Training
Transform Your Future with Front-End Development TrainingTransform Your Future with Front-End Development Training
Transform Your Future with Front-End Development Training
Vtechlabs
?
Wondershare Dr.Fone Crack Free Download 2025
Wondershare Dr.Fone Crack Free Download 2025Wondershare Dr.Fone Crack Free Download 2025
Wondershare Dr.Fone Crack Free Download 2025
maharajput103
?
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Formal Methods: Whence and Whither? [Martin Fr?nzle Festkolloquium, 2025]
Jonathan Bowen
?
What Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI AgentsWhat Makes "Deep Research"? A Dive into AI Agents
What Makes "Deep Research"? A Dive into AI Agents
Zilliz
?
Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025Brave Browser Crack 1.45.133 Activated 2025
Brave Browser Crack 1.45.133 Activated 2025
kherorpacca00126
?
Q4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor PresentationQ4 2024 Earnings and Investor Presentation
Q4 2024 Earnings and Investor Presentation
Dropbox
?
Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4Build with AI on Google Cloud Session #4
Build with AI on Google Cloud Session #4
Margaret Maynard-Reid
?
[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps
[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps
[Webinar] Scaling Made Simple: Getting Started with No-Code Web Apps
Safe Software
?
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
30B Images and Counting: Scaling Canva's Content-Understanding Pipelines by K...
ScyllaDB
?
Technology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptxTechnology use over time and its impact on consumers and businesses.pptx
Technology use over time and its impact on consumers and businesses.pptx
kaylagaze
?
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIATHE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
THE BIG TEN BIOPHARMACEUTICAL MNCs: GLOBAL CAPABILITY CENTERS IN INDIA
Srivaanchi Nathan
?
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial PresentationMIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND Revenue Release Quarter 4 2024 - Finacial Presentation
MIND CTI
?
Wondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 LatestWondershare Filmora Crack 14.3.2.11147 Latest
Wondershare Filmora Crack 14.3.2.11147 Latest
udkg888
?
UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2UiPath Automation Developer Associate Training Series 2025 - Session 2
UiPath Automation Developer Associate Training Series 2025 - Session 2
DianaGray10
?
BoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is DynamicBoxLang JVM Language : The Future is Dynamic
BoxLang JVM Language : The Future is Dynamic
Ortus Solutions, Corp
?
Unlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤EUnlock AI Creativity: Image Generation with DALL¡¤E
Unlock AI Creativity: Image Generation with DALL¡¤E
Expeed Software
?
World Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a CrossroadsWorld Information Architecture Day 2025 - UX at a Crossroads
World Information Architecture Day 2025 - UX at a Crossroads
Joshua Randall
?
UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1UiPath Automation Developer Associate Training Series 2025 - Session 1
UiPath Automation Developer Associate Training Series 2025 - Session 1
DianaGray10
?

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 ¨C 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 ¨C 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 ¨Cipaddress 10.10.10.10 ¨Cport 80 -returntype text ¨Chttpmethod get ¨Curlstemexpr '"/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 ¨C 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 ¨C 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

Editor's Notes

  • #3: 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.
  • #4: Will change¡­
  • #9: Before moving on with some of the actual code, lets take a look at some use cases for policies and expressions
  • #10: Before moving on with some of the actual code, lets take a look at some use cases for policies and expressions
  • #11: Before moving on with some of the actual code, lets take a look at some use cases for policies and expressions