Private Logs Viewer
"Google Cloud Audit Logs couldn't be simpler to use; exported to BigQuery it provides us with a powerful way to monitor all our applications from one place." — Darren Cibis, Shine Solutions
SetIamPolicy
Copyright 2017 Google Inc.Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.'use strict';exports.processFirewallAuditLogs = (event) => { const msg = JSON.parse(Buffer.from(event.data.data, 'base64').toString()); const logEntry = msg.protoPayload; if (logEntry && logEntry.request && logEntry.methodName === 'v1.compute.firewalls.insert') { let cancelFirewall = false; const allowed = logEntry.request.alloweds; if (allowed) { for (let key in allowed) { const entry = allowed[key]; for (let port in entry.ports) { if (parseInt(entry.ports[port], 10) !== 22) { cancelFirewall = true; break; } } } } if (cancelFirewall) { const resourceArray = logEntry.resourceName.split('/'); const resourceName = resourceArray[resourceArray.length - 1]; const compute = require('@google-cloud/compute')(); return compute.firewall(resourceName).delete(); } } return true;};
package.json file
index.js
{ "name" : "audit-log-monitoring", "version" : "1.0.0", "description" : "monitor my audit logs", "main" : "index.js", "dependencies" : { "@google-cloud/compute" : "^0.4.1" }}
Use promo code NEXT1720 to save $300 off general admission
No comments :
Post a Comment