Skip to main content

Simple email whitelist checker backed by the AWS Secrets Manager

Project description

Build Status

bouncer

Simple email whitelist checker backed by the AWS Secrets Manager

setup

regular

Either add cgp-bouncer to your project requirements or

pip install cgp-bouncer

in a Python 3 virtualenv.

for development

Instead of the steps above clone the repo, cd into the repo, and run

pip install -e .

To test, run

python -m unittest -v test.py

how to use

setting up the whitelist

  1. Go to the AWS Console and find the Secrets Manager service.
  2. Select Store a new secret.
  3. For secret type select Other type of secrets.
  4. Under the Secret key/value tab enter email as the key and a comma separated (no spaces) list of whitelisted emails as the value. Select Next.
  5. Name your secret something descriptive, such as commons/dev/whitelist and give it a description. Select Next.
  6. Make sure Disable automatic rotation is selected. Then select Next.
  7. Review your configuration and select Store.

adding someone to the whitelist

  1. Go to the AWS Console and find the Secrets Manager service.
  2. Find the secret to which you want to add. For example, one might search for commons/dev/whitelist.
  3. Under Secret value, select Retrieve secret value. Then select Edit.
  4. Add your email with NO WHITESPACE to the comma separated list under the key email and select Save.

using bouncer to check the whitelist

Using is simple!

Here's an example

>>> from bouncer import Bouncer
>>> b = Bouncer('commons/dev/whitelist')
>>> b.is_authorized('valid.email@example.com')
True
>>> b.is_authorized('evil.gnomes@example.com')
False

This checks the AWS Secret Keeper called commons/dev/whitelist to see if the users valid.email@example.com and evil.gnomes@example.com are in the whitelist.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cgp-bouncer-0.0.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file cgp-bouncer-0.0.2.tar.gz.

File metadata

  • Download URL: cgp-bouncer-0.0.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3

File hashes

Hashes for cgp-bouncer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bffe4c9aaaea9b835c616c9449fc5ea8084228e1dba29a6a1554ccf15b058617
MD5 bd1077ee59b9bab0b772684380196f83
BLAKE2b-256 326ba54d76935f152c0681ee23edb1e6fad128f5d7d289101660a44bbb4f7611

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page