需要审计证明书

probator-auditor-required-tags的Python项目详细描述


认证人审计员要求的标签

请在Probator存储库中打开问题

说明

该审核员对发现不符合标记要求的aws对象进行审查、警告并可能采取行动。

配置选项

Option nameDefault ValueTypeDescription
alert_settingsSee notes belowJSONAlert and enforcement settings for supported resources
always_send_emailTrueboolSend emails even in collect mode
audit_ignore_tagprobator:ignorestringProbator will ignore alerting/enforcement if resources are tagged with this
audit_scopeaws_ec2_instancestringSelect resources (aws_ec2_instance, aws_s3_bucket)
collect_onlyTrueboolDo not shutdown resources, only update caches
confirm_shutdownTrueboolRequire manual confirmation before shutting down instances
email_subjectResources missing required tagsstringSubject of the new issues email notifications
enabledFalseboolEnable the Required Tags auditor
interval30intHow often the auditor executes, in minutes
partial_owner_matchFalseboolAllow partial matches of the Owner tag
permanent_recipient[]arrayList of email addresses to receive all alerts
required_tags['owner', 'accounting', 'name']arrayList of required tags

示例alert_settings

{"global":{"actions":[{"name":"alert:1","age":"now","action":"alert","order":0},{"name":"alert:2","age":"3 weeks","action":"alert","order":1},{"name":"alert:3","age":"3 weeks, 6 days","action":"alert","order":2},{"name":"stop","age":"4 weeks","action":"stop","order":3},{"name":"remove","age":"12 weeks","action":"remove","order":4}],"requiredTags":{"Name":null,"owner":"([a-zA-Z0-9._%+-]+[^+]@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,})"},"extraConfig":{}},"aws_ec2_instance":{"requiredTags":{"ssmEnabled":"^(true|false)$"}}}

global部分应用于所有资源,我们将在下面的详细部分中讨论一些限制。除了 global部分,您还可以为某些资源类型定义附加标记,或者重写actions以使用不同的调度 特定资源类型

actions

actions块定义要采取的操作集。通过上面的例子,我们可以看到总共有5个操作 将占用所有资源。

  1. 一旦检测到,立即发送警报(age=now
  2. 3周后,再次发送警报
  3. 再过6天,发送第三个警报
  4. 4周后,停止实例(同时发送通知)
  5. 最后在12周后,删除资源(同时发送通知)

可以重写特定资源的操作,但是如果提供新的操作计划,则将忽略 资源类型。

有效操作类型

目前只支持三种类型的操作:alertstopremove

警报

向资源帐户的每个注册所有者发送通知

stop

停止资源(如果适用)。例如,如果EC2实例正在运行,则它将停止运行资源的状态将是 对审计员的每次执行进行评估,因此如果资源再次启动,则停止操作将再次应用

删除

完全删除资源,例如,如果资源是EC2实例,它将被终止。

required_tags

required_tags是一个类似字典的对象,其中键是标记的名称,值是一个正则表达式模式 将用于验证资源的标记值。如果标记与提供的正则表达式不匹配,则将标记资源 由于不兼容,需要注意标记未能匹配正则表达式。

如果任何值是有效的,则可以提供null值而不是正则表达式,以避免发生任何匹配,而不是 使用空/全局表达式,如.*

extra_config

此部分可用于提供验证标记所需的额外信息。此时,它不被 基本审计员功能,但在实现自定义操作方法的情况下可能会有所帮助

执行操作方法

action方法是一种简单的方法,它接受一个参数作为需要对其执行操作的Resource对象。见 probator_auditor_required_tags/actions.py例如实现。

使用命名空间中setup.py中定义的入口点动态加载操作方法 probator_auditor_required_tags.actions。入口点的名称必须是<resource_type>_<action>例如要删除的操作 一个s3存储桶应该是aws_s3_bucket_remove

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java嵌套循环打印一个数字,旁边有相同数量的星号   java JodReports替代方案   java如何将模型类parcelable对象从片段传递到活动?   java JCS缓存删除功能不删除特定元素   如何打开。Java的dll文件。   java在这种情况下如何选择聚合根?   java从CellEditorListener获取编辑的TreeNode   Java到web服务和mysql   从openssl ec在Java中创建公钥时出现加密无效密钥异常   Java数组:添加多个数组的元素时忽略空数组   java在初始化后向fragment发送数据   JButtons的java数组正在返回void   若联接列不包含特定值,则java JPA条件生成器仅返回实体   java ActionBar问题:NPE   java Portlet是被广泛使用还是非常罕见?