coraza

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README

Coraza WAF Caddy Module

Coraza Caddy Module provides SecRule compatibility for your web applications deployed using Caddy.

Prerequisites

(See Coraza Documentation)

Plugin syntax

Important: order coraza_waf first must be always included in your Caddyfile for Coraza module to work

coraza {
	directives `
		SecAction "id:1,pass,log"
	`
	include /path/to/config.conf
	template_forbidden /path/to/template.html
}

Sample usage:

{
    auto_https off
    order coraza_waf first
}

http://127.0.0.1:8080 {
	coraza_waf {
		directives `
			SecAction "id:1,pass,log"
			SecRule REQUEST_URI "/test5" "id:2, deny, log, phase:1"
			SecRule REQUEST_URI "/test6" "id:4, deny, log, phase:3"
		`
	}
	reverse_proxy http://192.168.1.15:8080
}

Build Caddy with Coraza WAF

Run:

CGO_ENABLED=1 xcaddy build --with github.com/jptosso/coraza-caddy

Please note that in order to distribute the Caddy binary with Coraza WAF you must also install libinjection and libpcre on each installation.

Testing

You may run the test suite by executing:

$ git clone https://github.com/jptosso/coraza-caddy
$ cd coraza-caddy
$ CGO_ENABLED go test ./...`

Known Issues

FAQ

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware

type Middleware struct {
	Include    string `json:"include"`
	Directives string `json:"directives"`
	// contains filtered or unexported fields
}

func (Middleware) CaddyModule

func (Middleware) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*Middleware) Provision

func (m *Middleware) Provision(ctx caddy.Context) error

Provision implements caddy.Provisioner.

func (Middleware) ServeHTTP

func (m Middleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

ServeHTTP implements caddyhttp.MiddlewareHandler.

func (*Middleware) UnmarshalCaddyfile

func (m *Middleware) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

Unmarshal Caddyfile implements caddyfile.Unmarshaler.

func (*Middleware) Validate

func (m *Middleware) Validate() error

Validate implements caddy.Validator.

type StreamRecorder

type StreamRecorder struct {
	*caddyhttp.ResponseWriterWrapper
	// contains filtered or unexported fields
}

func (*StreamRecorder) Buffered

func (sr *StreamRecorder) Buffered() bool

Buffered returns true if the response is stored inside the transaction IF false the response was already sent to the client

func (*StreamRecorder) Reader

func (sr *StreamRecorder) Reader() io.Reader

Reader provides access to the buffered/inmemory response object

func (*StreamRecorder) Status

func (sr *StreamRecorder) Status() int

func (*StreamRecorder) Write

func (sr *StreamRecorder) Write(data []byte) (int, error)

func (*StreamRecorder) WriteHeader

func (sr *StreamRecorder) WriteHeader(statusCode int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL