Skip to main content

directory-proxy

code-climate-image circle-ci-image codecov-image

Proxy for rejecting non-whitelisted IP addresses.


Proxy sets a Hawk signature header that the upstream service can check, rejecting requests that do not have a valid signature.

Installation

pip install directory-proxy

Usage

Proxy can be ran as a standalone service or as a WSGI worker running alongside the upstream service.

WSGI worker

The proxy can be run on the same box as the upstream service. Install proxy on the same box as the upstream service then run the WSGI worker:

DJANGO_SETTINGS_MODULE=directory_proxy.conf.settings \
gunicorn directory_proxy.conf.wsgi --bind 0.0.0.0:$UPSTREAM_PORT

Standalone service

If you're unable to run the WSGI worker on the same box as the upstream service then the proxy can be ran as a standlone service.

Configuration

Set the following environment variables to configure the proxy:

Environment variable Details
IP_RESTRICTOR_ALLOWED_ADMIN_IPS Allow IP addresses. Command delimited
IP_RESTRICTOR_ALLOWED_ADMIN_IP_RANGES Allow IP ranges. Command delimited
IP_RESTRICTOR_SKIP_CHECK_ENABLED Skip IP check. Check cookie instead
IP_RESTRICTOR_SKIP_CHECK_SECRET Shared secret for checking cookie
UPSTREAM_DOMAIN Domain of upstream service
UPSTREAM_SIGNATURE_SECRET Hawk shared secret for upstream request
UPSTREAM_SIGNATURE_SENDER_ID Hawk sender ID for upstream request

Local installation

$ git clone https://github.com/uktrade/directory-proxy
$ cd directory-proxy

Debugging

Setup debug environment

$ make debug

Run debug webserver

$ make debug_webserver

Run debug tests

$ make debug_test

Metadata

Release files for directory-proxy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for directory-proxy 0.1.0
File Interpreter ABI Platform
directory_proxy-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / directory_proxy-0.1.0-py3-none-any.whl

Download URL directory_proxy-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7ac96030ac9c2bac48c03f1e82249de318de939e2ac5d74ae8241595014c19f8
BLAKE2b-256 checksum
How to use checksums
0bb0aa374ddb2d6ab25a9ac11b1edcfed68ffd3011a4523e0215c4844953f3c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/38.7.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page