<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Stefano Baronio on Medium]]></title>
        <description><![CDATA[Stories by Stefano Baronio on Medium]]></description>
        <link>https://medium.com/@stefano.baronio?source=rss-6ee565971d0f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QY6S_z0DRuC7AjRCdK6iiQ.jpeg</url>
            <title>Stories by Stefano Baronio on Medium</title>
            <link>https://medium.com/@stefano.baronio?source=rss-6ee565971d0f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 17:23:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@stefano.baronio/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Saving Active Directory from Brute Force: A Two-Phase, RADIUS-First Login on NetScaler]]></title>
            <link>https://medium.com/@stefano.baronio/saving-active-directory-from-brute-force-a-two-phase-radius-first-login-on-netscaler-1a3318460a65?source=rss-6ee565971d0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a3318460a65</guid>
            <category><![CDATA[netscaler-gateway]]></category>
            <category><![CDATA[radius]]></category>
            <category><![CDATA[login-security]]></category>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[netscaler]]></category>
            <dc:creator><![CDATA[Stefano Baronio]]></dc:creator>
            <pubDate>Mon, 20 Jul 2026 15:49:22 GMT</pubDate>
            <atom:updated>2026-07-21T16:32:00.113Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qrKmeLtUhNvTD5KctGbDIw.png" /></figure><p>One of the most common ways attackers get into company accounts is by brute-forcing application login forms.</p><h3>The problem: AD exposed to the internet</h3><p>If your only login is “username + AD password” checked directly against LDAP, every credential-stuffing bot on the internet is one form-submit away from a bind request on your Domain Controller. Two things go wrong:</p><p>- <strong>Compromise risk.</strong> Guess one weak password and the attacker is inside your systems.</p><p>- <strong>Lockout storms.</strong> Even <em>failed</em> guesses can trigger AD account lockouts — which means real users get locked out, the helpdesk melts down, and the attack doubles as a denial-of-service.</p><p>The simplest, cheapest, and most effective fix is structural: <strong>never let an unauthenticated request reach the AD password check at all.</strong></p><h3>The idea: a gate in front (RADIUS first, AD second)</h3><p>We split login into two factors on two different systems:</p><p>- <strong>Page 1 — username + a RADIUS token</strong> (first factor). The token cannot be guessed the way a password can, and RADIUS is cheap and easy to rate-limit. Attackers die here. Crucially, a failed token never generates an LDAP bind, so AD sees no brute-force traffic and no lockouts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Lh6gAJ41s2cZAgcR" /><figcaption>Username and radius/rsa code with customized field label and help message</figcaption></figure><p>- <strong>Page 2 — the AD password</strong> (second factor). This page is only ever shown to someone who already passed the token. By the time AD is asked to validate a password, the request is already trusted enough to be worth the bind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/0*3jjpLII0fCA564br" /><figcaption>domain password with customize help message</figcaption></figure><p>This is defense in depth with a purpose: the first factor exists to protect the second. NetScaler calls this pattern <strong>nFactor authentication</strong>: a chain of factors, each with its own login page (schema) and policy, where success on one factor advances the user to the next.</p><h3>Step 1 — Configure the authentication backends</h3><p>This article cover the two phases login process for a Netscaler Gateway. For readability I use CLI configuration were possible and GUI screenshots where necessary.</p><p>First, define how to talk to each backend: create the RADIUS action and the LDAP action (assumed you already created the LB for the LDAPS servers called lb_ldaps.example.com and created the service account to bind with ldap, in this case svc_netscaler@corp.example.com)</p><pre>add server radius 10.0.0.70<br>add authentication radiusAction Radius_act -serverIP 10.0.0.70 -serverPort 1812 -radKey &lt;shared-secret&gt;</pre><pre>add authentication ldapAction ldap_act1  -serverName lb_ldaps.example.com -serverPort 636 -secType SSL -ldapBase &quot;dc=corp,dc=example,dc=com&quot; -ldapBindDn svc_netscaler@corp.example.com -ldapBindDnPassword &lt;secret&gt; -ldapLoginName sAMAccountName -groupAttrName memberOf -subAttributeName cn</pre><p>The LDAP action binds with a low-privilege <strong>service account</strong>, searches for the user by sAMAccountName, and then binds <em>as that user</em> with their supplied password — over LDAPS (`-secType SSL`, port 636). That is the standard “bind as user” pattern.</p><p><strong>Policies</strong></p><p>Each action gets a policy that decides when to use it. For a simple linear chain, -rule true is sufficient:</p><pre># factor 1<br>add authentication Policy radpol -rule true -action Radius_act <br># factor 2<br>add authentication Policy ldap_pol -rule true -action ldap_act</pre><h3>Step 2 — Create the login schemas (the two pages)</h3><p>Each factor uses a login page defined by an XML file under /nsconfig/loginschema/. You can use the default schemas or customize them with your own messages.</p><p><strong>First page: SingleAuth1 (user + code)</strong></p><p>In the GUI:</p><ul><li>Go to <strong>Security &gt; AAA — Application Traffic &gt; Login Schema &gt; Profiles</strong> tab.</li><li>Click <strong>Add</strong>.</li><li>Give it a name and click the pencil icon in the <strong>Authentication Schema</strong> field.</li><li>In the <strong>Create Authentication Login Schema</strong> dialog, give it a name (for example, SingleAuth1), then open the <strong>LoginSchema</strong> folder and select SingleAuth.xml.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*TDCDi1be_j5yL1HD" /></figure><p>You can now customize this schema:</p><ul><li>Click <strong>Edit</strong> (top right) to change field labels.</li><li>By default, the language is English. If you want another language (or multiple languages), select the language tab you want to customize.</li></ul><p>Example customization for the first factor page:</p><ul><li>File name: <strong>SingleAuth1_schema.xml </strong>(this becomes the XML file name).</li><li>Change the field label from “Password” to “<strong>Code</strong>”.</li><li>Set the help text to “<strong>Your radius code</strong>”.</li><li>Set the assistive text to “<strong>Please supply your username</strong>”.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*vAuZcf2BNme8OnP-" /></figure><p>Click <strong>Save</strong>. A new login schema will appear in the <strong>Create Authentication Login Schema</strong> page (it may take a bit of time to show up).</p><p>To customize multiple languages:</p><ul><li>Select the second language tab.</li><li>Click <strong>Edit</strong>, use the same schema name, and change the labels and messages.</li><li>When asked if you want to replace the file, click <strong>Yes</strong>.</li></ul><p>When you are done, click <strong>Select</strong> (this is important — do not just click <strong>OK</strong>, or the login schema will not be selected). You return to <strong>Configure Authentication Login Schema</strong>; then click <strong>Create</strong>.</p><h3>Second page: OnlyPassword (AD password only)</h3><p>Back in the Login Schema page:</p><ul><li>Click <strong>Add</strong>, give it a name (for example, ldap_page2).</li><li>Click the <strong>Authentication Schema</strong> pencil.</li><li>Open the <strong>LoginSchema</strong> folder and select OnlyPassword.xml.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/587/0*MEKAI_YrTVLbUy6o" /></figure><p>If you do not need to customize the labels or help messages, just click <strong>Select</strong> and you can skip ahead to the warning section below.</p><p>If you need to localize or customize some messages in OnlyPassword.xml, it is a bit tricky: if you only change the text fields, the translation will not work correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/0*rpz0Bqegg0ynxizr" /></figure><p>Example (English first):</p><ul><li>Select the <strong>English</strong> tab and click <strong>Edit</strong>.</li><li>Give it a schema name and change the messages you need.</li><li>For example, to change the help message under the password field, you must invent a label key for this message.</li><li>Delete the original label and use something like:</li></ul><pre>onlypassword1_stepup_msg ${http.req.user.name}</pre><p>Save the login schema.</p><p>Now customize Italian (if needed):</p><ul><li>Select the <strong>Italian</strong> tab and click <strong>Edit</strong>.</li><li>Use the same schema name.</li><li>Under the password field, insert the same message:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*pId41s2wEI2vE-DF" /></figure><pre>onlypassword1_stepup_msg ${http.req.user.name}</pre><p>Click <strong>Save</strong> and confirm replacing the file. Then click <strong>Select</strong> to return to <strong>Configure Authentication Login Schema</strong>.</p><p>If this nFactor flow is fronting a NetScaler Gateway with StoreFront behind it:</p><blockquote><em>Click </em><strong><em>More</em></strong><em>, scroll down, and enable </em><strong><em>Single Sign On Credential</em></strong><em>. This is required to SSO the user into StoreFront.</em></blockquote><p>Click OK, a warning will appear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/0*yLYe7GztHETe8tGx" /></figure><p>Even if you follow the suggestion and adjust the placeholder, the warning tends to persist. Accept it and click <strong>OK</strong>; the configuration still works.</p><p>At this point you have the two login schemas prepared for the two pages.</p><h3>Step 3 — Build the second-factor label and loginSchema policy</h3><p>Now create the policy label for the second factor, bind the LDAP policy to it, and create the loginSchema policy for the first page (SingleAuth1).</p><pre># Create the policy label to bind the second page login schema<br>add authentication policylabel ldap_page2 -loginSchema ldap_page2</pre><pre># bind the ldap policy to the policy label<br>bind authentication policylabel ldap_page2 -policyName ldap_pol -priority 100 -gotoPriorityExpression NEXT</pre><pre># Create the login schema policy to bind the first page login schema (user + code)<br>add authentication loginSchemaPolicy SingleAuth1 -rule true -action SingleAuth1</pre><h3>Step 4 — Create the authentication vServer and profile</h3><p>Create the authentication virtual server, bind the login schemas and policies, and then build an authentication profile for the NetScaler Gateway.Bind or change the authentication profile on the NetScaler Gateway:</p><pre># Create the authentication virtual server<br>add authentication vserver Auth-srv-radius SSL 0.0.0.0</pre><pre># Bind the ssl certificate<br>bind ssl vserver Auth-srv-radius -certkeyName gw.domain.com</pre><pre># Set the ssl profile<br>set ssl vserver Auth-srv-radius -sslProfile ns_default_ssl_profile_frontend</pre><pre># Bind the first page login schema<br>bind authentication vserver Auth-srv-radius -policy SingleAuth1 -priority 100 -gotoPriorityExpression END</pre><pre># Bind the nFactor policies we just created<br>bind authentication vserver Auth-srv-radius -policy radpol -priority 100 -nextFactor ldap_page2 -gotoPriorityExpression NEXT</pre><pre># Create the authentication profile we will bind to the Netscaler Gateway<br>add authentication authnProfile radius_ldap_auth_prof -authnVsName Auth-srv-radius</pre><p>Bind or change the authentication profile on the NetScaler Gateway:</p><pre># Create the vpn vserver gateway<br>add vpn vserver ns-gw-radius SSL 10.0.0.114 443 -icaOnly ON -dtls OFF -Listenpolicy NONE -authnProfile radius_ldap_auth_prof<br># (plus the other things to create a working gateway)<br><br># Or just bind the auth vserver tothe already existint vpn gateway<br>set vpn vserver ns-gw-radius -authnProfile radius_ldap_auth_prof </pre><h3>Step 5 — Final XML and string customizations (optional but important)</h3><p>If you customized login schema labels and help messages, there is one last step: update the XML and translation string files so that the new label keys work properly.</p><p><strong>Edit the OnlyPassword XML</strong></p><p>Edit the /nsconfig/loginschema/OnlyPassword1.xml and adjust the relevant block:</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;AuthenticateResponse xmlns=&quot;http://citrix.com/authentication/response/1&quot;&gt;<br>&lt;Status&gt;success&lt;/Status&gt;<br>&lt;Result&gt;more-info&lt;/Result&gt;<br>&lt;StateContext/&gt;<br>&lt;AuthenticationRequirements&gt;<br>&lt;PostBack&gt;/nf/auth/doAuthentication.do&lt;/PostBack&gt;<br>&lt;CancelPostBack&gt;/nf/auth/doLogoff.do&lt;/CancelPostBack&gt;<br>&lt;CancelButtonText&gt;Cancel&lt;/CancelButtonText&gt;<br>&lt;Requirements&gt;<br>&lt;Requirement&gt;&lt;Credential&gt;&lt;ID&gt;passwd&lt;/ID&gt;&lt;SaveID&gt;ExplicitForms-Password&lt;/SaveID&gt;&lt;Type&gt;password&lt;/Type&gt;&lt;/Credential&gt;&lt;Label&gt;&lt;Text&gt;onlypassword1_password&lt;/Text&gt;&lt;Type&gt;nsg-login-label&lt;/Type&gt;&lt;/Label&gt;&lt;Input&gt;&lt;Text&gt;&lt;Secret&gt;true&lt;/Secret&gt;&lt;ReadOnly&gt;false&lt;/ReadOnly&gt;&lt;InitialValue/&gt;&lt;Constraint&gt;.+&lt;/Constraint&gt;&lt;/Text&gt;&lt;/Input&gt;&lt;/Requirement&gt;<br>&lt;Requirement&gt;&lt;Credential&gt;&lt;Type&gt;none&lt;/Type&gt;&lt;/Credential&gt;&lt;Label&gt;<br>&lt;!-- Change this line: --&gt;<br>          &lt;!-- From: --&gt;<br>&lt;!-- &lt;Text&gt;onlypassword1_hello ${http.req.user.name}, onlypassword_please_enter_password_for_step_up_auth&lt;/Text&gt; --&gt;<br>          &lt;!-- To: --&gt;<br>&lt;Text&gt;onlypassword1_stepup_msg ${http.req.user.name}&lt;/Text&gt;<br><br>&lt;Type&gt;nsg_confirmation&lt;/Type&gt;&lt;/Label&gt;&lt;Input/&gt;&lt;/Requirement&gt;<br>&lt;Requirement&gt;&lt;Credential&gt;&lt;ID&gt;saveCredentials&lt;/ID&gt;&lt;Type&gt;savecredentials&lt;/Type&gt;&lt;/Credential&gt;&lt;Label&gt;&lt;Text&gt;onlypassword1_remember_my_password&lt;/Text&gt;&lt;Type&gt;nsg-login-label&lt;/Type&gt;&lt;/Label&gt;&lt;Input&gt;&lt;CheckBox&gt;&lt;InitialValue&gt;false&lt;/InitialValue&gt;&lt;/CheckBox&gt;&lt;/Input&gt;&lt;/Requirement&gt;<br>&lt;Requirement&gt;&lt;Credential&gt;&lt;ID&gt;loginBtn&lt;/ID&gt;&lt;Type&gt;none&lt;/Type&gt;&lt;/Credential&gt;&lt;Label&gt;&lt;Type&gt;none&lt;/Type&gt;&lt;/Label&gt;&lt;Input&gt;&lt;Button&gt;onlypassword1_log_on&lt;/Button&gt;&lt;/Input&gt;&lt;/Requirement&gt;<br>&lt;/Requirements&gt;<br>&lt;/AuthenticationRequirements&gt;<br>&lt;/AuthenticateResponse&gt;</pre><h3>Edit the English strings</h3><p>For English, edit /var/netscaler/logon/LogonPoint/custom/strings.en.json and adjust the entries:</p><pre>{&quot;singleauth1_schema_user_name&quot;:&quot;User name:&quot;,<br>&quot;singleauth1_schema_password&quot;:&quot;Code:&quot;,<br>&quot;singleauth1_schema_first_factor&quot;:&quot;Your radius code&quot;,<br>&quot;singleauth1_schema_remember_my_password&quot;:&quot;Remember my password&quot;,<br>&quot;singleauth1_schema_log_on&quot;:&quot;Log On&quot;,<br>&quot;singleauth1_schema_please_supply_either_domain\\username_or_user@fully.qualified.domain&quot;:&quot;Please supply your domain username&quot;,<br>&quot;onlypassword1_password&quot;:&quot;Password:&quot;,<br>// Change this:<br>// &quot;onlypassword1_hello ${http.req.user.name},onlypassword_please_enter_password_for_step_up_auth&quot;:&quot;onlypassword1_stepup_msg ${http.req.user.name}&quot;,<br>// To this:<br>&quot;onlypassword1_stepup_msg&quot;:&quot;Insert the domain password for user &quot;,<br><br>&quot;onlypassword1_remember_my_password&quot;:&quot;Remember my password&quot;,&quot;onlypassword1_log_on&quot;:&quot;Log On&quot;<br>}</pre><p>Finally, reload the login schema configuration so NetScaler picks up the updated XML:</p><pre>set authentication loginSchema ldap_page2 -authenticationSchema &quot;/nsconfig/loginschema/OnlyPassword1.xml&quot; -SSOCredentials YES</pre><p>We won’t cover the storefront configuration here.</p><p>Open the NetScaler Gateway login page in a new private browser window and test the full login flow.</p><p>That’s it</p><p>##NetScaler #CitrixADC #CitrixGateway #nFactor #MFA#RADIUS #LDAP #ActiveDirectory #CyberSecurity #AppSecuritynetscaler_nFactor #radius #ldap</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a3318460a65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Netscaler observability (with Splunk)]]></title>
            <link>https://medium.com/@stefano.baronio/netscaler-observability-with-splunk-991ee639b0f2?source=rss-6ee565971d0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/991ee639b0f2</guid>
            <dc:creator><![CDATA[Stefano Baronio]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 10:45:06 GMT</pubDate>
            <atom:updated>2026-06-26T10:45:06.230Z</atom:updated>
            <content:encoded><![CDATA[<p>NetScaler sits at a privileged point in the application delivery path. It sees client connections, HTTP requests, server responses, TLS sessions, routing decisions, and application security signals, which makes it a valuable observability source for understanding how applications are used and how they behave.</p><p>By exporting this data to Splunk, administrators can build a unified operational view that answers practical questions such as:</p><ul><li>Which applications, URLs, and HTTP methods are used most?</li><li>Are users experiencing frontend latency or is the backend responding slowly?</li><li>Which transactions return errors, suffer retransmissions, or show abnormal network behavior?</li><li>Which client sources are associated with failures or security events?</li><li>Can a policy-generated audit event be correlated with the HTTP transaction that triggered it?</li></ul><p>This article compares two NetScaler approaches for collecting that data: traditional Audit Message Actions and Analytics Profiles based on AppFlow. It also shows how HTTP, TCP, audit, and security context can become focused Splunk dashboards for application usage, performance, health, and forensic investigation.</p><h3>Two ways to collect observability data</h3><p>There are two practical ways to extract application-level observability from NetScaler. The traditional method uses policy-triggered Auditing Message Actions. The newer method uses Analytics Profiles to control AppFlow-based exports. They overlap in some areas, but serve different purposes and can also be used together.</p><h3>1) Traditional Auditing Message Actions</h3><p>Auditing Message Actions can be attached as log actions to policies evaluated on request or response traffic. A responder policy can inspect an HTTP request, while a rewrite policy can inspect the corresponding response. NetScaler policy expressions then select exactly which Layer 7 values are written to the log.</p><p>This approach is highly flexible. A custom message can include fields such as:</p><ul><li>client and destination IP addresses</li><li>hostname, URL, query string, HTTP method</li><li>request and response headers</li><li>HTTP status</li><li>TLS cipher</li><li>the load-balancing virtual server</li><li>the backend server</li><li>a transaction identifier</li></ul><p>For example, a request policy can emit a transaction identifier together with selected HTTP fields:</p><pre>add audit messageaction Log_REQ_FlowID INFORMATIONAL \<br>  q/&quot;txn_id=&quot;+HTTP.REQ.TXID+&quot; client_ip=&quot;+CLIENT.IP.SRC+<br>  &quot; method=&quot;+HTTP.REQ.METHOD+&quot; url=&quot;+HTTP.REQ.URL/</pre><pre>add responder policy Log_HTTP_Request true NOOP \<br>  -logAction Log_REQ_FlowID</pre><p>This makes Auditing Message Actions useful for targeted troubleshooting and security use cases. The policy condition does not need to match every request; it can target a login operation, a particular URL, an authentication failure, a suspicious source, or another application-specific event.</p><p>The main limitation is the export model. These records are traditionally delivered as syslog messages, which are effective but less convenient than a structured HTTP and JSON pipeline. The administrator must define and maintain the message format, parse it in the receiving platform, and manage request/response correlation.</p><p>Audit messages also describe policy-visible events rather than providing a full analytics model. They can capture almost any relevant Layer 7 value, but they do not natively provide measurements such as client RTT, server RTT, jitter, retransmissions, or byte counters. Those metrics come from the AppFlow analytics path.</p><p>The following Audit Message Action logs response traffic from the backend server to the client:</p><pre>add audit messageaction Log_RES_FlowID INFORMATIONAL q/&quot;###### __FlowID: &quot;+HTTP.RES.TXID+&quot; __IP-SRC: &quot;+CLIENT.IP.DST+&quot; __IP-DST: &quot;+CLIENT.IP.SRC+&quot; __SysTime: &quot;+SYS.TIME+&quot; __DATE: &quot;+HTTP.RES.DATE+&quot; __Status: &quot;+HTTP.RES.STATUS+&quot; -__ServerIP_SRC: &quot;+SERVER.IP.SRC+&quot; __ServerIP_DST: &quot;+SERVER.IP.DST+&quot; __Full-Header: &quot;+HTTP.RES.FULL_HEADER.REGEX_REPLACE(re!\\r\\n!, &quot; | &quot;, ALL)/</pre><pre>add rewrite policy RW_POL_SysLog_RES true NOREWRITE -logAction Log_RES_FlowID</pre><pre>bind authentication vserver Auth-SRV -policy RW_POL_SysLog_RES -priority 100 -gotoPriorityExpression NEXT -type RESPONSE </pre><pre># With the &#39;true&#39; condition, we are logging EVERY transaction on that vServer</pre><p>**Note 1: here we collect all the response headers, including user session cookie. You might not want to store that in your SIEM indefinitely.</p><p>**Note 2: SRC and DST here are exchanged because we are seeing a response traffic, so the backend server is the CLIENT.IP.DST.</p><h3>2) Analytics Profiles: Structured Application Telemetry</h3><p>In NetScaler 14.1, Analytics Profiles provide a more modern way to govern AppFlow data exports. A profile defines the type of analytics data to collect, the fields to include, the destination collector, and the HTTP endpoint used to deliver it.</p><p>For Splunk integration, NetScaler can send structured JSON directly to the Splunk HTTP Event Collector. This removes the need for an intermediate syslog receiver and gives administrators explicit control over the exported schema.</p><p>Different profile types provide complementary views.</p><p>WebInsight captures HTTP transaction context such as application, hostname, URL, method, status, headers, cookies, content type, TLS data, and transaction identifiers.</p><p>TCPInsight adds transport measurements such as client and server ports, client RTT, server RTT, jitter, retransmissions, and byte counters.</p><p>SecurityInsight and BotInsight can contribute AppFirewall, IP reputation, bot-detection, and related security fields. Time-series profiles can also export audit logs, including events generated by Audit Message Actions.</p><p>Time-series profiles can export audit logs, including events generated by Audit Message Actions</p><p>WebInsight explains what happened at the application layer, while TCPInsight helps explain where time was spent. A slow transaction can be separated into client-side and server-side latency instead of being treated as a single undifferentiated response-time problem.</p><blockquote><em>All Analytics Profiles must reference the same merged schema.json data-format file, regardless of how many profile types are configured. Do not create a separate schema for each WebInsight, TCPInsight, SecurityInsight, or BotInsight profile. In this deployment, assigning different schema files caused analytics export to stop completely, with no events reaching the collector. Build one schema containing every field required by all profiles and reuse it consistently.</em></blockquote><p>The relevant files for the Insight configuration live in /var/analytics_conf directory</p><p>JSON_fields.txt contains the fields available for all the Insight fields</p><p>A section of, let call it splunk_observability.json schema file will looks like:</p><pre>{<br>  &quot;payloadPrefix&quot;: &quot;&quot;,<br>  &quot;eventPrefix&quot;: &quot;{\&quot;host\&quot;:\&quot;netscaler\&quot;,\&quot;event\&quot;:{&quot;, <br>  &quot;fields&quot;: [<br>    &quot;transactionId&quot;,<br>    &quot;cltIpv4Address&quot;,<br>    &quot;cltDstIpv4Address&quot;,<br>    &quot;clientIP&quot;,<br>    &quot;VserverIP&quot;,<br>    &quot;cltSrcPort&quot;,<br>    &quot;cltDstPort&quot;,<br>    &quot;svrIpv4Address&quot;,<br>    &quot;srvSrcPort&quot;,<br>    &quot;srvDstPort&quot;,<br>    &quot;transClntRTT&quot;,<br>    &quot;transSrvrRTT&quot;,<br>    &quot;nsPartitionId&quot;,<br>    &quot;clientMss&quot;,<br>    &quot;clntTcpJitter&quot;,<br>    &quot;clntTcpPacketsRetransmited&quot;,<br>    &quot;srvrTcpPacketsRetransmited&quot;,<br>    &quot;httpReqUrl&quot;,<br>    &quot;httpReqMethod&quot;,<br>    &quot;httpReqHost&quot;,<br>    &quot;httpReqUserAgent&quot;,<br>    &quot;httpContentType&quot;,<br>    &quot;httpReqXForwardedFor&quot;,<br>    &quot;httpRespStatus&quot;,<br>    &quot;httpBody&quot;,<br>    &quot;httpUrl&quot;,<br>    &quot;httpDomainName&quot;,<br>    &quot;appNameVserverLs&quot;,<br>    &quot;httpRspStatus&quot;,<br>    &quot;httpResLocation&quot;,<br>    &quot;httpResSetCookie&quot;,<br>    &quot;httpRspLen&quot;,<br>    &quot;appName&quot;,<br>    &quot;sslCipherValueFE&quot;,<br>    &quot;sslCipherValueBE&quot;,<br>    &quot;sslErrFlag&quot;,<br>    &quot;sslHandshakeErrorMsg&quot;,<br>    &quot;sslErrAppName&quot;,<br>    &quot;mismatchCiphers&quot;,<br>    &quot;unsupportedCiphers&quot;,<br>    &quot;tenantName&quot;,<br>    &quot;AuthSessionID&quot;<br>  ],<br>  &quot;eventSuffix&quot;: &quot;}}&quot;,<br>  &quot;eventDelimiter&quot;: &quot;\n&quot;,<br>  &quot;payloadSuffix&quot;: &quot;&quot;<br>}</pre><blockquote><em>The WebInsight and TCPInsight profiles can be attached to the same application flow because they are different profile types. NetScaler permits only one analytics profile of each type on a given virtual server, so the schema should include all fields required for that profile’s consumers.</em></blockquote><h3>Bringing Audit Messages into the Same Pipeline</h3><p>Analytics Profiles do not make policy-driven audit events obsolete. A time-series profile with audit-log export enabled can carry those messages into the same Splunk HEC pipeline</p><pre>add analytics profile splunk_time_series \<br>  -collectors splunk_service \<br>  -type timeseries \<br>  -outputMode json \<br>  -auditlogs ENABLED \<br>  -analyticsEndpointMetadata &quot;{\&quot;event\&quot;:[&quot; \<br>  -analyticsEndpointUrl &quot;/services/collector/event&quot; \<br>  -analyticsEndpointContentType &quot;application/json&quot;</pre><blockquote><em>Unlike WebInsight and TCPInsight profiles, this audit exporter is global and does not need to be bound to a virtual server. The endpoint metadata is important when using Splunk’s HEC event endpoint because the submitted JSON requires a top-level event field.</em></blockquote><p>The result is a useful hybrid model:</p><ul><li>Analytics Profiles provide structured application and network telemetry.</li><li>Audit Message Actions provide precise, policy-driven business or security events.</li><li>Transaction identifiers allow both records to be correlated in Splunk.</li></ul><h3>Correlating Audit TXIDs with WebInsight Transactions</h3><p>Audit Message Actions can include a transaction identifier in their log message by referencing the policy expression HTTP.REQ.TXID or HTTP.RES.TXID. The returned value has a UUID-like format:</p><pre>TXID --&gt; 0001e09d-d9eb-16a1-9401-00155d969a10</pre><p>WebInsight analytics profiles export a decimal transaction identifier as transactionId:</p><pre>transactionId --&gt; 123037</pre><p>Although these appear to be different identifiers, they are related.</p><p>The TXID UUID is not a standard RFC 4122 version-1 UUID despite its appearance. It encodes internal NetScaler fields in each of the five UUID segments</p><pre>0001e09d-d9eb-16a1-9401-00155d969a10<br> │       │       │    │    │<br> │       │       │    │    └── Bytes 10-15: node identifier<br> │       │       │    │        The base MAC address of the NetScaler<br> │       │       │    │        appliance (e.g. 00:15:5d:96:9a:10).<br> │       │       │    │        Constant for a given appliance.<br> │       │       │    │<br> │       │       │    └── Bytes 8-9: PPE core identifier<br> │       │       │        Identifies which Packet Processing Engine  <br> │       │       │        handled the event. A NetScaler <br> |       |       |        with multiple<br> │       │       │        PPE cores will produce different values<br> │       │       │        for different events, including for the<br> │       │       │        request and response of a <br> |       |       |        single transaction.<br> │       │       │<br> │       │       └── Bytes 6-7: variant<br> │       │           Clock-sequence variant<br> │       │<br> │       └── Bytes 4-5: clock sequence [?]<br> │<br> │<br> └── Bytes 0-3: transaction counter<br>     A hex value that, when converted to decimal, equals the WebInsight transactionId. In this example: 0x0001e09d = 123037.</pre><p>The first eight hexadecimal characters of the TXID are the transaction counter. Converting them to decimal produces the WebInsight transactionId. This was verified by capturing raw HEC payloads from NetScaler and comparing Audit Message Action TXIDs with WebInsight transactionId values for the same source IP, time window, and HTTP request.</p><h3>Request vs response TXID</h3><p>HTTP.REQ.TXID and HTTP.RES.TXID refer to the same transaction but produce different UUIDs when the request and response are handled by different PPE cores. The transaction counter (bytes 0–3) is shared, but the PPE core identifier (bytes 8–9) changes:</p><pre>Request on  PPE 0x9401: 0001e09d-d9eb-16a1-9401-00155d969a10<br>Response on PPE 0x8402: 0001e09d-d9eb-16a1-8402-00155d969a10<br>           same counter ^^^^^^^^           ^^^^ different core</pre><p>Both convert to the same decimal value (`123037`) and therefore match the same WebInsight transactionId. For transaction correlation, only the transaction counter is required; the PPE core identifier can be ignored.</p><h3>Why Splunk works well</h3><p>Splunk HEC is a natural destination for NetScaler Analytics Profiles. NetScaler sends JSON over HTTP or HTTPS, Splunk indexes the events, and search-time rules normalize the different WebInsight, TCPInsight, security, bot, and audit fields.</p><p>This integration has three major advantages:</p><ul><li>Easy ingestion: a HEC token and collector endpoint provide a direct path from NetScaler to Splunk without requiring an intermediate syslog server.</li><li>Flexible interpretation: Splunk field extractions, calculated fields, macros, and lookups can normalize data without changing the NetScaler configuration for every dashboard requirement.</li><li>Complete context: HTTP activity, transport metrics, policy-generated audit events, and security signals can be searched and correlated in one place.</li></ul><p>Some normalization is still necessary. Different analytics types may expose client identity through different fields, and an X-Forwarded-For value should not automatically be trusted. The key idea is to distinguish the network peer observed by NetScaler from a client address claimed in an HTTP header, and only treat the header-derived address as effective when the peer is on a trusted-proxy allowlist.</p><h3>How the dashboards fit together</h3><p>Once normalized, the data supports several operational perspectives rather than one oversized dashboard. Administrators can begin with a traffic overview, move into individual HTTP transactions, isolate frontend or backend latency, review application error rates, and finally investigate source attribution or security events.</p><h3>Overview</h3><p>The Overview dashboard is the starting point. It shows request volume by application, traffic trends, HTTP status distribution, active client sources, and recent transactions.</p><p>An audit indicator identifies transactions that also triggered an Audit Message Action. Selecting it opens the application transaction and its policy-generated audit event together, giving immediate context without requiring a separate log search.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YYZ_y9eW_v0zQ4fc" /></figure><h3>HTTP transactions</h3><p>This dashboard provides a transaction-level view of application usage. Administrators can filter by time, source IP, URL, status code, or HTTP method and inspect:</p><ul><li>requested applications URLs</li><li>request methods, response status codes</li><li>client and proxy-header evidence</li><li>TLS and HTTP metadata</li><li>NetScaler transaction identifiers</li><li>correlated Audit Message Actions.</li></ul><blockquote><em>It is useful both for routine usage analysis and for reconstructing a specific request.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*tr38jPYs6igQP7Yg" /></figure><p>The “x” in the audit column indicates that an Audit Message exists for that transaction. Clicking it displays both the HTTP transaction and the Audit Message it triggered.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MoEcTjAcVwVb8Hxi" /></figure><h3>Application performance</h3><p>The Application Performance dashboard combines HTTP context with TCP measurements. Its key value is the separation of</p><ul><li>frontend latency, represented by client RTT</li><li>backend latency, represented by server RTT.</li></ul><p>This distinction helps determine whether a slow user experience is associated with the client-side network path or with the application and its backend infrastructure.</p><p>The dashboard can also highlight slow URLs and client-server peer combinations, with detailed rows including jitter, retransmissions, byte counters, and normalized ports.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/0*DOLEhXW9JKzx72ol" /></figure><p>By clicking on the IP address of the ‘Slowest Client-Server Peer’ section, a new dashboard will open that shows the latency history between the two</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zhqPWwU6nu5nteKP" /></figure><h3>Application health</h3><p>Application Health focuses on HTTP outcomes. It presents total requests, error count, error rate, status-class trends, error distribution, and the URLs generating the most failures.</p><p>Separating 4xx and 5xx responses is especially useful. A rise in 4xx errors may indicate invalid client behavior or authentication problems, while 5xx errors are more likely to point toward application or backend failures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vqsg3d4XAgE7Ushc" /></figure><h3>Client and security forensics</h3><p>The forensic dashboard combines application activity with source-attribution and security evidence. It distinguishes:</p><ul><li>the source peer directly observed by NetScaler</li><li>a client address reported through proxy headers</li><li>a trusted client address derived through an approved proxy</li><li>an untrusted or potentially spoofed header claim.</li></ul><p>It then correlates the selected source with URLs, methods, User-Agent values, TLS metadata, transaction IDs, and available AppFirewall, bot, or IP-reputation fields.</p><p>This is not about identifying a person from a single technical value. It is about building an evidence timeline and a defensible attribution level so administrators know how much confidence to place in the result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/881/0*niijBMsZYtS9QR3m" /></figure><p>Clicking an IP address displays the transactions associated with address</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iZUdn50TmzJ6xEsk" /></figure><p>This is not intended to identify a person from a single technical value. Instead, it provides an evidence timeline and a defensible attribution level — direct, trusted proxy, untrusted header, or missing source — so administrators know how much confidence to place in the result.</p><p>Together, these dashboards form an investigation path:</p><ul><li>Detect unusual traffic, errors, or activity in Overview</li><li>Inspect the affected requests in HTTP Transactions</li><li>Use Application Performance to locate frontend or backend delay</li><li>Use Application Health to analyze failing URLs and status patterns</li><li>Use Client and Security Forensics to assess source identity and related security signals.</li></ul><h3>Conclusion</h3><p>NetScaler can provide much more than appliance health and connection counters. Because it processes application traffic directly, it can expose how applications are used, where latency occurs, which requests fail, and what client or security evidence surrounds each transaction.</p><p>Traditional Audit Message Actions remain valuable when an administrator needs precise, policy-driven events. They can capture selected Layer 7 details for a login, error, suspicious request, or other application-specific condition. Their limitations are the traditional syslog-oriented delivery model and the absence of native performance metrics.</p><p>Analytics Profiles extend this model with structured AppFlow telemetry and direct HTTP/JSON export. WebInsight supplies application context, TCPInsight adds client-side and server-side measurements, and security-oriented profiles contribute further evidence. A time-series profile can also bring existing Audit Message Actions into the same Splunk pipeline.</p><p>The most useful design is not a choice between audit messages and Analytics Profiles. It is a combination of both: use Analytics Profiles for broad, structured observability and use Audit Message Actions for the specific business and security conditions that matter to the application.</p><h3>Tech stuff</h3><p>We have already covered the REWRITE policies that can log the required data through Audit Message Actions, so this section focuses on Analytics Profiles.</p><p>The first step is to define the data you want to export based on the fields available in the /var/analytics_conf/JSON_fields.txt file.</p><p>Next, create the schema file shown above. In this example, it is called:</p><p>/var/analytics_conf/splunk_observability.json</p><p>Next, create the collector. Netscaler needs to know where to send the data.</p><pre># Add the splunk server<br>add server splunk 10.0.0.71</pre><pre># Create the service<br>add service splunk_service splunk HTTP 8088 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport YES -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA YES -TCPB NO -CMP NO </pre><pre># [ Create the authorization token on splunk before this step ]<br># [The Splunk token needs the prefix &#39;Splunk &#39; when you create profile]</pre><pre># Create the analytics profile<br>add analytics profile splunk_observability -collectors splunk_service -type webinsight -httpClientSideMeasurements ENABLED -httpPageTracking ENABLED -httpURL ENABLED -httpHost ENABLED -httpMethod ENABLED -httpReferer ENABLED -httpUserAgent ENABLED -httpCookie ENABLED -httpLocation ENABLED -urlCategory ENABLED -allHttpHeaders ENABLED -httpContentType ENABLED -httpAuthentication ENABLED -httpVia ENABLED -httpXForwardedForHeader ENABLED -httpSetCookie ENABLED -httpSetCookie2 ENABLED -httpDomainName ENABLED -httpURLQuery ENABLED -dataFormatFile splunk_observability.json -analyticsAuthToken &quot;Splunk 123456789abcdefg&quot; -analyticsEndpointUrl &quot;/services/collector/event&quot; -analyticsEndpointContentType &quot;application/json&quot;</pre><pre># Bind it to the vServer you want. You can bind it at Global level eventually.<br>bind analytics global splunk_observability</pre><pre># The time series profile (that adds the Audit Message Actions)<br>add analytics profile splunk_time_series -collectors splunk_service -type timeseries -outputMode json -auditlogs ENABLED -schemaFile splunk_observability.json -analyticsEndpointMetadata &quot;{\&quot;event\&quot;:[&quot; -dataFormatFile splunk_observability.json -analyticsAuthToken &quot;Splunk 123456789abcdefg&quot; -analyticsEndpointUrl &quot;/services/collector/event&quot; -analyticsEndpointContentType &quot;application/json&quot;</pre><pre># The time series profile does not need to be bound anywhere, it is up and running at GLOBAL level when you create it.</pre><p>Now you need to create your own Splunk Dashboards</p><p>Happy observation!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=991ee639b0f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing a Lightweight SOAR Solution for Citrix NetScaler with n8n.io]]></title>
            <link>https://medium.com/@stefano.baronio/introducing-a-lightweight-soar-solution-for-citrix-netscaler-with-n8n-io-df5698559c38?source=rss-6ee565971d0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/df5698559c38</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[netscaler]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[ddos-protection]]></category>
            <dc:creator><![CDATA[Stefano Baronio]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 15:54:44 GMT</pubDate>
            <atom:updated>2025-09-01T16:01:54.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pNE1Sm3LhYpXNuIi" /></figure><p>Greetings, defenders of the digital realm! Tired of manually blocking those pesky attackers hitting your NetScaler? I feel your pain. That’s why I cooked up this cool little SOAR system that does all the heavy lifting for you.</p><p>Let’s call it a Lightweight Security Orchestration, Automation, and Response (SOAR) module specifically tailored for Citrix NetScaler environments. This solution proposes a HTTP rate-limiting attack protection as an example, but it isn’t limited to just these DOS attacks — it’s highly adaptable to various threat scenarios.</p><p>I know, I know — you’ve got the world’s most glittering external IP database, fresh off the press from a whole 5 minutes ago! But what about this army of homeless IPs roaming around, desperately seeking evil hackers to give them purpose in life? We need to be ready.</p><p>While some of these workflow capabilities overlap with NetScaler Bot Management, this solution operates differently and expands beyond its inherent limitations. This laboratory exercise aims to showcase the extensive possibilities provided by integrating n8n with Citrix NetScaler.</p><p>For those unfamiliar, <a href="https://n8n.partnerlinks.io/3uv6z7oipivj">n8n.io</a> is a leading open-source automation platform offering versatile solutions both on-premises and in the cloud.</p><h3>The Features</h3><ul><li><strong>Bulk configuration</strong> of a set of Netscalers by putting their nsip in a Google Sheet.</li><li><strong>Dynamic Attack Response</strong>: Real-time modification of Netscaler configuration to block threats (don’t panic, it’s just adding and removing IPs in Datasets and managing Datasets, you are in charge of the policies).</li><li><strong>Automatic Dataset Management:</strong> Datasets for IP blocking are managed dynamically without manual intervention. It notifies you via email when new datasets are created (so you can add them to the policies). For the more adventurous, it’s possible to develop a workflow that automatically modifies policies following the creation of a new dataset. Please note: datasets are only added, they won’t be deleted automatically. Again, with a new workflow….</li><li><strong>Scheduled IP Unblocking:</strong> IP addresses blocked temporarily are cleared automatically after a configurable TTL (Time-To-Live).</li><li><strong>Bidirectional Synchronization:</strong> Engineers can manually modify blocked IPs directly on NetScaler, with automatic syncing back to the central database.</li><li><strong>Google Sheets Configuration:</strong> Centralized configuration management through Google Sheets simplifies updates and maintenance.</li></ul><h3>Initial NetScaler Configuration</h3><p>How this baby works: Netscaler talking to n8n.</p><p>So here’s the deal — we’re gonna use NetScaler’s HTTP Callout feature to chat with the outside world (our n8n setup). Think of it as NetScaler saying “Hey, I caught a bad guy!” and n8n replying “I’ve got you covered!”</p><p>This whole setup is perfect for those annoying rate-limiters. You know, NetScaler can already rate-limit these pests, but why stop there? Let’s put them in digital jail for a while. Depending on where you bind these policies, you can block these troublemakers globally or just on specific vServers.</p><p>We assume that n8n is put behind a reverse proxy (<a href="http://n8n.domain.com/">n8n.domain.com</a>) that encrypts via SSL the connection on standard port 443. We will not explain the certs creation and installation here.</p><p>Before starting, ensure NetScaler devices have these basic configurations:</p><ul><li>Add a Server with n8n FQDN (e.g. n8n.domain.com)</li><li>Set the service and the vServer (n8n-svc.domain.com and n8n-lb.domain.com)</li><li>HTTP Callout: Connect NetScaler with n8n workflows. The URL called depends on the n8n webhook workflow.</li><li>Responder Policies: Detect and respond to threats like Rate Limiting, Failed Logins, etc..</li></ul><p>NetScaler friendly CLI commands are at the end of the article, where the Tech Stuff lies.</p><h3>Workflow Deep Dive</h3><h3>1. Initialization Workflow (Bulk Configuration):</h3><p>This workflow gets the configuration data from a Google Sheet, though other data sources can also be integrated.</p><p>Key Features:</p><ul><li><strong>Automatically</strong> sets essential configuration variables on NetScaler, ensuring consistency across deployments.</li><li><strong>Centralized management</strong> of TTL (Time To Live) values for blocked IPs, eliminating the need for manual updates directly on NetScaler and guaranteeing uniform policy enforcement.</li></ul><p>Example Configuration Data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/0*AGuZeUIv_ydjiKRE" /></figure><p><strong>Important Notes:</strong></p><ul><li>Column headers are hard-coded into the workflows, you shouldn’t touch them! However, you can customize variable names and dataset naming conventions to your preference.</li><li>Datasets are automatically named by the workflow — for instance in this case, block_ip_list_1, block_ip_list_2, and so forth.</li><li>The TTL for blocked IP addresses is specified in minutes.</li></ul><p><strong>Security Considerations:</strong></p><ul><li>n8n includes an integrated mechanism for securely storing credentials in an encrypted database. This mechanism is used for Google Sheets, PostgreSQL, and NetScaler credentials.</li><li>n8n Enterprise plan gives you access to remote secrets manager (eg. Hashicorp Vault), plus a number of other features.</li></ul><p>In this scenario, it is assumed that a single NetScaler user, possessing adequate privileges to create Netscaler variables, datasets, and manage IP bindings, is configured and valid across all Netscaler instances listed in the Google Sheet.</p><p>Netscaler friendly CLI commands at the end of the article.</p><p>Here’s the picture of the Init workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*hTR_W5K5QrwgHETFPLuF_w.png" /></figure><h3>2. Queue Workflow:</h3><p>The First Line of Defense: Catching Those Troublemakers in Action!</p><p>The queue workflow listens to the Netscaler HTTP Callout and will populate the Postgres queue database table.</p><ul><li><strong>The Digital Doorman</strong>: Our queue workflow stands vigilant 24/7, listening for those NetScaler HTTP Callouts like a bouncer at an exclusive club.</li><li><strong>Smart Traffic Cop</strong>: The queue table acts as our brilliant buffer zone, keeping the “hearing about problems” part totally separate from the “dealing with problems” part. This way, even if processing gets backed up, we never miss a beat on incoming threats!</li><li><strong>Repeat Offender Recognition</strong>: Already seen this IP causing trouble? No problem! The system smartly updates timestamps for these persistent pests rather than creating duplicate entries.</li><li><strong>VIP Waiting List</strong>: New troublemakers get efficiently queued up for processing, ensuring everyone gets the special attention they deserve (though not the kind they were hoping for!).</li></ul><p>This clever setup means your system stays resilient even when under heavy fire. If something hiccups downstream, all that juicy threat data stays safely tucked away until your system can deal with it properly. Think of it as your digital panic room where threat data goes to hide during the chaos!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMuQQB0z4PWzfc_FYfldbw.png" /></figure><h3>3. Processing Workflow:</h3><p>The Heart of the System: Processing Those Pesky IPs</p><p>So what happens behind the scenes once our system spots a naughty IP? The magic happens on autopilot, thanks to a built-in scheduler that kicks things off:</p><ul><li><strong>Database Treasure Hunt</strong>: First, we dig through the database to find all those unprocessed IPs waiting in line.</li><li><strong>Smart Dataset Sorting</strong>: Each IP gets automatically sorted into the right dataset bucket. If all the buckets are full? No problem! We just create a shiny new one on the fly.</li><li><strong>Keeping Things Tidy</strong>: We’re neat freaks about our datasets. They’ll never get too crowded since we cap them (normally at 50,000 IPs per dataset, but we’ve dialed it down to just 3 for testing — wouldn’t want to block half the internet while we’re experimenting, right?).</li><li><strong>Real-Time Protection</strong>: As soon as we spot trouble, we’re on it! The system updates NetScaler’s config instantly, so those troublemakers don’t get a chance to cause more mischief.</li><li><strong>Keeping Score</strong>: Every IP we process gets flagged as “handled” in our database, giving us a crystal-clear trail of what’s happened. Think of it as our system’s diary where it logs all its heroic deeds!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kKxKXJYE-paT32qDXGl2gg.png" /></figure><h3>4. Clearing Workflow:</h3><p>The Cleanup Crew: Taking Out the Digital Trash</p><p>What happens to all those blocked IPs after they’ve served their time in digital jail? That’s where our cleanup routine comes in:</p><ul><li><strong>Automatic Parole Board</strong>: Our system regularly scans for IPs that have done their time (based on their TTL). No need for a human to review each case!</li><li><strong>Spring Cleaning</strong>: Once an IP’s sentence is up, we quietly escort it out of the NetScaler dataset and update our counters. No muss, no fuss — they’re free to go (unless they misbehave again, of course).</li><li><strong>Keeping Everything Tidy</strong>: The system makes sure our database and NetScaler are always on the same page.</li><li><strong>Certificate of Conduct</strong>: the ‘operation_log’ database table will keep trace of each and every action taken towards an IP, we know who you are and what you have done!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7wVGOVXWAJ1acWV0xUxagA.png" /></figure><h3>5. Synchronization Workflow:</h3><p>The Peacekeeper: Keeping Everyone on the Same Page</p><p>What happens when your security team can’t wait and makes emergency changes directly on Netscaler? No worries — our digital diplomat has got you covered:</p><ul><li><strong>Emergency Override Friendly</strong>: Go ahead and make those urgent blocks directly in Netscaler when you’re in firefighting mode, because you hadn’t had the time to set up the right Netscaler policies yet.</li><li><strong>Automatic Reconciliation</strong>: Our system plays detective, noticing those manual changes and syncing them back to our central database. It’s like having a friend who fixes your bookshelf after you frantically grabbed that reference book during a video call.</li><li><strong>Smart Recognition</strong>: The system is picky about what it syncs — it only grabs blocked IPs and datasets that follow our naming patterns. That way, it won’t mess with your other NetScaler configurations or try to sync things it shouldn’t!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AqrBV9sKrEXD9yFqgMF_QQ.png" /></figure><h3>Benefits of Implementing this Lightweight SOAR Initiative</h3><ul><li><strong>Reduced Response Time</strong>: Automate the detection-to-mitigation lifecycle, significantly accelerating your response to some security threats.</li><li><strong>Operational Efficiency:</strong> Minimize manual interventions, enabling security teams to dedicate their efforts to more strategic, high-value activities.</li><li><strong>Enhanced Security Posture:</strong> Provide immediate responses to emerging threats, thereby safeguarding your critical infrastructure and resources more effectively.</li><li><strong>Flexible and Scalable:</strong> This approach can be easily adapted to address evolving threat scenarios and scales naturally with the growth of your infrastructure.</li><li><strong>Audit Trail:</strong> Comprehensive logging of all system operations. This provides all necessary data for comprehensive analytics and visualization.</li></ul><h3>Implementing the System</h3><p>To implement this system, you’ll need:</p><ul><li>An n8n server with an added Postgres instance (docker is your friend)</li><li>Access to your Citrix NetScaler via its API</li><li>A Google account for the configuration spreadsheet</li></ul><p>The implementation process involves:</p><ul><li>Creating the <a href="http://n8n.domain.com/">n8n.domain.com</a> reverse proxy for the n8n instance</li><li>Setting up the database tables (database-schema.sql provided)</li><li>Importing the n8n workflows</li><li>Configuring the NetScaler API credentials</li><li>Setting up Google API key for you email account (if using google email and Google Sheets)</li><li>Running the initialization workflow</li><li>Testing the system with a sample IP block request</li></ul><h3>Tech stuff</h3><p>Netscaler config example:</p><pre># Add the n8n backend<br>add server n8n.domain.com n8n.domain.com</pre><pre># Add a service for the n8n backend<br>add service n8n-svc.domain.com n8n.domain.com SSL 443 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport YES -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA YES -TCPB NO -CMP YES</pre><pre># Set the SSL profile on the service<br>set ssl service n8n-svc.domain.com -sslProfile ns_default_ssl_profile_backend</pre><pre># Add the LB vServer<br>add lb vserver n8n-lb.domain.com SSL 10.0.0.43 443 -persistenceType NONE -cltTimeout 180</pre><pre># Set the SSL profile to the vServer<br>set ssl vserver n8n-lb.domain.com -sslProfile ns_default_ssl_profile_frontend</pre><pre>#Bind the service to the vServer<br>bind lb vserver n8n-lb.domain.comt n8n-svc.domain.com</pre><pre>#Bind the SSL certificate<br>bind ssl vserver n8n-lb.domain.com -certKeyName n8n.domain.com</pre><pre># Add a HTTP Callout to the n8n webhook<br>add policy httpCallout ratelimit_callout -vServer n8n-lb.domain.com -returnType BOOL -hostExpr &quot;HTTP.REQ.HEADER(\&quot;Host\&quot;)&quot; -urlStemExpr &quot;\&quot;/webhook-test/netscaler_rate_limit_webhook\&quot;&quot; -parameters ip(CLIENT.IP.SRC) attack_type(&quot;ratelimit&quot;) nsip(SYS.NSIP) -scheme https </pre><pre># Add a rate-limit identifier as example<br>add ns limitIdentifier sf_ratelimit -threshold 10 -timeSlice 600 -selectorName Top_CLIENTS</pre><pre># Add a Responder Action that calls the HTP Callout<br>add responder action sf_ratelimit_action respondwith &quot;SYS.NON_BLOCKING_HTTP_CALLOUT(ratelimit_callout)&quot;</pre><pre># Add a Responder Policy that gets the rate limit and trigger the action<br>add responder policy sf_ratelimit_pol &quot;SYS.CHECK_LIMIT(\&quot;sf_ratelimit\&quot;)&quot; sf_ratelimit_action NOOP </pre><pre># Bind the Responder Policy to a vServer (e.g. lb_storefront), can be bound to global for every vServer.<br>bind lb vserver storefront -policyName sf_ratelimit_pol -priority 90 -gotoPriorityExpression END -type REQUEST</pre><pre># The Responder (DROP) policy<br>add responder policy &quot;block_malicious_ips&quot; &quot;CLIENT.IP.SRC.CONTAINS_ANY(\&quot;block_ip_list_1\&quot;)&quot; DROP</pre><pre># Bind that policy where you want, e.g. to a vServer:<br>bind lb vserver &lt;vserver_name&gt; -policyName block_malicious_ips -priority 10 -gotoPriorityExpression END -type REQUEST</pre><pre># or globally:<br>bind responder global block_malicious_ips 10 END -type REQUEST</pre><pre>##########################################################<br>Please note: the Responder (DROP) policy must be bound with the higher priority as it must be triggered first<br>##########################################################</pre><p>Netscaler user creation</p><p>As a start, the following, limited, user privileges should work (not tested!).</p><pre># Add user<br>add system user n8n_block_IP 5b07e7c518466298e40db4 -encrypted -externalAuth DISABLED -timeout 900 -maxsession 20 -allowedManagementInterface API</pre><pre># Add Command Policy<br>add system cmdPolicy n8n_block_IP ALLOW &quot;(^save\\s+ns\\s+config)|(^save\\s+ns\\s+config\\s+.*)|(^add\\s+ns\\s+variable)|(^add\\s+ns\\s+variable\\s+.*)|(^set\\s+ns\\s+variable)|(^set\\s+ns\\s+variable\\s+.*)|(^add\\s+policy\\s+dataset)|(^add\\s+policy\\s+dataset\\s+.*)|(^bind\\s+policy\\s+dataset)|(^bind\\s+policy\\s+dataset\\s+.*)|(^unbind\\s+policy\\s+dataset)|(^unbind\\s+policy\\s+dataset\\s+.*)&quot;</pre><pre>bind system user n8n_block_IP n8n_block_IP 1</pre><p>If you’re curious about how to implement this system in your infrastructure, drop me a message and get connected.</p><p>Originally published on Linkedin</p><p><a href="https://www.linkedin.com/pulse/introducing-lightweight-soar-solution-citrix-n8nio-stefano-baronio-rjclf/?trackingId=lPH8f8UWQk%2Boiz%2BUTcjnRw%3D%3D">https://www.linkedin.com/pulse/introducing-lightweight-soar-solution-citrix-n8nio-stefano-baronio-rjclf/?trackingId=lPH8f8UWQk%2Boiz%2BUTcjnRw%3D%3D</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df5698559c38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Disaster Recovery Sync for Citrix NetScaler with n8n]]></title>
            <link>https://medium.com/@stefano.baronio/automating-disaster-recovery-sync-for-citrix-netscaler-with-n8n-5a9704dea838?source=rss-6ee565971d0f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a9704dea838</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[disaster-recovery]]></category>
            <category><![CDATA[high-availability]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[netscaler]]></category>
            <dc:creator><![CDATA[Stefano Baronio]]></dc:creator>
            <pubDate>Mon, 01 Sep 2025 15:12:37 GMT</pubDate>
            <atom:updated>2025-09-01T16:03:27.207Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*fC1JS9N3jgnvRKKk" /></figure><h3>Automating Configuration Sync for Your DR Citrix NetScaler ADCs</h3><p><em>The Workflows Unleashed</em></p><p>Imagine duplicating every config change you make in production by hand just to keep your DR site aligned. Tedious, error-prone, and definitely not how you want to spend your time. That’s exactly the problem automation solves. In this article, we’ll dive straight into the workflows that make your DR setup run smoothly — and let you sleep at night.</p><p>But first, a couple of business considerations</p><h3>1. The Cost of Duplicating Management Services</h3><p>Running a DR site isn’t just about spinning up another VPX. It also means spending countless hours manually repeating every change made in production — monitoring rules, backup policies, alerts, configuration updates. Every tweak in prod has to be mirrored in DR, and that constant replication quickly turns into a heavy drain on your team’s time (and budget).</p><h3>2. Automation: Fast ROI</h3><p>That’s where automation comes in. With this NetScaler sync project powered by n8n, you can stop burning hours on repetitive updates and let the system do the work. Configs stay aligned automatically, engineers reclaim valuable time. Most importantly, you’re cutting costs by removing tasks that add no real business value — a faster return on investment for both your team and your DR strategy.</p><h3>What We Can Do with n8n</h3><h3>Think of n8n as your DR butler:</h3><ul><li>It politely checks in with the production Console: <em>“How are things today?”</em></li><li>It updates the DR VPXs whenever changes are needed.</li><li>It keeps a detailed diary in Postgres of everything it does.</li></ul><p><strong>Remember</strong>: this isn’t just about duplicating the <strong>ns.conf</strong>. It’s about replicating the entire VPX configuration — <strong>certificates, Themes, login schemas, and more</strong>.</p><h3>Assumptions and Requirements</h3><p>There are a few assumptions and requirements we need to cover before moving ahead with this solution.</p><p>Assumptions:</p><ol><li>The DR site has the same network schema of the production one. Hence, the VPX have the same network interfaces and VLAN configured.</li><li>You follow Citrix best practices: two production NetScaler Consoles in HA mode, with a single DR NetScaler Console in the DR site.</li><li>OR, you use the NetScaler Console Service with two NetScaler Agents per site. The logic works the same, but it’s simpler to manage because you don’t need manual intervention to switch the NetScaler license server.</li><li>Here we’re talking about NetScaler VPX, but the process works with all NetScaler ADC platforms (VPX, MPX, CPX). However, you cannot mix a production MPX with a DR VPX (not tested).</li><li>n8n will always communicate with the production NetScaler Console HA system (the floating IP) and use it as a proxy for all VPXs. In the diagram, we placed the n8n system in the DR site, but it can be located anywhere — as long as it can communicate with the production NetScaler Console HA.</li><li>Configuration is stored in a Google Sheet document.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*HYhS0BEsxXma0-T2" /></figure><p>In this case we will have:</p><ul><li><strong>primary_network:</strong> the production network class where the Netscaler ADC are placed</li><li><strong>dr_network</strong>: the DR network NATted as presented to the Netscaler Console (Service)</li><li><strong>description</strong>: a free-text description</li><li><strong>maintenance_mode</strong>: a toggle to put the entire system into maintenance mode (no config syncs). You can also set the maintenance window here</li></ul><p><strong>Requirements</strong>:</p><ol><li>Tested in the lab with the latest NetScaler VPX and Console firmware 14.1–47.46. It should also work with the latest 13.1 release.</li><li>You cannot register two NetScaler VPXs with the same IP address (NSIP). You must NAT the DR ADCs before registering them to the NetScaler Console Service.</li><li>We use NetScaler Console Tags to mark which ADCs should be synced with their DR pairs. Other systems (e.g., ServiceNow) could be used.</li><li>Licenses must be in place for all NetScaler ADCs (production and DR).</li><li>The DR NetScaler ADCs are already up and running and registered with the Production NetScaler Console, even though their configuration is empty.</li><li>DR Netscaler Console cannot be NATted from the Production ones otherwise it won’t register with them. Its VLAN must be routed to the DR site. Here’s an high-level network diagram</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*6LvXtKMiUUe-ZiT5" /></figure><h3>The Workflows</h3><h3>Init Workflow — The scout.</h3><p>It looks at production, finds all VPXs with the dr=true tag, and registers them in the n8n DR database. Manages the Maintenance Windows. Clean, neat, and no surprises.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*ayr00zhMZuAEJJIj" /></figure><h3>Status Workflow — the watchdog</h3><p>This one’s split into three little watchdogs. It first gathers information about the production VPXs, then triggers three sub-workflows to check the Tag, Instance State, and Instance Mode.</p><ul><li>Active Tag — Did the admin disable the dr_active tag in production? Cool, we won’t bother syncing that VPX (maybe it’s on a spa day getting a firmware upgrade).</li><li>Instance State — UP or DOWN? If a VPX is DOWN, we don’t waste time trying to sync it.</li><li>Instance Mode — NITRO API <em>ns_config_replicate</em> is picky. We need to know exactly which DR VPX is Primary, because that’s the one we sync to. This workflow keeps DR aligned with production’s HA roles.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*Nu8-k-1xJMNYXdX4" /></figure><h3>Bulk Sync Workflow — the heavy lifter</h3><p>When it’s time for a full refresh, this workflow is triggered either when the DR tag is set back to active or by a scheduled job (for example, overnight).</p><p>It begins by collecting the NetScaler NSIPs to be synchronized. Since the sync process can take up to a couple of hours, the workflow retrieves the Task ID and checks its status later on.</p><p>The configuration replication Nitro API endpoint requires as input the two production (source) NetScaler VPXs and the Primary DR VPX as the target. Because it’s the Primary, the configuration will automatically propagate to its HA pair. For this reason, we must ensure that the target remains in Primary mode throughout the entire sync process.</p><p>Steps involved in the workflow:</p><ol><li>Grab the production VPX backup.</li><li>Reset the DR VPX configuration.</li><li>Set the DR VPX HA mode to STAYPRIMARY (to prevent failovers while syncing).</li><li>Start the configuration replication from production and record the Task ID.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*I1jDGO1ke5P3USFB" /></figure><h3>DR Tasks Workflow — the finisher</h3><p>It monitors the tasks. Periodically gets the Tasks information from the database and check its status by querying the Netscaler Console HA. If the TASK is complete, update the database log, set HA back to Enable and save the config.</p><ul><li>Keep an eye on the replication until it’s finished</li><li>Flip the HA mode back to ENABLE</li><li>Save the new DR config on replicated VPX</li></ul><p>Job done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*cMtvyPhBt7t-8wKa" /></figure><h3>5. The Dashboard</h3><p>All of this would be chaos without visibility. That’s why there’s a dashboard that shows you, at a glance:</p><ul><li>Which VPXs are tagged for DR.</li><li>Which are UP/DOWN.</li><li>Sync progress, errors, and completion.</li></ul><p>Instead of scrolling logs, you get a cockpit view of your DR syncs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*D76pnLRhYdUpL9co" /></figure><p>With a ‘View All’ modal page that details the operations been done and In Progress</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BrwsWr8LsbLFuPLX" /></figure><p>You can even Retry the replica operation in case of Failure.</p><h3>Wrap-Up</h3><p>So there you have it — the workflows that keep DR humming in the background. Manual switch, automated sync, full audit trail, and a dashboard to keep it all under control.</p><p>Curious what this could look like in your organisation? Message me if you’d like to explore it for your setup.</p><p>Originally published on Linkedin at:</p><p><a href="https://www.linkedin.com/pulse/pain-we-dont-talk-abut-part-3-stefano-baronio-bkt9f/?trackingId=iZ0siA%2B2v1bJk1dGZgpgmw%3D%3D">https://www.linkedin.com/pulse/pain-we-dont-talk-abut-part-3-stefano-baronio-bkt9f/?trackingId=iZ0siA%2B2v1bJk1dGZgpgmw%3D%3D</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a9704dea838" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>