ICAP for remote content inspection
ICAP on a NetScaler appliance
How ICAP request modification (REQMOD) works
-
Sends back a modified version of the request and the appliance in turn sends the modified request to the back-end origin server or it pipelines the modified request to another ICAP server.
-
Responds with a message indicating no adaptation is required.
-
Returns an error and the appliance in turn sends the error message back to the user.
How ICAP response modification (RESPMOD) works
-
Sends a modified version of the response and the appliance in turn sends the response to the user or pipelines the response to another ICAP server.
-
Responds with a message indicating no adaptation is required.
-
Returns an error and the appliance in turn sends the error message to the user.
ICAP license
Configure ICAP for content transformation service
To enable content inspection
enable ns feature contentInspection LoadBalancing
Add ICAP profile
ICAP.RES is used in the content inspection callout return expression. This expression evaluates the ICAP response similar to the HTTP.RES expression in a HTTP_CALLOUT.
add ns icapProfile <name> [-preview ( ENABLED | DISABLED )][-previewLength <positive_integer>] -uri <string> [-hostHeader <string>] [-userAgent <string>] -Mode ( REQMOD | RESPMOD )[-queryParams <string>] [-connectionKeepAlive ( ENABLED | DISABLED )][-allow204 ( ENABLED | DISABLED )] [-insertICAPHeaders <string>][-insertHTTPRequest <string>] [-reqTimeout <positive_integer>][-reqTimeoutAction <reqTimeoutAction>] [-logAction <string>]
add icapprofile reqmod-profile -mode RESPMOD -uri “/req_scan” -hostHeader “Webroot.reqsca” -useragent “NS_SWG-Proxy”
add ns icapProfile icap_prof1 -uri "/example" -Mode REQMOD -reqtimeout 4 -reqtimeoutaction BYPASS
> add icapProfile reqmode-profile -uri '/example' -mode REQMOD -insertHTTPRequest q{HTTP.REQ.METHOD + " " + HTTP.REQ.URL + " HTTP/1.1\r\n" + "Host: " + HTTP.REQ.HOSTNAME + "\r\n\r\n"}
Support for HTTP/2 in Content Inspection (ICAP Mode)
-inspectHTTP2 parameter in the ICAP profile:
add icapprofile <user-defined-name> -mode REQMOD -uri “<user-defined>” -inspectHTTP2 enabled
add icapprofile icap_prof1 -mode REQMOD -uri "/echo" -inspectHttp2 enabled
add icapprofile <user-defined-name> -mode RESPMOD -uri “<user-defined>” -inspectHTTP2 enabled
add icapprofile icap_prof2 -mode RESPMOD -uri "/echo" -inspectHttp2 enabled
Log ICAP content inspection action
add audit messageaction icap_log_expr INFORMATIONAL icap.res.full_header
set icapProfile reqmode-profile -logAction messageaction
Add ICAP service as a TCP or SSL_TCP service
add service <name> <IP> <serviceType> <port>
add service icapsv1 10.10.10.10 SSL_TCP 1345
add service icapsv2 10.10.10.11 SSL_TCP 1345
Add a TCP or SSL_TCP based load balancing virtual server
add lb vserver <name> <serviceType> <port>
add lb vserver vicap TCP 0.0.0.0.0 –persistenceType NONE -cltTimeout 9000
add lb vserver vicap SSL_TCP 0.0.0.0 0 –persistenceType NONE -cltTimeout 9000
Bind ICAP service to the load balancing virtual server
bind lb vserver <name> <serviceName>
bind lb vserver vicap icapsv1
Add content inspection action
ifserverdown parameter for the appliance to perform any one of the following actions.
add contentInspection action <name> -type ICAP -serverName <string> -icapProfileName <string>
add ContentInspection action <name> -type ICAP -serverip <ip> - serverport <port> -icapProfileName <string>
\<-serverip> option. When adding the Content Inspection action, the TCP service is automatically created for the given IP address with port 1344 and it is used for ICAP communication.
add ContentInspection action ci_act_lb -type ICAP -serverName vicap -icapProfileName icap_reqmod
add ContentInspection action ci_act_svc -type ICAP -serverName icapsv1 -icapProfileName icap_reqmod
add ContentInspection action ci_act_svc -type ICAP -serverip 1.1.1.1 - serverport 1344 -icapProfileName icap_reqmod
Add content inspection policies
add contentInspection policy <name> -rule <expression> -action <string>
add ContentInspection policy ci_pol_basic –rule true –action ci_act_svc
add ContentInspection policy ci_pol_HTTP –rule HTTP.REQ.URL.CONTAINS(“html”) –action ci_act_svc
Bind content inspection policies to the content switching or load balancing virtual server
Configure secured ICAP service
-
Add SSL-based TCP service.
-
Bind SSL-based TCP service to load balancing virtual server of type TCP or SSL_TCP.
-
Bind SSL-based TCP service or load balancing virtual server to Content Inspection action.
Add SSL-based TCP service to load balancing virtual server
-
Add SSL-based TCP service.
-
Bind SSL-based TCP service to load balancing virtual server of type TCP or SSL_TCP.
Add SSL-based TCP service to load balancing virtual server
add service <name> <IP> <serviceType> <port>
add service icapsv2 10.102.29.200 SSL_TCP 1344 –gslb NONE –maxclient 0 –maxReq 0 –cip DISABLED –usip NO –useproxport YES –sp ON –cltTimeout 9000 –svrTimeout 9000 –CKA NO –TCPB NO –CMP NO
Bind SSL-based TCP service to SSL_TCP or TCP load balancing virtual server
bind lb vserver <name> <serviceName>
bind lb vserver vicap icapsv2
Bind SSL-based TCP service or load balancing virtual server to the Content Inspection action
add contentInspection action <name> -type ICAP -serverName <string> -icapProfileName <string>
add ContentInspection action ci_act_svc -type ICAP -serverName icapsv2 -icapProfileName icap_reqmod
add ContentInspection action ci_act_svc -type ICAP -serverName vicap -icapProfileName icap_reqmod
Configure ICAP protocol by using the GUI
-
Navigate to Load Balancing > Services and click Add.
-
In the Services page, enter the service details.
-
Navigate to Load Balancing > Virtual Servers. Add a load balancing virtual server of type HTTP/SSL. Or, you can select a virtual server and click Edit.
-
After entering the server basic details, click Continue.
-
In the Advanced Settings section, click Policies.
-
Go the Policies section and click the Pencil icon to configure the Content Inspection policy.
-
On the Choose Policy page, select Content Inspection. Click Continue.
-
In the Policy Binding section, click + to add a Content Inspection policy.
-
In the Create ICAP Policy page, enter a name for the policy.
-
In the Action field, click the "+" sign to add an ICAP action.
-
In the Create ICAP Action page, enter a name for the action.
-
Enter a name for the action.
-
In the Server Name field, enter the name of the TCP service already created.
-
In ICAP Profile field, click the "+" sign to add an ICAP profile.
-
In the Create ICAP Profile page, enter a profile name, URI, and MODE.
-
Click Create.
-
In the Create ICAP Action page, click Create.
-
In the Create ICAP Policy page, enter “true” in the Expression Editor and then click Create.
-
Click Bind.
-
When prompted to enable the Content Inspection feature, click Yes.
-
Click Done.
Configure secured ICAP protocol by using the GUI
-
Navigate to Load Balancing > Services and click Add.
-
In the Services page, enter the service details.
-
Navigate to Load Balancing > Virtual Servers. Add a virtual server of type HTTP/SSL. Or, you can select a virtual server and click Edit.
-
After entering the server basic details, click Continue.
-
In the Advanced Settings section, click Policies.
-
Go the Policies section and click the Pencil icon to configure the Content Inspection policy.
-
On the Choose Policy page, select Content Inspection. Click Continue.
-
In the Policy Binding section, click + to add a Content Inspection policy.
-
In the Create ICAP Policy page, enter a name for the policy.
-
In the Action field, click the "+" sign to add an ICAP action.
-
In the Create ICAP Action page, enter a name for the action.
-
Enter a name for the action.
-
In the Server Name field, enter the name of the TCP_SSL service already created.
-
In ICAP Profile field, click the "+" sign to add an ICAP profile.
-
In the Create ICAP Profile page, enter a profile name, URI, and MODE.
-
Click Create.
-
In the Create ICAP Action page, click Create.
-
In the Create ICAP Policy page, enter “true” in the Expression Editor and then click Create.
-
Click Bind.
-
When prompted to enable the Content Inspection feature, click Yes.
-
Click Done.
Audit log support for remote content inspection
<Source IP> <Destination IP> <Domain> <ICAP server IP><ICAP Mode> <Service URI> <ICAP response> <Policy action>
Apr 18 14:45:41 <local0.info> 10.106.97.104 04/18/2018:14:45:41 GMT 0-PPE-0 : default CI ICAP_LOG 788 0 : Source 10.102.1.98:39048 - Destination 10.106.97.89:8011 - Domain 10.106.97.89 - Content-Type application/x-www-form-urlencoded - ICAP Server 10.106.97.99:1344 - Mode REQMOD - Service /example - Response 204 - Action FORWARD
Apr 18 12:34:08 <local0.info> 10.106.97.104 04/18/2018:12:34:08 GMT 0-PPE-0 : default CI ICAP_LOG 71 0 : Source 10.106.97.105:18552 - Destination 10.106.97.99:80 - Domain NA - Content-Type NA - ICAP Server 10.106.97.99:1344 - Mode RESPMOD - Service /example - Response 400 - Action Internal Error