This article describes how to mask sensitive information in a URL using the rewrite feature on the NetScaler appliance.
The following example summarizes the security risk associated when users can view sensitive information on the Web browsers. When users access a certain EMR application, they click on a link on the EMR application to access EKG images hosted on the EKG server or Radiology images hosted on PACS servers. The users receive a HTTP 302 redirect containing the URL to the EKG image or Radiology image with the patient ID embedded in the Location header of the HTTP 302 redirect response from the EMR application. Users can modify the Patient ID and access images of other patients. This is a security risk if proper authorization is not configured.
You can configure the rewrite feature on the NetScaler appliance to intercept the response and encrypt the sensitive information within the URL in the Location header. Then, the users cannot view the sensitive information in the Web browser in clear text. You can also use the rewrite feature to decrypt the requests before forwarding them to the actual application to ensure a valid response.
Run the following commands to configure a connection proxy to the backend EMR application:
enable ns feature lb add service svc_emrwebtest_http_80 <<ipaddress of EMR>> HTTP 80 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport YES -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA NO -TCPB NO -CMP NO add lb vserver vip_emrwebtest-poc_http_80 HTTP <<EMR VIP>> 80 -persistenceType COOKIEINSERT -timeout 0 -persistenceBackup SOURCEIP -backupPersistenceTimeout 30 -cltTimeout 180 bind lb vserver vip_emrwebtest-poc_http_80 svc_epicwebtest_http_80
Run the following commands to configure a service to the backend EKG server:
add service svc_ekgtest_http_80 <<ipaddress of EKG>> HTTP 80 -gslb NONE -maxClient 0 -maxReq 0 -cip DISABLED -usip NO -useproxyport YES -sp OFF -cltTimeout 180 -svrTimeout 360 -CKA NO -TCPB NO -CMP NO add lb vserver vip_ekgtest-poc_http_80 HTTP <<EKG/PACS VIP>> 80 -persistenceType COOKIEINSERT -timeout 0 -persistenceBackup SOURCEIP -backupPersistenceTimeout 30 -cltTimeout 180 bind lb vserver vip_ekgtest-poc_http_80 svc_ekgtest_http_80
Run the following command to enable the rewrite feature on the appliance:
enable ns feature rewrite
Run the following command to add a rewrite action to encrypt the PID in the URL in the HTTP 302 response received from the EMR application:
add rewrite action Encrypt_PID_Query replace "HTTP.RES.HEADER(\"Location\").AFTER_STR(\"GetReport.asp?PID=\").BEFORE_STR(\"&Server\")" "HTTP.RES.HEADER(\"Location\").AFTER_STR(\"GetReport.asp?PID=\").BEFORE_STR(\"&Server\").ENCRYPT
Run the following commands to add the rewrite policy and bind it at a global level:
add rewrite policy Encrypt_response_query "HTTP.RES.HEADER(\"Location\").AFTER_STR(\"GetReport.asp?\").CONTAINS(\"PID=\")" Encrypt_PID_Query bind rewrite global Encrypt_response_query 10 END -type RES_DEFAULT
Run the following commands to decrypt the request sent from the end users to the EKG/PACS application server:
add rewrite action Decrypt_PID_Query replace "HTTP.REQ.URL.AFTER_STR(\"GetReport.asp?PID=\").BEFORE_STR(\"&Server\")" "HTTP.REQ.URL.AFTER_STR(\"GetReport.asp?PID=\").BEFORE_STR(\"&Server\").DECRYPT" -bypassSafetyCheck YES
Run the following command to add a rewrite policy and to bind it at a global level:
add rewrite policy Decrypt_Location_Query "HTTP.REQ.METHOD.EQ(\"GET\") && HTTP.REQ.URL.CONTAINS(\"GetReport.asp\")" Decrypt_PID_Query bind rewrite global Decrypt_Location_Query 20 END -type REQ_DEFAULT
After the configuration is complete, the network flow appears as shown in the following image:
Citrix eDocs - Rewrite