Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to visualize your aws security groups #93

Open
mylamour opened this issue Aug 29, 2022 · 0 comments
Open

How to visualize your aws security groups #93

mylamour opened this issue Aug 29, 2022 · 0 comments
Labels
学习 learning 安全 security 工具 tools 教程 tutorial

Comments

@mylamour
Copy link
Owner

mylamour commented Aug 29, 2022

in this blog, i will show you how to visualized your aws security groups.

  1. install cloudmapper
git clone https://github.com/duo-labs/cloudmapper.git
brew install autoconf automake awscli freetype jq libtool python3
cd cloudmapper/
python3 -m venv ./venv && source venv/bin/activate
pip3 install --prefer-binary -r requirements.txt

now you can run collect data and generate report
2. create a configure file

{  "accounts":
    [
        {"id": "your_account_id", "name": "your_account_name", "default": true}
    ],
    "cidrs":
    {
        "127.0.0.1/8": {"name": "Localhost"}
    }
}
  1. collect data and show it
python3 cloudmapper.py collect --account your_account_name
python3 cloudmapper.py prepare --account your_account_name
python3 cloudmapper.py report --account your_account_name
python3 cloudmapper.py webserver --public

if there everything was going well , then you will got a report. and progress was interrupted when to render the security group. just to change code in 574 lines (/opt/cloudmapper/shared/nodes.py);

    @property
    def security_groups(self):
        return pyjq.all('.SecurityGroups[]?', self._json_blob)
        #       return pyjq.all(".Groups[].GroupId", self._json_blob)

then you will see the report on the browser, and due to some reason , i can't put the screenshot here. but you can find the demo in cloudmapper homepage

but sometimes you can't visualize it because of the node and edge is too large. in this case, we will use aws-security-viz to solve it.

firstly, install it. i suggested to use ubuntu to do that.

sudo apt install ruby graphviz
gem install aws_security_viz

then you need to generate the security group info form aws cli.

aws ec2 describe-security-groups

and if you have many profiles, you can working with aws ec2 describe-security-groups --profile yourprofile > secgroup.json

finally, you will get it after run aws_security_viz -o secgroup.json -f sg.svg.

Screen Shot 2022-08-29 at 16 37 22

@mylamour mylamour added 工具 tools 教程 tutorial 学习 learning 安全 security labels Aug 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
学习 learning 安全 security 工具 tools 教程 tutorial
Projects
None yet
Development

No branches or pull requests

1 participant