Skip to main content

This package helps consolidate service control policies in AWS

Project description

SCPkit

GitHub Super-Linter

Overview

This project provides a python module to aid in Service Control Policy management in AWS accounts. See our release blog for additional details.

SCPs have a current limit of 5 total per entity, and a size limit on each of 5120 bytes. This tool will merge selected SCPs into the fewest amount of policies, and optionally remove whitespace characters as they count toward the byte limit.

  stateDiagram-v2
      [SCPTool] --> Validate
      [SCPTool] --> Merge
      Merge --> Validate
      Validate --> [*]
      Merge --> [*]

Using SCPkit

SCPkit can be installed from PyPI

pip install scpkit

Validating a directory of SCPs

Validating a directory requires active AWS credentials through a profile or environment. SCPkit will recursively search the directory for json files and validate them with Access Analyzer's ValidatePolicy API.

scpkit validate --sourcefiles /path/to/scps --profile yourawsprofile --outdir /path/to/findings

Merging a directory of SCPs

Merging a directory of SCPs does not require active AWS credentials, but can optionally validate after merging.

scpkit merge --sourcefiles /path/to/scps --outdir /path/to/directory

Optional validation with output locally:

scpkit merge --sourcefiles /path/to/scps --outdir /path/to/directory --validate-after-merge --profile yourawsprofile

The full CLI is documented through docopt

SCPkit
Usage:
    main.py (validate | merge) [--sourcefiles sourcefiles] [--profile profile] [ --outdir outdir] [--validate-after-merge] [--readable]

Options:
    -h --help                   Show this screen.
    --version                   Show version.
    --sourcefiles sourcefiles   Directory path to SCP files in json format
    --outdir outdir             Directory to write new SCP files [Default: ./]
    --profile profile           AWS profile name
    --validate-after-merge      Validate the policies after merging them
    --readable                  Leave indentation and some whitespace to make the SCPs readable

Local development

From the root of the folder:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python -m scpkit.main validate --sourcefiles ./scps --profile yourawsprofile

Install as a package

python3 -m venv .venv
source .venv/bin/activate
pip install -U git+https://github.com/aquia-inc/scpkit.git

References

This project would not be possible without the contributions of the following:

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

scpkit-0.1.3.tar.gz (12.2 kB view hashes)

Uploaded Source

Built Distribution

scpkit-0.1.3-py3-none-any.whl (12.4 kB view hashes)

Uploaded Python 3

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