A simple application to send CSP violation reports to an email address
CSP-Handler needs to be behind a reverse proxy which forwards either the
X-Real-IP header, otherwise rate limiting won’t work.
git clone https://git.bn4t.me/bn4t/csp-handler.git
make buildto build the csp-handler binary
sudo make installto install csp-handler on your system. This will create the directory
/etc/csp-handler(config directory). Additionally the user
csp-handlerwill be created.
sudo make install-systemdto install the systemd service. Run
service csp-handler startto start the csp-handler service. Csp-handler will automatically run as the
Make sure you edit the config located at
/etc/csp-handler/config.toml before running the service.
-config <config file>- The location of the config file to use. Defaults to
config.tomlin the working directory.
sudo make uninstall to uninstall csp-handler. This will remove
/etc/csp-handler if the directory is empty.
sudo make uninstall-systemd to remove the systemd service.
report-uri directive in your content security policy:
csp-report.example.com with the domain on which csp-report is deployed and
mydomain.com with the domain on which the content security policy is deployed.