All Projects → jcmoraisjr → modsecurity-spoa

jcmoraisjr / modsecurity-spoa

Licence: Apache-2.0 License
HAProxy agent for ModSecurity web application firewall

Programming Languages

Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to modsecurity-spoa

kube-template
Watches Kubernetes for updates, writing output of a series of templates to files
Stars: ✭ 27 (-43.75%)
Mutual labels:  haproxy
nginx-modsecurity-ubuntu
Ubuntu package for modsecurity-nginx
Stars: ✭ 22 (-54.17%)
Mutual labels:  modsecurity
charts
HAProxy Ingress helm charts
Stars: ✭ 24 (-50%)
Mutual labels:  haproxy
swarm-router
Scalable stateless «zero config» service-name ingress for docker swarm mode with a fresh more secure approach
Stars: ✭ 58 (+20.83%)
Mutual labels:  haproxy
letsencrypt-dcos
Let's Encrypt DC/OS!
Stars: ✭ 39 (-18.75%)
Mutual labels:  haproxy
ansible-haproxy
Ansible HAproxy role for Unified OpenStack Installer and others.
Stars: ✭ 35 (-27.08%)
Mutual labels:  haproxy
one-wsap
Образ Apache 2.4 + веб-сервисы/веб-клиент 1С. Автоматическое конфигурирование дескрипторов из каталога. HAProxy.
Stars: ✭ 15 (-68.75%)
Mutual labels:  haproxy
archi cloudnative
Cloud Native Architectural Models using Archi. Contains models for CAAS, Cloud Native Applications, 12/15 Factor Applications with CI/CD/CS, monitoring and log management. Infrastructure components include Red Hat OpenShift, Red Hat Storage, Red Hat Ansible Tower, Red Hat Cloudforms, Red Hat Satellite, Red Hat JBoss Middleware.
Stars: ✭ 55 (+14.58%)
Mutual labels:  haproxy
pyhaproxy
Python library to parse haproxy configurations
Stars: ✭ 50 (+4.17%)
Mutual labels:  haproxy
ModSecurityCRS
Implementation of ModSecurity, Core Rule Set (CRS) on Apache server. ModSecurity, sometimes called Modsec, is an open-source web application firewall. ModSecurity was installed and configured on an Ubuntu VM using Virtual Box
Stars: ✭ 24 (-50%)
Mutual labels:  modsecurity
ptw
Pooling TLS Wrapper
Stars: ✭ 20 (-58.33%)
Mutual labels:  haproxy
django-pymodsecurity
ModSecurity Django middleware
Stars: ✭ 16 (-66.67%)
Mutual labels:  modsecurity
ftw
Framework for Testing WAFs (FTW!)
Stars: ✭ 106 (+120.83%)
Mutual labels:  modsecurity
ansible-haproxy
Installs and configures HAProxy
Stars: ✭ 19 (-60.42%)
Mutual labels:  haproxy
haproxy-keepalived
HAProxy & Keepalived for Docker and kubernetes
Stars: ✭ 29 (-39.58%)
Mutual labels:  haproxy
waf-brain
Machine Learning WAF Based
Stars: ✭ 74 (+54.17%)
Mutual labels:  modsecurity
gafka
A full ecosystem that is built around kafka powered by golang
Stars: ✭ 96 (+100%)
Mutual labels:  haproxy
lb-manager
No description or website provided.
Stars: ✭ 19 (-60.42%)
Mutual labels:  haproxy
HAProxy-2-RPM-builder
Build latest HAProxy binary with prometheus metrics support
Stars: ✭ 28 (-41.67%)
Mutual labels:  haproxy
capistrano-docker-compose
Docker Compose specific tasks for Capistrano
Stars: ✭ 17 (-64.58%)
Mutual labels:  haproxy

HAProxy agent for ModSecurity

HAProxy agent (SPOA) for ModSecurity web application firewall (WAF).

Docker Repository on Quay

SPOP and HAProxy Version

The current SPOP version is v2, used since modsecurity-spoa v0.4. This agent version works on HAProxy 1.8.10 and newer.

SPOP v1 is used on modsecurity-spoa v0.1 to v0.3. This agent version works on HAProxy up to 1.8.9.

Agent Configuration

Command line syntax:

$ docker run -p 12345:12345 quay.io/jcmoraisjr/modsecurity-spoa [options] [-- <config-file1> [<config-file2> ...] ]

config-files can be used either after -- (see above) or from -f option (see below). The only difference is that the later supports only one filename. All config-files found will be used, included in the same order as they have been declared.

Customize the Configuration Files

In order to use the default configuration in your customization, you should copy the following files from the image:

docker create --name modsec quay.io/jcmoraisjr/modsecurity-spoa
docker cp modsec:/etc/modsecurity .
docker rm modsec

Download and customize the configuration files for either the ModSecurity repository or from OWASP repository. Use the copied files from the previous code section in your run command:

docker run -p 12345:12345 -v $PWD/modsecurity:/etc/modsecurity quay.io/jcmoraisjr/modsecurity-spoa -n 1

If you do not want to include the default configuration files and only use the configuration files (ex./ custom-config.conf) that you design, leave out the copied default configuration files from before in your run command:

docker run -p 12345:12345 -v $PWD/modsecurity:/etc/modsecurity quay.io/jcmoraisjr/modsecurity-spoa -n 1 -- /etc/modsecurity/custom-config.conf

Running without Config Files

If no config-file is declared, the following will be used:

  • /etc/modsecurity/modsecurity.conf: ModSecurity recommended config, from ModSecurity repository
    • Changes: SecRuleEngine, changed from DetectionOnly to On
  • /etc/modsecurity/owasp-modsecurity-crs.conf: Generic attack detection rules for ModSecurity, from OWASP ModSecurity CRS repository
    • Changes: SecDefaultAction, phase:1 and phase:2, changed from log,auditlog,pass to log,noauditlog,deny,status:403

Options are: (from modsecurity agent -h)

    -h                   Print this message
    -d                   Enable the debug mode
    -f <config-file>     ModSecurity configuration file
    -m <max-frame-size>  Specify the maximum frame size (default : 16384)
    -p <port>            Specify the port to listen on (default : 12345)
    -n <num-workers>     Specify the number of workers (default : 10)
    -c <capability>      Enable the support of the specified capability
    -t <time>            Set a delay to process a message (default: 0)
                           The value is specified in milliseconds by default,
                           but can be in any other unit if the number is suffixed
                           by a unit (us, ms, s)

    Supported capabilities: fragmentation, pipelining, async

HAProxy configuration

Configure modsecurity-spoa as a HAProxy SPOE agent. See also SPOE filter doc and SPOE spec.

Changes to haproxy.cfg - change 127.0.0.1:12345 below to the modsecurity-spoa endpoint:

    frontend httpfront
        mode http
        ...
        filter spoe engine modsecurity config /etc/haproxy/spoe-modsecurity.conf
        http-request deny if { var(txn.modsec.code) -m int gt 0 }
        ...
    backend spoe-modsecurity
        mode tcp
        server modsec-spoa1 127.0.0.1:12345

Create a /etc/haproxy/spoe-modsecurity.conf:

    [modsecurity]
    spoe-agent modsecurity-agent
        messages     check-request
        option       var-prefix  modsec
        timeout      hello       100ms
        timeout      idle        30s
        timeout      processing  1s
        use-backend  spoe-modsecurity
    spoe-message check-request
        args   unique-id method path query req.ver req.hdrs_bin req.body_size req.body
        event  on-frontend-http-request

Test with docker

(cd ./test && ./run.sh)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].