Skip to main content

SCPkit

GitHub Super-Linter

Overview

This project provides a Python module to aid in Service Control Policy (SCP) management in AWS accounts.

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

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

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

Creating a visualization of an AWS Organization, OUs, Accounts, and SCPs

Creating this visualization requires you be authenticated with either the Org management account, or a delegated administrator. See the AWS Documentation page for more info on delegating Organizations.

This will output a graph pdf and graphviz data file in the specified directory (or local directory, if outdir is not specified.)

scpkit visualize --profile yourawsprofile --outdir ./org-graph

Accounts are presented as ellipses, organizational units are rectangles, and SCPs are trapezoids.

Visualization of an Organization

The full CLI is documented through docopt

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

Options:
    -h --help                   Show this screen.
    --version                   Show version.
    --sourcefiles sourcefiles   Directory path to SCP files in json format or a single SCP file
    --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
    --console                   Adds Log to console
"""

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:

Metadata

Release files for scpkit 1.0.0

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

Source distribution (sdist)

Source distribution for scpkit 1.0.0
File Size Uploaded Provenance
scpkit-1.0.0.tar.gz 14.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for scpkit 1.0.0
File Interpreter ABI Platform
scpkit-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.0 kB

Release files / scpkit-1.0.0.tar.gz

Download URL scpkit-1.0.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a67aefa7c093ef56b61730d60d009e8215deaf8b695d0ce3f7a740129eb7fce9
BLAKE2b-256 checksum
How to use checksums
ae904c563494c269f7beb19c359d83c0608372327a62d37220fc86e241436020
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release files / scpkit-1.0.0-py3-none-any.whl

Download URL scpkit-1.0.0-py3-none-any.whl
Size 14.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
092b192738d26934b2e40e6919cedf2d4a8452889f455348e105933f7ad5837b
BLAKE2b-256 checksum
How to use checksums
215a6aa6099156057f9d0882d16adfdfbc3bc9df0366cd818279900f284a3f2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Security for scpkit 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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