Home

Awesome

openstack-securitygroup-grapher

This ansible role gets information from an openstack tenant and generate a graphical representation of security groups and instances through a dot file rendered by Graphviz

Requirements

The below requirements are needed on the host that executes this module.

Role Variables

NameTypeDescriptionDefault
osggrapherCloudInfrastringName of cloud infrastructure (defined in clouds.yml) where your tenant is. (mandatory)no default value
osggrapherShowDefaultboolDo you want to see default security groupfalse
osggrapherShowInstancesboolDo you want to see instances with their security groupsfalse
osggrapherShowInterfacesboolDo you want to see interfaces with their security groups. Useful with instances with multiple ports with different security groups on each. Easier to read when ports have an name instead an idfalse
osggrapherShowEgressAnyAnyRulesboolDo you want to show egress ANY ANY rulestrue
osggrapherRankdirstringSee https://www.graphviz.org/doc/info/attrs.html#d:rankdirLR
osggrapherDotFileToRenderstringPath and name of generated dot file./CloudGrapher.dot
osggrapherFileToRenderstringPath and name of generated image file./CloudGrapher.png
osggrapherRenderCsvFileboolDo you want to generate a csv file of SG and SG Rulesfalse
osggrapherCsvFileToRenderstringPath and name of generated csv file./CloudGrapher.csv
osggrapherRenderMdFileboolDo you want to generate a markdown file of SG and SG Rulesfalse
osggrapherMdFileToRenderstringPath and name of generated markdown file./CloudGrapher.md
osggrapherFilterstringString (begin with) to filter instances and security groups name'no default value

:point_right: If you are in a mutualized tenant, you'll probably want to filter information.

To do that, you will have to use the osggrapherFilter parameter. For instance, if all your Openstack resources names begin with the same string, for instance WEB, you should probably have security groups named WEB-SG-Something, and virtual machines named WEB-SERVER-Something, then you can filter on your resources with:

osggrapherFilter: WEB

Example Playbook

---
- name: Security group grapher
  hosts: localhost
  connection: local
  gather_facts: false
  roles:
    - role: openstack-securitygroup-grapher
      osggrapherCloudInfra: MyCloud

Examples of generated images

How to read the graph

Ellipses are security groups.

The red arrows represent egress flows: for example, the UDP stream 53 is authorized as output of SG-VPC-INTERNAL to 10.xxx.yyy.zza.

The blue arrows represent ingress flows: for example, tcp stream 443 is allowed as input of SG-VPC-LB from any (0.0.0.0/0)

The arrow head is always on the security group which contains the rule represented by the arrow.

Full example

It shows a tenant with several security groups corresponding to the different functions of the machines present in the project.

Example

Simpler example

It shows in particular a SG that accepts any input from any source and a SG that allows any output to any destination.

Example

osggrapherShowDefault

With osggrapherShowDefault: true, you'll have on your graph all the SGs, included the default Openstack SG:

Example

osggrapherShowInstances

With osggrapherShowInstances: true, you'll have on your graph all the instances (VM) within SGs used by these instances.

Example

osggrapherShowInterfaces

With osggrapherShowInterfaces: true, you'll have on your graph all the network interfaces (with their ip addresses) using each security groups.

This visualization is usefull when your instances have multiple network interfaces and you use different security group on different network interfaces.

Obviously, this visualization is easier to read when you take care to name your network interfaces with human readable names.

Example

osggrapherRankdir

With osggrapherRankdir: LR, left to right, RL, right to left, TB, top to bottom, BT, bottom to top, you can change the way to draw the graph.

LR example

Example

TB example

Example

Author Information

Jean-Louis FEREY