sgviz

command module
v0.0.0-...-f34edaa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2023 License: MIT Imports: 1 Imported by: 0

README

sgviz

local SecurityGroup data Visualize and management.

Usage

#
# import data from csv file.
#

$ cat <<EOL | sgviz import --host
foo-host01,192.168.0.1
foo-host02,192.168.0.2
bar-vserver,10.0.0.1
EOL

$ cat <<EOL | sgviz import --group
group,hostname
foo,foo-host01
foo,foo-host02
bar.example.com,bar-vserver
EOL

$ cat <<EOL | sgviz import --policy
src,dst,port,desc
foo,bar.example.com,8080,'foo to bar.example.com:8080'
EOL

#
# export readable csv format.
#
$ sgviz host
foo-host01,192.168.0.1,bar-vserver,10.0.0.1,8080,tcp
foo-host02,192.168.0.2,bar-vserver,10.0.0.1,8080,tcp

$ sgviz policy
foo,bar.example.com,8080,tcp

#
# visualize dot lang.
#
$ sgviz policy | sgviz graph
digraph {
  "foo" -> "bar.example.com"
}

$ sgviz policy | sgviz graph | dot -Tsvg > example.svg

Raw Query

-- policies by host.
SELECT sh.hostname AS src, sh.ipaddr AS src_addr, dh.hostname AS dst, dh.ipaddr AS dst_addr, p.port, p.protocol
FROM policy p
JOIN sgroup src ON src.id = p.src
JOIN sgroup dst ON dst.id = p.dst
JOIN host_sgroup shg ON shg.sgroup_id = src.id
JOIN host_sgroup dhg ON dhg.sgroup_id = dst.id
JOIN host sh ON sh.id = shg.host_id
JOIN host dh ON dh.id = dhg.host_id;
-- policies by group.
SELECT src.name AS src, dst.name AS dst, p.port, p.protocol
FROM policy p
JOIN sgroup src ON src.id = p.src
JOIN sgroup dst ON dst.id = p.dst
JOIN host_sgroup shg ON shg.sgroup_id = src.id
JOIN host_sgroup dhg ON dhg.sgroup_id = dst.id
JOIN host sh ON sh.id = shg.host_id
JOIN host dh ON dh.id = dhg.host_id
GROUP BY src.name, dst.name, p.port;

Documentation

Overview

Copyright © 2023 Hyungsuk Hong aanoaa@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
internal
db
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL