GoogleCloudPlatform / security-response-automation

Take automated actions against threats and vulnerabilities.
Apache License 2.0
210 stars 53 forks source link

Dry run stub Like #130

Closed daniel-cit closed 4 years ago

daniel-cit commented 4 years ago

example of generated log

DateTime log
2019/11/28 18:53:44 Function execution started D SnapshotDisk 440071487146357
2019/11/28 18:53:44 listing disk names within instance "instance-demo", in zone "us-central1-a" and project "voltaic-flag-260215" A SnapshotDisk 440071487146357
2019/11/28 18:53:44 got 3 disks associated with instance "instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:44 got 2 existing snapshots for project "voltaic-flag-260215" A SnapshotDisk 440071487146357
2019/11/28 18:53:44 disk info: &{CreationTimestamp:2019-11-28T10:39:40.067-08:00 Description: DiskEncryptionKey: GuestOsFeatures:[] Id:4488952197661174404 Kind:compute#disk LabelFingerprint:42WmSpB8rSM= Labels:map[] LastAttachTimestamp:2019-11-28T10:39:45.374-08:00 LastDetachTimestamp: LicenseCodes:[] Licenses:[] Name:disk-2344 Options: PhysicalBlockSizeBytes:4096 Region: ReplicaZones:[] ResourcePolicies:[] SelfLink:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/disks/disk-2344 SizeGb:50 SourceImage: SourceImageEncryptionKey: SourceImageId: SourceSnapshot: SourceSnapshotEncryptionKey: SourceSnapshotId: Status:READY Type:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/diskTypes/pd-standard Users:[https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/instances/instance-demo] Zone:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a ServerResponse:{HTTPStatusCode:0 Header:map[]} ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:44 creating a snapshot "forensic-snapshots-bad-ip-disk-2344" for "disk-2344" A SnapshotDisk 440071487146357
2019/11/28 18:53:44 dry_run on, would call 'CreateSnapshot' with params projectID: "voltaic-flag-260215", zone: "us-central1-a", disk: "disk-2344", Snapshot: &{AutoCreated:false CreationTimestamp:2019-11-28T18:53:44Z Description:Snapshot of disk-2344 DiskSizeGb:0 Id:0 Kind: LabelFingerprint: Labels:map[] LicenseCodes:[] Licenses:[] Name:forensic-snapshots-bad-ip-disk-2344 SelfLink: SnapshotEncryptionKey: SourceDisk: SourceDiskEncryptionKey: SourceDiskId: Status: StorageBytes:0 StorageBytesStatus: StorageLocations:[] ServerResponse:{HTTPStatusCode:0 Header:map[]} ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:44 created snapshot for disk "disk-2344" A SnapshotDisk 440071487146357
2019/11/28 18:53:44 get snapshot "forensic-snapshots-bad-ip-disk-2344" from "voltaic-flag-260215" "disk-2344" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 set label for "voltaic-flag-260215" map[info:created-by-security-response-automation] A SnapshotDisk 440071487146357
2019/11/28 18:53:45 dry_run on, would call 'SetLabels' with params projectID: "voltaic-flag-260215", resource: "0", GlobalSetLabelsRequest: &{LabelFingerprint: Labels:map[info:created-by-security-response-automation] ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 set labels for snapshot "forensic-snapshots-bad-ip-disk-2344" for disk "disk-2344" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 disk info: &{CreationTimestamp:2019-11-28T10:39:40.599-08:00 Description: DiskEncryptionKey: GuestOsFeatures:[] Id:8313928884681550467 Kind:compute#disk LabelFingerprint:42WmSpB8rSM= Labels:map[] LastAttachTimestamp:2019-11-28T10:39:46.534-08:00 LastDetachTimestamp: LicenseCodes:[] Licenses:[] Name:disk-34567 Options: PhysicalBlockSizeBytes:4096 Region: ReplicaZones:[] ResourcePolicies:[] SelfLink:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/disks/disk-34567 SizeGb:50 SourceImage: SourceImageEncryptionKey: SourceImageId: SourceSnapshot: SourceSnapshotEncryptionKey: SourceSnapshotId: Status:READY Type:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/diskTypes/pd-standard Users:[https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/instances/instance-demo] Zone:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a ServerResponse:{HTTPStatusCode:0 Header:map[]} ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 creating a snapshot "forensic-snapshots-bad-ip-disk-34567" for "disk-34567" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 dry_run on, would call 'CreateSnapshot' with params projectID: "voltaic-flag-260215", zone: "us-central1-a", disk: "disk-34567", Snapshot: &{AutoCreated:false CreationTimestamp:2019-11-28T18:53:45Z Description:Snapshot of disk-34567 DiskSizeGb:0 Id:0 Kind: LabelFingerprint: Labels:map[] LicenseCodes:[] Licenses:[] Name:forensic-snapshots-bad-ip-disk-34567 SelfLink: SnapshotEncryptionKey: SourceDisk: SourceDiskEncryptionKey: SourceDiskId: Status: StorageBytes:0 StorageBytesStatus: StorageLocations:[] ServerResponse:{HTTPStatusCode:0 Header:map[]} ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 created snapshot for disk "disk-34567" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 get snapshot "forensic-snapshots-bad-ip-disk-34567" from "voltaic-flag-260215" "disk-34567" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 set label for "voltaic-flag-260215" map[info:created-by-security-response-automation] A SnapshotDisk 440071487146357
2019/11/28 18:53:45 dry_run on, would call 'SetLabels' with params projectID: "voltaic-flag-260215", resource: "0", GlobalSetLabelsRequest: &{LabelFingerprint: Labels:map[info:created-by-security-response-automation] ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 set labels for snapshot "forensic-snapshots-bad-ip-disk-34567" for disk "disk-34567" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 disk info: &{CreationTimestamp:2019-11-28T07:17:14.511-08:00 Description: DiskEncryptionKey: GuestOsFeatures:[0xc00039a880] Id:6978371394827606550 Kind:compute#disk LabelFingerprint:42WmSpB8rSM= Labels:map[] LastAttachTimestamp:2019-11-28T07:17:14.512-08:00 LastDetachTimestamp: LicenseCodes:[1000205] Licenses:[https://www.googleapis.com/compute/v1/projects/debian-cloud/global/licenses/debian-9-stretch] Name:instance-demo Options: PhysicalBlockSizeBytes:4096 Region: ReplicaZones:[] ResourcePolicies:[] SelfLink:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/disks/instance-demo SizeGb:10 SourceImage:https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/debian-9-stretch-v20191121 SourceImageEncryptionKey: SourceImageId:2501912374470682054 SourceSnapshot: SourceSnapshotEncryptionKey: SourceSnapshotId: Status:READY Type:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/diskTypes/pd-standard Users:[https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a/instances/instance-demo] Zone:https://www.googleapis.com/compute/v1/projects/voltaic-flag-260215/zones/us-central1-a ServerResponse:{HTTPStatusCode:0 Header:map[]} ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 dry_run on, would call 'DeleteDiskSnapshot' with params project: "voltaic-flag-260215", snapshot: "forensic-snapshots-bad-ip-instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 removed existing snapshot "forensic-snapshots-bad-ip-instance-demo" from disk "instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 creating a snapshot "forensic-snapshots-bad-ip-instance-demo" for "instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 dry_run on, would call 'CreateSnapshot' with params projectID: "voltaic-flag-260215", zone: "us-central1-a", disk: "instance-demo", Snapshot: &{AutoCreated:false CreationTimestamp:2019-11-28T18:53:45Z Description:Snapshot of instance-demo DiskSizeGb:0 Id:0 Kind: LabelFingerprint: Labels:map[] LicenseCodes:[] Licenses:[] Name:forensic-snapshots-bad-ip-instance-demo SelfLink: SnapshotEncryptionKey: SourceDisk: SourceDiskEncryptionKey: SourceDiskId: Status: StorageBytes:0 StorageBytesStatus: StorageLocations:[] ServerResponse:{HTTPStatusCode:0 Header:map[]} ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 created snapshot for disk "instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 get snapshot "forensic-snapshots-bad-ip-instance-demo" from "voltaic-flag-260215" "instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 set label for "voltaic-flag-260215" map[info:created-by-security-response-automation] A SnapshotDisk 440071487146357
2019/11/28 18:53:45 dry_run on, would call 'SetLabels' with params projectID: "voltaic-flag-260215", resource: "1508707565294170224", GlobalSetLabelsRequest: &{LabelFingerprint:42WmSpB8rSM= Labels:map[info:created-by-security-response-automation] ForceSendFields:[] NullFields:[]} A SnapshotDisk 440071487146357
2019/11/28 18:53:45 set labels for snapshot "forensic-snapshots-bad-ip-instance-demo" for disk "instance-demo" A SnapshotDisk 440071487146357
2019/11/28 18:53:45 completed A SnapshotDisk 440071487146357
2019/11/28 18:53:45 Function execution took 1166 ms, finished with status: 'ok'
daniel-cit commented 4 years ago

Declined.