本文整理汇总了Python中charmhelpers.contrib.hardening.audits.file.TemplatedFile方法的典型用法代码示例。如果您正苦于以下问题:Python file.TemplatedFile方法的具体用法?Python file.TemplatedFile怎么用?Python file.TemplatedFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类charmhelpers.contrib.hardening.audits.file
的用法示例。
在下文中一共展示了file.TemplatedFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_audits
# 需要导入模块: from charmhelpers.contrib.hardening.audits import file [as 别名]
# 或者: from charmhelpers.contrib.hardening.audits.file import TemplatedFile [as 别名]
def get_audits():
"""Get OS hardening profile audits.
:returns: dictionary of audits
"""
audits = []
settings = utils.get_settings('os')
# If core dumps are not enabled, then don't allow core dumps to be
# created as they may contain sensitive information.
if not settings['security']['kernel_enable_core_dump']:
audits.append(TemplatedFile('/etc/profile.d/pinerolo_profile.sh',
ProfileContext(),
template_dir=TEMPLATES_DIR,
mode=0o0755, user='root', group='root'))
if settings['security']['ssh_tmout']:
audits.append(TemplatedFile('/etc/profile.d/99-hardening.sh',
ProfileContext(),
template_dir=TEMPLATES_DIR,
mode=0o0644, user='root', group='root'))
return audits
示例2: get_audits
# 需要导入模块: from charmhelpers.contrib.hardening.audits import file [as 别名]
# 或者: from charmhelpers.contrib.hardening.audits.file import TemplatedFile [as 别名]
def get_audits():
"""Get OS hardening login.defs audits.
:returns: dictionary of audits
"""
audits = [TemplatedFile('/etc/login.defs', LoginContext(),
template_dir=TEMPLATES_DIR,
user='root', group='root', mode=0o0444)]
return audits
示例3: get_audits
# 需要导入模块: from charmhelpers.contrib.hardening.audits import file [as 别名]
# 或者: from charmhelpers.contrib.hardening.audits.file import TemplatedFile [as 别名]
def get_audits():
"""Get OS hardening Secure TTY audits.
:returns: dictionary of audits
"""
audits = []
audits.append(TemplatedFile('/etc/securetty', SecureTTYContext(),
template_dir=TEMPLATES_DIR,
mode=0o0400, user='root', group='root'))
return audits