def audit_sg(accounts, send_report): """ Runs auditors/security_group """ accounts = __prep_accounts__(accounts) au = SecurityGroupAuditor(accounts=accounts, debug=True) au.audit_all_objects() if send_report.lower() == 'true' or send_report == True: report = au.create_report() au.email_report(report) au.save_issues() db.session.close()
def audit_sg(accounts, send_report): """ Runs auditors/security_group """ accounts = __prep_accounts__(accounts) au = SecurityGroupAuditor(accounts=accounts, debug=True) au.audit_all_objects() if send_report: report = au.create_report() au.email_report(report) au.save_issues() db.session.close()
def find_sg_changes(accounts): """ Runs watchers/security_group""" accounts = __prep_accounts__(accounts) cw = SecurityGroup(accounts=accounts, debug=True) (items, exception_map) = cw.slurp() cw.find_changes(current=items, exception_map=exception_map) # Audit these changed items items_to_audit = [] for item in cw.created_items + cw.changed_items: sgitem = SecurityGroupItem(region=item.region, account=item.account, name=item.name, config=item.new_config) items_to_audit.append(sgitem) au = SecurityGroupAuditor(debug=True) au.audit_these_objects(items_to_audit) au.save_issues() cw.save() db.session.close()
def find_sg_changes(accounts): """ Runs watchers/security_group""" accounts = __prep_accounts__(accounts) cw = SecurityGroup(accounts=accounts, debug=True) (items, exception_map) = cw.slurp() cw.find_changes(current=items, exception_map=exception_map) # Audit these changed items items_to_audit = [] for item in cw.created_items + cw.changed_items: sgitem = SecurityGroupItem(region=item.region, account=item.account, name=item.name, config=item.new_config) items_to_audit.append(sgitem) au = SecurityGroupAuditor(accounts=accounts, debug=True) au.audit_these_objects(items_to_audit) au.save_issues() cw.save() db.session.close()