Git Product home page Git Product logo

pay-aws-compliance's Introduction

pay-aws-compliance

The GOV.UK Pay AWS compliance report

What is it?

pay-aws-compliance is a Python script which runs against an AWS account and checks for things that fail compliance in some way.

The script can be run independently with

./aws_compliance.py -h # Help message
./aws_compliance.py -e # Dry-run: echo variables
./aws_compliance.py    # Run the reports

or as part of a scheduled Lambda function, or by AWS Config.

Controls

control_id description
s3_versioning_enabled Checks all buckets in an S3 account for bucket versioning being enabled
3_logging_enabled Checks all buckets in an S3 account for bucket logging being enabled
vuls_reports Scans nightly generated Vuls reports and alerts if CVE found
reboots_required pay-reboots-required runs and updates the instance reboot_required tag nightly. This control checks for instance tags of reboots_required: true

Environment Variables

Varible Default Purpose
AWS_DEFAULT_REGION eu-west-1 AWS Region API client connects to
SEND_REPORT_TO_SNS false If should send report to SNS
SNS_TOPIC_ARN None SNS topic ARN to send report to
ONLY_SHOW_FAILED false Only show failed compliance checks
S3_BUCKETS_TO_SKIP None CSV of S3 buckets to skip compliance checks
VULS_REPORT_BUCKET pay-govuk-dev-vuls S3 bucket to find Vuls reports
UNIX_ACCOUNT_REPORT_BUCKET pay-govuk-unix-accounts-dev S3 bucket where unix account reports are stored

Interpreting the compliance report

Interpreting the compliance report should be pretty straight forward:

python aws_compliance.py
[
    {
        "Description": "Ensure S3 versioning is enabled on all buckets",
        "ScoredControl": false,
        "failReason": "",
        "Result": true,
        "Offenders": [],
        "ControlId": "s3_versioning_enabled"
    },
    {
        "Description": "Ensure S3 logging is enabled on all buckets",
        "ScoredControl": false,
        "failReason": "",
        "Result": true,
        "Offenders": [],
        "ControlId": "s3_logging_enabled"
    }
]

The above shows output for an AWS account which is not in violation of any of the compliance controls.

python aws_compliance.py
[
    {
        "Description": "Ensure S3 versioning is enabled on all buckets",
        "ScoredControl": false,
        "failReason": "Buckets found without versioning enabled",
        "Result": false,
        "Offenders": [
            "pay-test-foo-bar-bucket"
        ],
        "ControlId": "s3_versioning_enabled"
    },
    {
        "Description": "Ensure S3 logging is enabled on all buckets",
        "ScoredControl": false,
        "failReason": "Buckets found without logging enabled",
        "Result": false,
        "Offenders": [
            "pay-test-foo-bar-bucket"
            "pay-test-foo-bar-badger-bucket"
        ],
        "ControlId": "s3_logging_enabled"
    },
    {
        "Description": "Vuls reports",
        "ScoredControl": false,
        "failReason": {
            "CVE-2017-7484": {
                "instances": [
                    "badger-12-egress-proxy-i-111111111111",
                    "foo-12-egress-proxy-i-999999999999"
                ],
                "score": 5,
                "severity": "high"
            },
            "CVE-2017-7485": {
                "instances": [
                    "badger-12-egress-proxy-i-111111111111",
                    "foo-12-egress-proxy-i-999999999999"
                ],
                "score": 4.3,
                "severity": "high"
            },
            "CVE-2017-7486": {
                "instances": [
                    "badger-12-egress-proxy-i-111111111111",
                    "foo-12-egress-proxy-i-999999999999"
                ],
                "score": 5,
                "severity": "high"
            }
        },
        "Result": false,
        "Offenders": [
            "dev-josh-23"
        ],
        "ControlId": "vuls_reports"
    }
]

The above shows output for an AWS account which is in violation of several of the compliance controls.

If something is in violation of the compliance controls, there should be a human understandable failReason in the report, followed by the ControlId and a list of Offenders

In the above example, the S3 bucket pay-test-foo-bar-bucket does not have versioning enabled and the S3 buckets pay-test-foo-bar-bucket + pay-test-foo-bar-badger-bucket do not have logging enabled. There are also a number of CVEs in the test-12 environment

pay-aws-compliance's People

Contributors

bazbremner avatar dj-maisy avatar joshmyers avatar markyjones avatar rjbaker avatar tlwr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.