Deploy With Docker-Compose
Prerequisites
Linux Docker Host with root permission
Docker-Compose tool installed
Optional (Recommended) Prerequisites:
Access to a SaaS tenant on my.openappsec.io (WebUI for SaaS management) Follow the instructions available here:
Agent profile created for open-appsec Docker deployment in SaaS tenant Follow the instructions available here. Once done, don't forget to copy the profile token after policy installation as this is needed in the installation steps further below:
Deployment
To deploy open-appsec with docker-compose and optionally connect to the central WebUI available at https://my.openappsec.io follow the steps below:
Create a folder for your new open-appsec deployment and switch to that folder, e.g.
mkdir open-appsec-deployment
cd ./open-appsec-deploymentDownload the docker compose file for your desired open-appsec integration
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/nginx/docker-compose.yamlwget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/nginx-unified/docker-compose.yamlwget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/kong/docker-compose.yamlThis deployment is for the traditional open-appsec integration with Kong.
The Kong container specified in the .env file already contains the traditional open-appsec attachment which integrates on NGINX level and allows the open-appsec agent to inspect all traffic passing through Kong. You don't have to configure anything additionally in the Kong configuration for the agent to see the traffic.
A new version of the Kong plugin based on Lua is now available as well, see separate tab. This is more flexible, as you can apply the attachment to specific traffic (e.g. selected routes only) and this is aligned with the official Kong plugin guidelines.
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/kong-lua-plugin/docker-compose.yamlThis deployment is for the new, more flexible version of the Kong plugin based on Lua. This is more flexible than the traditional plugin (also still available, but will be deprecated in the future) and is following the official Kong plugin guidelines.
The Kong container specified in the .env file does already contain the new Lua-based Kong plugin and is loading it as part of the included kong.conf file.
As this is a regular Kong plugin, you must make sure to also configure the plugin to apply to your traffic (e.g. all traffic, specific routes, etc.), as otherwise the open-appsec agent will not receive the traffic for inspection.
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/apisix/docker-compose.yamlwget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/envoy/docker-compose.yamlDownload the
.envfile for your desired open-appsec integration and adjust the configuration to your requirements as described below:
Download the default
.envfile here:
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/nginx/.envIf you created a deployment profile in the WebUI and copied the Token from it:
Edit the
.envfile and add your token to the keyAPPSEC_AGENT_TOKEN.If you did not create a deployment profile in the WebUI and do not want to connect your deployment to central WebUI (SaaS) at all:
Set the value
standalonefor the keyCOMPOSE_PROFILESwhich will activate the deployment of additional containers which are required only when not connected to the WebUI at all (resulting in standalone, locally, declaratively managed deployment).Replace
[email protected]in the .env file with your own email. (More details below.)
Available settings in the .env file allowing further customization of the deployment:
.env file allowing further customization of the deployment:APPSEC_AGENT_TOKEN: For connecting your open-appsec deployment to central WebUI set APPSEC_AGENT_TOKEN to your own deployment profile token as copied from profile settings in the open-appsec central WebUI (see section Prerequisites above).
COMPOSE_PROFILES: Possible values you can set for this key: (you can set multiple values, separated by comma)
standalone : This will activate the deployment of additional containers which are required only when you are not connected to the WebUI at all, resulting in standalone, locally- and declaratively-managed deployment.
Only activate the standalone profile in case you did not set a WebUI deployment profile token as value for the APPSEC_AGENT_TOKEN key (see above)!
juiceshop : This will deploy an additional, vulnerable juiceshop-backend container that can be used for demo and testing purposes.
In the .env file you also find a download link for the proxy-specific configuration allowing you to access the juiceshop backend via the proxy. More info on the OWASP juiceshop project: https://owasp.org/www-project-juice-shop/
Do not activate the juiceshop profile in production environments as the juiceshop container is intentionally highly vulnerable and meant for testing in lab environments only!
USER_EMAIL: (Optional) Associate your email address with your specific deployment by replacing [email protected] with your own email address.
This allows the open-appsec team to provide you easy assistance in case of any issues you might have with your specific deployment in the future and also to provide you information proactively regarding open-appsec in general or regarding your specific deployment. This is an optional parameter and can be removed. If we send automatic emails there will also be an opt-out option included for receiving similar communication in the future.
APPSEC_HTTPS_PROXY: (Optional) Configure an HTTP(S) proxy server to be used by the agent.
APPSEC_AUTO_POLICY_LOAD: (Optional) When set to true, allows you to set the open-appsec agent to automatically apply any new changes in the local_policy.yaml file without having to restart the agent container or applying the changes with open-appsec-ctl -ap (note that this can take up to 30 seconds). This is useful especially in DevOps scenarios with continuous deployment scenarios.
APPSEC_VERSION: Allows you to specify a specific version for deployment instead of using the default latest version for the containers provided by open-appsec (not relevant for postgres container).
Additional configuration available specifically for this integration type:
NGINX_CONFIG: Set the directory on the docker host used for the volume mount to the NGINX conf.d directory. Make sure to have a valid NGINX configuration file default.conf in the mounted directory.
For testing purposes in a lab environment you can activate the deployment of the vulnerable juiceshop-backend container via COMPOSE_PROFILES key (see above) and then deploy the available configuration example for exposing it via the proxy, which is provided by the open-appsec team (download link is provided in the .env file).
Download the default
.envfile here:
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/nginx-unified/.envIf you created a deployment profile in the WebUI and copied the Token from it:
Edit the
.envfile and add your token to the keyAPPSEC_AGENT_TOKEN.If you did not create a deployment profile in the WebUI and do not want to connect your deployment to central WebUI (SaaS) at all:
Set the value
standalonefor the keyCOMPOSE_PROFILESwhich will activate the deployment of additional containers which are required only when not connected to the WebUI at all (resulting in standalone, locally, declaratively managed deployment).Replace
[email protected]in the .env file with your own email. (More details below.)
Available settings in the .env file allowing further customization of the deployment:
.env file allowing further customization of the deployment:APPSEC_AGENT_TOKEN: For connecting your open-appsec deployment to central WebUI set APPSEC_AGENT_TOKEN to your own deployment profile token as copied from profile settings in the open-appsec central WebUI (see section Prerequisites above).
COMPOSE_PROFILES: Possible values you can set for this key: (you can set multiple values, separated by comma)
standalone : This will activate the deployment of additional containers which are required only when you are not connected to the WebUI at all, resulting in standalone, locally- and declaratively-managed deployment.
Only activate the standalone profile in case you did not set a WebUI deployment profile token as value for the APPSEC_AGENT_TOKEN key (see above)!
juiceshop : This will deploy an additional, vulnerable juiceshop-backend container that can be used for demo and testing purposes.
Do not activate the juiceshop profile in production environments as the juiceshop container is intentionally highly vulnerable and meant for testing in lab environments only!
USER_EMAIL: (Optional) Associate your email address with your specific deployment by replacing [email protected] with your own email address.
This allows the open-appsec team to provide you easy assistance in case of any issues you might have with your specific deployment in the future and also to provide you information proactively regarding open-appsec in general or regarding your specific deployment. This is an optional parameter and can be removed. If we send automatic emails there will also be an opt-out option included for receiving similar communication in the future.
APPSEC_HTTPS_PROXY: (Optional) Configure an HTTP(S) proxy server to be used by the agent.
APPSEC_AUTO_POLICY_LOAD: (Optional) When set to true, allows you to set the open-appsec agent to automatically apply any new changes in the local_policy.yaml file without having to restart the agent container or applying the changes with open-appsec-ctl -ap (note that this can take up to 30 seconds). This is useful especially in DevOps scenarios with continuous deployment scenarios.
APPSEC_VERSION: Allows you to specify a specific version for deployment instead of using the default latest version for the containers provided by open-appsec (not relevant for postgres container).
Additional configuration available specifically for this integration type:
NGINX_CONFIG: Set the directory on the docker host used for the volume mount to the NGINX conf.d directory. Make sure to have a valid NGINX configuration file default.conf in the mounted directory.
For testing purposes in a lab environment you can activate the deployment of the vulnerable juiceshop-backend container via COMPOSE_PROFILES key (see above) and then deploy the available configuration example for exposing it via the proxy, which is provided by the open-appsec team (download link is provided in the .env file).
Download the default
.envfile here:
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/kong/.envIf you created a deployment profile in the WebUI and copied the Token from it:
Edit the
.envfile and add your token to the keyAPPSEC_AGENT_TOKEN.If you did not create a deployment profile in the WebUI and do not want to connect your deployment to central WebUI (SaaS) at all:
Set the value
standalonefor the keyCOMPOSE_PROFILESwhich will activate the deployment of additional containers which are required only when not connected to the WebUI at all (resulting in standalone, locally, declaratively managed deployment).Replace
[email protected]in the .env file with your own email. (More details below.)
Available settings in the .env file allowing further customization of the deployment:
.env file allowing further customization of the deployment:APPSEC_AGENT_TOKEN: For connecting your open-appsec deployment to central WebUI set APPSEC_AGENT_TOKEN to your own deployment profile token as copied from profile settings in the open-appsec central WebUI (see section Prerequisites above).
COMPOSE_PROFILES: Possible values you can set for this key: (you can set multiple values, separated by comma)
standalone : This will activate the deployment of additional containers which are required only when you are not connected to the WebUI at all, resulting in standalone, locally- and declaratively-managed deployment.
Only activate the standalone profile in case you did not set a WebUI deployment profile token as value for the APPSEC_AGENT_TOKEN key (see above)!
juiceshop : This will deploy an additional, vulnerable juiceshop-backend container that can be used for demo and testing purposes.
Do not activate the juiceshop profile in production environments as the juiceshop container is intentionally highly vulnerable and meant for testing in lab environments only!
USER_EMAIL: (Optional) Associate your email address with your specific deployment by replacing [email protected] with your own email address.
This allows the open-appsec team to provide you easy assistance in case of any issues you might have with your specific deployment in the future and also to provide you information proactively regarding open-appsec in general or regarding your specific deployment. This is an optional parameter and can be removed. If we send automatic emails there will also be an opt-out option included for receiving similar communication in the future.
APPSEC_HTTPS_PROXY: (Optional) Configure an HTTP(S) proxy server to be used by the agent.
APPSEC_AUTO_POLICY_LOAD: (Optional) When set to true, allows you to set the open-appsec agent to automatically apply any new changes in the local_policy.yaml file without having to restart the agent container or applying the changes with open-appsec-ctl -ap (note that this can take up to 30 seconds). This is useful especially in DevOps scenarios with continuous deployment scenarios.
APPSEC_VERSION: Allows you to specify a specific version for deployment instead of using the default latest version for the containers provided by open-appsec (not relevant for postgres container).
Additional configuration available specifically for this integration type:
KONG_CONFIG: Set the directory on the docker host used for the volume mount to the Kong /opt/kong directory. Make sure to have a valid Kong declarative configuration file kong.yaml in the mounted directory.
For testing purposes in a lab environment you can activate the deployment of the vulnerable juiceshop-backend container via COMPOSE_PROFILES key (see above) and then deploy the available configuration example for exposing it via the proxy, which is provided by the open-appsec team (download link is provided in the .env file).
Download the default
.envfile here:
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/kong-lua-plugin/.envIf you created a deployment profile in the WebUI and copied the Token from it:
Edit the
.envfile and add your token to the keyAPPSEC_AGENT_TOKEN.If you did not create a deployment profile in the WebUI and do not want to connect your deployment to central WebUI (SaaS) at all:
Set the value
standalonefor the keyCOMPOSE_PROFILESwhich will activate the deployment of additional containers which are required only when not connected to the WebUI at all (resulting in standalone, locally, declaratively managed deployment).Replace
[email protected]in the .env file with your own email. (More details below.)
Available settings in the .env file allowing further customization of the deployment:
.env file allowing further customization of the deployment:APPSEC_AGENT_TOKEN: For connecting your open-appsec deployment to central WebUI set APPSEC_AGENT_TOKEN to your own deployment profile token as copied from profile settings in the open-appsec central WebUI (see section Prerequisites above).
COMPOSE_PROFILES: Possible values you can set for this key: (you can set multiple values, separated by comma)
standalone : This will activate the deployment of additional containers which are required only when you are not connected to the WebUI at all, resulting in standalone, locally- and declaratively-managed deployment.
Only activate the standalone profile in case you did not set a WebUI deployment profile token as value for the APPSEC_AGENT_TOKEN key (see above)!
juiceshop : This will deploy an additional, vulnerable juiceshop-backend container that can be used for demo and testing purposes.
Do not activate the juiceshop profile in production environments as the juiceshop container is intentionally highly vulnerable and meant for testing in lab environments only!
USER_EMAIL: (Optional) Associate your email address with your specific deployment by replacing [email protected] with your own email address.
This allows the open-appsec team to provide you easy assistance in case of any issues you might have with your specific deployment in the future and also to provide you information proactively regarding open-appsec in general or regarding your specific deployment. This is an optional parameter and can be removed. If we send automatic emails there will also be an opt-out option included for receiving similar communication in the future.
APPSEC_HTTPS_PROXY: (Optional) Configure an HTTP(S) proxy server to be used by the agent.
APPSEC_AUTO_POLICY_LOAD: (Optional) When set to true, allows you to set the open-appsec agent to automatically apply any new changes in the local_policy.yaml file without having to restart the agent container or applying the changes with open-appsec-ctl -ap (note that this can take up to 30 seconds). This is useful especially in DevOps scenarios with continuous deployment scenarios.
APPSEC_VERSION: Allows you to specify a specific version for deployment instead of using the default latest version for the containers provided by open-appsec (not relevant for postgres container).
Additional configuration available specifically for this integration type:
KONG_CONFIG: Set the directory on the docker host used for the volume mount to the Kong /opt/kong directory. Make sure to have a valid Kong declarative configuration file kong.yaml in the mounted directory.
For testing purposes in a lab environment you can activate the deployment of the vulnerable juiceshop-backend container via COMPOSE_PROFILES key (see above) and then deploy the available configuration example for exposing it via the proxy, which is provided by the open-appsec team (download link is provided in the .env file).
Download the default
.envfile here:
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/apisix/.envIf you created a deployment profile in the WebUI and copied the Token from it:
Edit the
.envfile and add your token to the keyAPPSEC_AGENT_TOKEN.If you did not create a deployment profile in the WebUI and do not want to connect your deployment to central WebUI (SaaS) at all:
Set the value
standalonefor the keyCOMPOSE_PROFILESwhich will activate the deployment of additional containers which are required only when not connected to the WebUI at all (resulting in standalone, locally, declaratively managed deployment).Replace
[email protected]in the .env file with your own email. (More details below.)
Available settings in the .env file allowing further customization of the deployment:
.env file allowing further customization of the deployment:APPSEC_AGENT_TOKEN: For connecting your open-appsec deployment to central WebUI set APPSEC_AGENT_TOKEN to your own deployment profile token as copied from profile settings in the open-appsec central WebUI (see section Prerequisites above).
COMPOSE_PROFILES: Possible values you can set for this key: (you can set multiple values, separated by comma)
standalone : This will activate the deployment of additional containers which are required only when you are not connected to the WebUI at all, resulting in standalone, locally- and declaratively-managed deployment.
Only activate the standalone profile in case you did not set a WebUI deployment profile token as value for the APPSEC_AGENT_TOKEN key (see above)!
juiceshop : This will deploy an additional, vulnerable juiceshop-backend container that can be used for demo and testing purposes.
Do not activate the juiceshop profile in production environments as the juiceshop container is intentionally highly vulnerable and meant for testing in lab environments only!
USER_EMAIL: (Optional) Associate your email address with your specific deployment by replacing [email protected] with your own email address.
This allows the open-appsec team to provide you easy assistance in case of any issues you might have with your specific deployment in the future and also to provide you information proactively regarding open-appsec in general or regarding your specific deployment. This is an optional parameter and can be removed. If we send automatic emails there will also be an opt-out option included for receiving similar communication in the future.
APPSEC_HTTPS_PROXY: (Optional) Configure an HTTP(S) proxy server to be used by the agent.
APPSEC_AUTO_POLICY_LOAD: (Optional) When set to true, allows you to set the open-appsec agent to automatically apply any new changes in the local_policy.yaml file without having to restart the agent container or applying the changes with open-appsec-ctl -ap (note that this can take up to 30 seconds). This is useful especially in DevOps scenarios with continuous deployment scenarios.
APPSEC_VERSION: Allows you to specify a specific version for deployment instead of using the default latest version for the containers provided by open-appsec (not relevant for postgres container).
Additional configuration available specifically for this integration type:
APISIX_CONFIG: Set the directory on the docker host used for the APISIX configuration file mount to the APISIX file path /usr/local/apisix/conf/apisix.yaml. Make sure to have a valid apisix configuration for APISIX in standalone mode in the mounted file.
For testing purposes in a lab environment you can activate the deployment of the vulnerable juiceshop-backend container via COMPOSE_PROFILES key (see above) and then deploy the available configuration example for exposing it via the proxy, which is provided by the open-appsec team (download link is provided in the .env file).
Download the default
.envfile here:
wget https://raw.githubusercontent.com/openappsec/openappsec/main/deployment/docker-compose/envoy/.envIf you created a deployment profile in the WebUI and copied the Token from it:
Edit the
.envfile and add your token to the keyAPPSEC_AGENT_TOKEN.If you did not create a deployment profile in the WebUI and do not want to connect your deployment to central WebUI (SaaS) at all:
Set the value
standalonefor the keyCOMPOSE_PROFILESwhich will activate the deployment of additional containers which are required only when not connected to the WebUI at all (resulting in standalone, locally, declaratively managed deployment).Replace
[email protected]in the .env file with your own email. (More details below.)
When providing your own envoy.yaml configuration file, make sure to add the required configuration to load the open-appsec attachment filter! Follow these instructions: Load the Attachment in Proxy Configuration
Available settings in the .env file allowing further customization of the deployment:
.env file allowing further customization of the deployment:APPSEC_AGENT_TOKEN: For connecting your open-appsec deployment to central WebUI set APPSEC_AGENT_TOKEN to your own deployment profile token as copied from profile settings in the open-appsec central WebUI (see section Prerequisites above).
COMPOSE_PROFILES: Possible values you can set for this key: (you can set multiple values, separated by comma)
standalone : This will activate the deployment of additional containers which are required only when you are not connected to the WebUI at all, resulting in standalone, locally- and declaratively-managed deployment.
Only activate the standalone profile in case you did not set a WebUI deployment profile token as value for the APPSEC_AGENT_TOKEN key (see above)!
juiceshop : This will deploy an additional, vulnerable juiceshop-backend container that can be used for demo and testing purposes.
Do not activate the juiceshop profile in production environments as the juiceshop container is intentionally highly vulnerable and meant for testing in lab environments only!
USER_EMAIL: (Optional) Associate your email address with your specific deployment by replacing [email protected] with your own email address.
This allows the open-appsec team to provide you easy assistance in case of any issues you might have with your specific deployment in the future and also to provide you information proactively regarding open-appsec in general or regarding your specific deployment. This is an optional parameter and can be removed. If we send automatic emails there will also be an opt-out option included for receiving similar communication in the future.
APPSEC_HTTPS_PROXY: (Optional) Configure an HTTP(S) proxy server to be used by the agent.
APPSEC_AUTO_POLICY_LOAD: (Optional) When set to true, allows you to set the open-appsec agent to automatically apply any new changes in the local_policy.yaml file without having to restart the agent container or applying the changes with open-appsec-ctl -ap (note that this can take up to 30 seconds). This is useful especially in DevOps scenarios with continuous deployment scenarios.
APPSEC_VERSION: Allows you to specify a specific version for deployment instead of using the default latest version for the containers provided by open-appsec (not relevant for postgres container).
Additional configuration available specifically for this integration type:
ENVOY_CONFIG: Set the directory on the docker host used for the Envoy configuration file mount to the Envoy file path /envoy.yaml. Make sure to have a valid envoy.yaml configuration file for Envoy in the mounted file path.
For testing purposes in a lab environment you can activate the deployment of the vulnerable juiceshop-backend container via COMPOSE_PROFILES key (see above) and then deploy the available configuration example for exposing it via the proxy, which is provided by the open-appsec team (download link is provided in the .env file).
When providing your own envoy.yaml configuration file, make sure to add the required configuration to load the open-appsec attachment filter! Follow these instructions: Load the Attachment in Proxy Configuration
ENVOY_CONCURRENCY: Allows setting the desired amount of Envoy worker processes. I order to use this parameter, specify this in the .env file and also adjust the "command" line for the appsec-envoy container in the docker-compose.yaml file (see additional comments in that file).
Make sure to also adjust the following two parameters ENVOY_CONCURRENCY_CALC and ENVOY_CONCURRENCY_NUMBER accordingly if you adjusted ENVOY_CONCURRENCY.
ENVOY_CONCURRENCY_CALC: Only relevant if you made a custom configuration for the amount of Envoy worker threads using the optional ENVOY_CONCURRENCY parameter (see also explanation in docker-compose.yaml). In this case you must set ENVOY_CONCURRENCY_CALC=custom and then also provide the specified amount of Envoy worker threads in the ENVOY_CONCURRENCY_NUMBER parameter.
This will make sure that the open-appsec attachment will create the right amount of transaction handlers.
Possible values for ENVOY_CONCURRENCY_CALC: "numOfCores" (default), "custom"
ENVOY_CONCURRENCY_NUMBER: Only relevant if you made a custom configuration for the amount of Envoy worker threads using the optional ENVOY_CONCURRENCY parameter (see also explanation in docker-compose.yaml).
See explanation for ENVOY_CONCURRENCY_CALC for more details.
If you decided to locally, declaratively manage open-appsec with
local_policy.yamlfile: Download the initial declarative configuration file for open-appsec into new subfolder./appsec-localconfig:mkdir ./appsec-localconfig wget https://raw.githubusercontent.com/openappsec/openappsec/main/config/linux/v1beta1/prevent/local_policy.yaml -O ./appsec-localconfig/local_policy.yaml
Perform the deployment
docker-compose up -dYou will see output similar to the below.
Note that the amount of container will vary based between deployments with and without connection to central WebUI.

