aws-sec-graph
Purpose
Give a graph of the AWS Security Groups and EC2 instances relation.
This allow you to see relations over instances X security groups X opened ports based on AWS Filters(with boto3, Port filters or in all ec2 available instances and Security Groups.
Requirements
Packages
- python3
- awscli
- graphviz
- pip
- boto3
Prerequisites
- awscli configured
- sudo apt install graphviz (https://graphviz.org/download/)
- install graphviz (https://graphviz.readthedocs.io/en/stable/manual.html#installation)
Installation
pip install requirements.txt
AWS Permissions
Read-Only
Permissions:
ec2:DescribeInstances
ec2:DescribeTags
ec2:DescribeSecurityGroups
Resources:
*(All)
Example:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"ec2:DescribeInstances",
"ec2:DescribeTags",
"ec2:DescribeSecurityGroups"
],
"Resource": "*"
}
]
}
Options:
--command :
Only "analyze" command available
--profile : Inform aws profile to authenticate using boto3 lib
--filter : Filter to apply on describe instances (https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html)
--format : output format (https://graphviz.org/doc/info/output.html)
--port-filter : Inform a especific port or a range of ports to filter the output, example: 1 unique port "22" or range of ports "20:22"
Usage
General usage
python3 run.py --command=analyze
Using filter
python run.py --command=analyze --profile=default --filter='[{"Name": "tag:environment","Values": ["staging"]}]'
Using port filter
Range of ports:
python run.py --command=analyze --profile=default --port-filter=20:22
Unique port:
python run.py --command=analyze --profile=default --port-filter=22
Change output format (based on graphviz lib)
python run.py --command=analyze --profile=default --filter='[{"Name": "tag:environment","Values": ["staging"]}]' --format=xdot
Recomendations
- https://boto3.amazonaws.com/v1/documentation/api/latest/index.html
- https://graphviz.org/documentation/
- https://github.com/jrfonseca/xdot.py
TODO
- Use aws profile: done (08/11/2020)
- Filter for instances to graph: done (08/11/2020)
- Filter for ports: done (18/12/2020)
- Generate different page for security group
Metadata
Release files for aws-sec-graph 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| aws_sec_graph-0.0.1.tar.gz | 7.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_sec_graph-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.7 kB
Release files / aws_sec_graph-0.0.1.tar.gz
| Download URL | aws_sec_graph-0.0.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
889904d760ed59eceacf6d7b79dba16cb7ca64809e493ba5c529a108e3434ff4
|
|
BLAKE2b-256 checksum How to use checksums |
a15bfb1d17c11979058fa08dd203c1766b9001e6b43083df927a63f8c7bf4ce1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Release files / aws_sec_graph-0.0.1-py3-none-any.whl
| Download URL | aws_sec_graph-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8dc9d21aadc37be2b9412d0368b8efd37801fb1bf5190d273791e7bd5d5e4db3
|
|
BLAKE2b-256 checksum How to use checksums |
d2d5f017447d65b0fef835235973ef06ccfcf18a9f55a662e1a49b9eacb74d1a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Security for aws-sec-graph 0.0.1
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.