项目作者: SecurityFTW

项目描述 :
云安全套件 - 一站式工具,用于审核AWS / GCP / Azure基础架构的安全状况。
高级语言: Shell
项目地址: git://github.com/SecurityFTW/cs-suite.git
创建时间: 2017-08-16T10:58:35Z
项目社区:https://github.com/SecurityFTW/cs-suite

开源协议:GNU General Public License v3.0

下载


Cloud Security Suite (cs-suite) - Version 3.0

Usage

  1. usage: cs.py [-h] -env {aws,gcp,azure,digitalocean} -aip AUDIT_IP -u USER_NAME -pem
  2. PEM_FILE [-p] [-pId PROJECT_ID] [-az_u AZURE_USER]
  3. [-az_p AZURE_PASS] [-o OUTPUT] [-w] [-n NUMBER]
  4. this is to get IP address for lynis audit only
  5. optional arguments:
  6. -h, --help show this help message and exit
  7. -env {aws,gcp,azure,digitalocean}, --environment {aws,gcp,azure,digitalocean}
  8. The cloud on which the test-suite is to be run
  9. -aip AUDIT_IP, --audit_ip AUDIT_IP
  10. The IP for which lynis Audit needs to be done .... by
  11. default tries root/Administrator if username not
  12. provided
  13. -u USER_NAME, --user_name USER_NAME
  14. The username of the user to be logged in,for a
  15. specific user
  16. -pem PEM_FILE, --pem_file PEM_FILE
  17. The pem file to access to AWS instance
  18. -p, --password hidden password prompt
  19. -pId PROJECT_ID, --project_id PROJECT_ID
  20. Project ID for which GCP Audit needs to be run. Can be
  21. retrivied using `gcloud projects list`
  22. -az_u AZURE_USER, --azure_user AZURE_USER
  23. username of azure account, optionally used if you want
  24. to run the azure audit with no user interaction.
  25. -az_p AZURE_PASS, --azure_pass AZURE_PASS
  26. username of azure password, optionally used if you
  27. want to run the azure audit with no user interaction.
  28. -o OUTPUT, --output OUTPUT
  29. writes a log in JSON of an audit, ideal for
  30. consumptions into SIEMS like ELK and Splunk. Defaults
  31. to cs-audit.log
  32. -w, --wipe rm -rf reports/ folder before executing an audit
  33. -n, --number Retain number of report to store for a particular
  34. environment and user/project.

Requirements

  • Operating System OSX or Linux only
  • python 2.7
  • pip
  • git
  • jq
  • gcc (for sshpass installation (OS Audit). Not a mandatory pre-requisite)
  • AWS Audit - AWS ReadOnly Keys
  • GCP Audit - gcloud setup
  • Azure Audit - Azure user read-only access
  • DigitalOcean Audit - DigitalOcean API key and SPACES access_key and access_secret

Installation

(in order to avoid missing with the already installed python libraries)

  • get project git clone https://github.com/SecurityFTW/cs-suite.git && cd cs-suite/
  • install virtualenv pip install virtualenv
  • create a python 2.7 local enviroment virtualenv -p python2.7 venv
  • activate the virtual enviroment source venv/bin/activate
  • install project dependencies pip install -r requirements.txt
  • run the tool via python cs.py --help

AWS Configuration

  • In AWS create a IAM user with at least the following policy arn:aws:iam::aws:policy/ReadOnlyAccess
  • In your local install aws cli brew install awscli for OSX
  • Configure AWS cli aws configure

GCP Configuration

Azure Configuration

  • signup and have logged in already to azure.microsoft.com
  • install azure CLI brew install az
  • authenticate the azure cli az login, you should see your subscription type if it was successful, simiarly to the response below:
  1. [
  2. {
  3. "cloudName": "AzureCloud",
  4. "id": "xxxxx-5595-4da5-bc27-xxxeeee",
  5. "isDefault": true,
  6. "name": "Free Trial",
  7. "state": "Enabled",
  8. "tenantId": "xxxxx-18e9-41a4-961b-xxxxx",
  9. "user": {
  10. "name": "customer@email.com",
  11. "type": "user"
  12. }
  13. }
  14. ]

DigitalOcean Configuration

  • create Personal Access Tokens and Spaces Access keys cloud.digitalocean.com
  • set the credentials by running export

export DO_KEY=*

export DO_ACCESS_KEY=*

export DO_SECRET_KEY=**

Running cs-suite

  1. To run AWS Audit - python cs.py -env aws
  2. To run GCP Audit - python cs.py -env gcp -pId <project_name>
  3. To run Azure Audit - python cs.py -env azure
  4. To run DigitalOcean Audit - python cs.py -env digitalocean
  • The final report will be available in reports directory

  • The final AWS Audit report looks like below:

AWS Audit report

  • The final GCP Audit report looks like below:

GCP Audit report

Docker Setup

  • Create a local directory aws with credentials and config files

  • The config file looks like below

  1. $ cat aws/config
  2. [default]
  3. output = json
  4. region = us-east-1
  • The credentials file looks like below
  1. $ cat aws/credentials
  2. [default]
  3. aws_access_key_id = XXXXXXXXXXXXXXX
  4. aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXX

Note: This tool requires arn:aws:iam::aws:policy/ReadOnlyAccess IAM policy

  • Then run the follwing docker command to start (passing your specific enviroment)
  1. docker run -v `pwd`/aws:/root/.aws -v `pwd`/reports:/app/reports securityftw/cs-suite -env aws

Documentation

https://securityftw.github.io

Thanks