Slide 69
Slide 69 text
func DetectOpenSSHFirewall (change *models.CloudAssetInventoryChange ) (bool, error) {
if change.Asset.AssetType != "compute.googleapis.com/Firewall" {
return false, nil
}
var fw Firewall
if err := json.Unmarshal(change.Asset.Resource, &fw); err != nil {
return false, errors.Wrap(err, "failed to unmarshal Firewall resoruce
data")
}
if fw.Data.Disabled || fw.Data.Direction == "EGRESS" {
return false, nil
}
return fw.IsInternetFacing () && fw.IsSSHPortOpen (), nil
}