Verify that all containers are up and running by verifying their status in docker ps output. Note that the amount of container will vary based between deployments with and without connection to central WebUI.
docker psYou will see output similar to the below:

Congratulations, you successfully deployed open-appsec WAF integrated with the reverse proxy solution of your choice!
Recommended next steps:
If you connected to central WebUI AND configured your deployment profile in the WebUI to "This management" mode for centrally managing open-appsec configuration: Create one or more assets in the WebUI which represent web applications and/or Web APIs which you want to be protected by open-appsec WAF and allows you to adjust the open-appsec configuration specifically for each of them.
Make sure to link your assets to the specific WebUI Profile which you created earlier (General -> Profiles) and adjust the Threat Prevention mode to Detect-Learn or Prevent (Threat Prevention -> Mode), the steps are described here: Protect Additional Assets
Don't forget to Enforce policy in the WebUI after you did any changes for those changes to become effective!
If you decided to locally, declaratively manage open-appsec (with or without connection to central WebUI in "Declarative configuration" mode): Follow the steps described here to configure your open-appsec deployment using the
local_policy.yamlfile: Configuration Using Local Policy File (Docker) In case you connected your locally managed deployment also to the central WebUI in "Declarative Configuration" mode, you can check security logs and view agent status and configuration also in the central WebUI at https://my.openappsec.io .
Don't forget to apply the policy using open-appsec-ctl -ap in the open-appsec-agent container or by setting APPSEC_AUTO_POLICY_LOAD in the .env file to true for automatic application of any configuration changes done in the local_policy.yaml file for the changes to become effective!
Last updated
Was this helpful?