Python connector for the Shadow Daemon web application firewall
Project description
Shadow Daemon is a web application firewall that intercepts requests at application-level. This repository contains a component of Shadow Daemon to connect Python applications with the shadowd server.
Documentation
For the full documentation please refer to shadowd.zecure.org.
Installation
You can install the package with easy_install or pip:
easy_install shadowd pip install shadowd
It is also possible to clone this repository and install the package manually:
python setup.py install
You also have to create a configuration file. You can copy misc/examples/connectors.ini to /etc/shadowd/connectors.ini. The example configuration is annotated and should be self-explanatory.
CGI
To protect CGI applications you simply have to load the module:
import shadowd.cgi_connector
Django
Django applications require a small modification. It is necessary to create a hook to intercept requests. To do this create the file middleware/shadowdconnector.py in the application directory:
from shadowd.django_connector import InputDjango, OutputDjango, Connector def shadowdconnector(get_response): def middleware(request): input = InputDjango(request) output = OutputDjango() status = Connector().start(input, output) if not status == True: return status return get_response(request) return middleware
There also has to be an empty __init__.py file in the middleware directory. Next you have to register the middleware in the settings.py file of your application:
MIDDLEWARE_CLASSES = ( 'middleware.shadowdconnector.shadowdconnector', # ... )
The connector should be at the beginning of the MIDDLEWARE_CLASSES list.
Flask
Flask applications require a small modification as well. It is necessary to create a hook to intercept requests:
from shadowd.flask_connector import InputFlask, OutputFlask, Connector @app.before_request def before_req(): input = InputFlask(request) output = OutputFlask() Connector().start(input, output)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file shadowd-3.0.2.tar.gz
.
File metadata
- Download URL: shadowd-3.0.2.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f58bbf04ae49192382c716a66c1712a44f6472abfa9383b33fb1f52f7b137e1 |
|
MD5 | 89fe8ffa264fb3ea6bf22d7c1b887045 |
|
BLAKE2b-256 | f1a61215f941691e60159f0990b27de5399a8d97c2e668cd64a91367e929cb36 |
File details
Details for the file shadowd-3.0.2-py3-none-any.whl
.
File metadata
- Download URL: shadowd-3.0.2-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc35ae6ba4dda080da83b1cd63cec6b3a2a7d6526dfcb6c3c68a0f9a6a08d935 |
|
MD5 | 02259af03c03310be2a60376c9933965 |
|
BLAKE2b-256 | 5ecde4d387e3d15fad2ce1394598dc10cd8afd57ae4c1f185eb5cab34456e11c |