Install the Java agent using the Debian repository
You can configure your system to retrieve and install the Java agent from the Contrast Debian repository. To do this:
Use the following commands to configure your system to receive packages from the repository:
curl https://pkg.contrastsecurity.com/api/gpg/key/public | sudo apt-key add - echo "deb https://pkg.contrastsecurity.com/debian-public/ all contrast" | sudo tee /etc/apt/sources.list.d/contrast-all.list
Install the Contrast Java agent:
sudo apt-get update && sudo apt-get install contrast-java-agent
You will now see the Contrast Java agent JAR file at /opt/contrast/contrast-agent.jar.
Configure the agent. You can create or download a YAML configuration file. You must provide Contrast connection parameters using these agent keys.
Tell the agent where to find the yaml configuration file (
contrast.yaml
). In the example below, substitute<YourContrastJarPath>
with the path to your Contrast JAR (this may vary depending on your internal file structure and how you downloaded the file) and<ApplicationJar>
with the name of your application JAR.java -javaagent:<YourContrastJarPath> -Dcontrast.config.path=contrast.yaml -jar <ApplicationJar>.jar
Note
If you are using system properties, environment variables to configure instead of YAML, or you have placed the YAML in a standard location where the agent can find it automatically, set the JVM parameter to include the Java agent.
java -javaagent:<YourContrastJarPath> -jar <AppName>.jar
Use the application as you normally would (for example, click on the web interface, send API commands). Verify that Contrast sees your application (for example, view your application in the Contrast web interface, view logs).
You can also provide security analysis for applications running in a test/QA or production environment, by installing the agent with an application server like:
You can also install using a container, like Docker.
Tip
Check the Contrast Support Portal for more information about other compatible ways to install the agent using tools like Pivotal Cloud Foundry (now VMware Tanzu).