Deploying a Java IAST agent
You can deploy an IAST agent on the application server that supports Java, .NET, Node.js or PHP based applications. This section explains how to create a Java agent type on your web server.
Before you begin
The simplest and most effective way to use IAST is to deploy it as a
WAR
file servlet on your web server. When this is not possible, for example when running IAST on
a Quarkus framework, the IAST agent can be installed as a Java agent using a
JAR file.Support: Only web application servers
running JRE/JDK 1.8 or higher are supported.
- If the server where IAST is running is behind a proxy:
- For a transparent proxy, use any one of the following Java properties when
running the server:
- Standard Java
properties:
-Dhttps.proxyHost={proxy_ip} -Dhttps.proxyPort={proxy_port} - Custom Java
properties:
-DIast.proxyHost={proxy_ip} -DIast.proxyPort={proxy_port} - Environment
variables:
IAST_PROXY_HOST={proxy_ip} IAST_PROXY_PORT={proxy_port}
- Standard Java
properties:
- If a certificate is needed to communicate externally (for example, to pass a
transparent proxy), supply a valid certificate and run the following command to
import it to the keystore:Note: If you have installed JRE with default settings, the keystore name is
cacertsand it is protected by the passwordchangeit. Otherwise, replace the-storepass,-keystore, and-filevalues with your own.keytool.exe -import -storepass "changeit" -keystore "C:\Program Files (x86)\Java\jre1.8.0_144\lib\security\cacerts" -alias certificate.cer -file "C:\certificate.cer" -noprompt
- For a transparent proxy, use any one of the following Java properties when
running the server:
- For IAST agent versions prior to 1.14.2, if both the compile-time and the runtime
Java versions are 9 or higher, add the following flag to the java run
command:
–Djava.lang.invoke.stringConcat=BC_SB
Procedure
-
Download the ASoC Java IAST agent:
- Follow the instructions provided here to download the agent.
-
Extract the ZIP file:
- Unzip the downloaded file to access its contents.
-
Deploy the IAST agent:
Option A: Deploy as a WAR servlet:
- Locate the WAR file:
- Find
Secagent.warin the root directory of the extracted ZIP file.
- Find
- Deploy your server:
- Tomcat server / Jetty server: Copy
Secagent.war to your
webappsfolder, or deploy it as you would any other WAR servlet. - WebSphere server: Deploy Secagent.war
as a web application, not as an enterprise application. Ensure
the context root is set to
/Secagent. - WebSphere Liberty server / Open Liberty server: Copy
Secagent.war to the
dropinsfolder, or deploy it as usual. - Jboss/WildFly server / JBoss EAP server: Copy Secagent.war to the deployments folder, or deploy it as you would any other WAR servlet.
- Weblogic: Deploy Secagent.war as you would any other WAR servlet.
- Tomcat server / Jetty server: Copy
Secagent.war to your
- Verify deployment:
- Open a web browser and navigate to
http://<server address>/Secagent. - If the Secagent page opens, the agent has been successfully deployed.
- The IAST agent will monitor requests and report security issues as you use or test your application (run functional tests, run a Dynamic Scan, or explore the app manually).
- Open a web browser and navigate to
Use this method if deploying the IAST agent as a WAR file is not possible (e.g., when using the Quarkus framework).
- Locate the JAR file:
- Find
secagent.jarin thejar_deploymentfolder.
- Find
- Add the Java agent to your application:
- Command line option: Add the following flag to your
application's command line:
-Djavaagent:<path to secagent.jar>
- Environment variable option: Set the
JAVA_TOOL_OPTIONS environment variable:
set JAVA_TOOL_OPTIONS=-javaagent:<path to secagent.jar>
- Command line option: Add the following flag to your
application's command line:
- Verify deployment:
- Check the
stdoutfor messages starting with "[IAST Secagent]". - If these messages appear, the agent has been successfully installed.
- The IAST agent will monitor requests and report security issues as you use or test your application (run functional tests, run a Dynamic Scan, or explore the app manually).
- Check the
- Locate the WAR file:
Running a Java agent with security manager
About this task
You can run the Java agent with security manager:
- As a war file on Tomcat or
- As a jar file on servers other than Tomcat. Contact the AppScan support team for guidance.
To run the Java agent with security manager as war on Tomcat:
Procedure
-
Locate the catalina.policy file.
The catalina.policy file is usually located in the Tomcat installation configuration directory. The exact path might vary depending on your operating system and Tomcat version.
- Open the catalina.policy file in a text editor.
-
Locate the "grant" block.
Look for a block starting with the keyword "grant" followed by one or more "permission" statements.
-
Add the required permissions as follows:
- Save the catalina.policy file.
- Restart the Tomcat server to apply the changes.