1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#! /usr/bin/python -S
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Check that everything is alright in security.cfg
Usage hint:
% utilities/audit-security.py
"""
__metatype__ = type
import os
import _pythonpath
from lp.scripts.utilities.settingsauditor import SettingsAuditor
BRANCH_ROOT = os.path.split(
os.path.dirname(os.path.abspath(__file__)))[0]
SECURITY_PATH = os.path.join(
BRANCH_ROOT, 'database', 'schema', 'security.cfg')
def main():
data = file(SECURITY_PATH).read()
auditor = SettingsAuditor(data)
settings = auditor.audit()
file(SECURITY_PATH, 'w').write(settings)
print auditor.error_data
if __name__ == '__main__':
main()
|