Deploying the AcuSensor agent for Java - Docker Generic in Acunetix 360

You can use AcuSensor to carry out interactive security testing (IAST) in your web application to confirm more vulnerabilities and further minimize false positives.

For AcuSensor to operate, you need to download an agent and deploy it on your server. Please note that this agent is generated uniquely for each target website for security reasons.

This topic explains how to download and deploy AcuSensor to a Java web application.

if_Gnome-Dialog-Information-64_55568.png

Information

AcuSensor for Java requires Tomcat (7+) and Java (1.7+). Current testing is with Tomcat 9 and Java 1.8. Also, the AcuSensor requires:

  • Deploying aspectjweaver.jar into your web server - provides the integration required for AcuSensor to work with your application
  • Deploying the AcuSensor Java into your web server.
  • Configuring your web server to use Load Time Weaving (AspectJWeaver)

if_Gnome-Dialog-Information-64_55568.png

Information

Since your docker container can be built from a variety of different templates, the file locations (path) may be different. This document assumes the following:

  • The docker container was built with "FROM tomcat:9.0-alpine".
  • The docker container name is "mycontainer" - you will have to substitute with your docker container's name
  • You will be using version 1.9.5 (latest at time of writing) of AspectJWeaver.

  1. Deploying AspectJWeaver into your web application

  • Open a terminal
  • Run the following commands to download and deploy AspectJWeaver:

  1. Deploying AcuSensor into your web application

  • Download the AcuSensor for Java
  • Copy the AcuSensor (acusensor.jar) to %TOMCAT-HOME%\lib
  • If deploying to a docker container, copy the Acusensor.jar file to /usr/local/tomcat/lib/ using the command: docker cp acusensor.jar mycontainer:/usr/local/tomcat/lib/
  1. Configure Tomcat to use AspectJWeaver and AcuSensor

  • Launch Tomcat with Load Time Weaving enabled. This can be done by adding a -javaagent parameter with the path to aspectjweaver.jar when launching Tomcat, and optionally a parameter to enable AcuSensor debug logging

  • For a docker container, add 2 parameters into the Tomcat setenv.sh script - this assumes that this file does not exist within the docker container:

  • Run the following command: nano setenv.sh
  • At the end of the file, add the line JAVA_OPTS="$JAVA_OPTS -javaagent:/usr/local/tomcat/lib/aspectjweaver.jar -Dacusensor.debug.log=ON"
  • Save the file
  • Move the file into the docker container:
  • docker cp setenv.sh mycontainer:/usr/local/tomcat/bin/
  • Restart the container: docker restart mycontainer

if_Gnome-Dialog-Information-64_55568.png

Information

The parameter "-Dacusensor.debug.log=ON" is optional and should ONLY be used for troubleshooting purposes. If this parameter is retained, this will output AcuSensor logging as additional lines in the Tomcat logs starting with "[Acunetix-debug]".

Disabling and Removing AcuSensor for Java

To remove and disable the sensor from your website you need to revert the changes done during the deployment of the Agent:

  • Remove the AcuSensor (AcuSensor.jar) from the folder where it was deployed. In the case of a docker environment, run the following command:
  • docker exec mycontainer rm /usr/local/tomcat/lib/Acusensor.jar
  • Remove aspectjweaver.jar; run the following commands:
  • docker exec mycontainer rm /usr/local/tomcat/lib/aspectjweaver.jar
  • Reconfigure Tomcat with Load Time Weaving disabled:
  • docker exec mycontainer rm /usr/local/tomcat/bin/setenv.sh
  • docker restart mycontainer

if_Gnome-Dialog-Information-64_55568.png

Information

Although the AcuSensor agent is secured with a strong password, it is recommended that the AcuSensor client files are uninstalled and removed from the web application if they are no longer in use.


 
« Back to the Acunetix Support Page