summaryrefslogtreecommitdiffstats
path: root/tools/selinux_baseline.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/selinux_baseline.py')
-rwxr-xr-xtools/selinux_baseline.py33
1 files changed, 5 insertions, 28 deletions
diff --git a/tools/selinux_baseline.py b/tools/selinux_baseline.py
index 507a16f43..ad2a40426 100755
--- a/tools/selinux_baseline.py
+++ b/tools/selinux_baseline.py
@@ -1,41 +1,18 @@
#!/usr/bin/env python
import sys
-import logging
import lxml.etree
-
import Bcfg2.Logger
import Bcfg2.Options
-from Bcfg2.Client.Tools.SELinux import *
-
-LOGGER = None
-
-def get_setup():
- global LOGGER
- optinfo = Bcfg2.Options.CLIENT_COMMON_OPTIONS
- setup = Bcfg2.Options.OptionParser(optinfo)
- setup.parse(sys.argv[1:])
+from Bcfg2.Client.Tools.SELinux import SELinux
- if setup['args']:
- print("selinux_baseline.py takes no arguments, only options")
- print(setup.buildHelpMessage())
- raise SystemExit(1)
- level = 30
- if setup['verbose']:
- level = 20
- if setup['debug']:
- level = 0
- Bcfg2.Logger.setup_logging('selinux_base',
- to_syslog=False,
- level=level,
- to_file=setup['logging'])
- LOGGER = logging.getLogger('bcfg2')
- return setup
def main():
- setup = get_setup()
+ Bcfg2.Options.get_parser(
+ description="Get a baseline bundle of SELinux entries",
+ components=[SELinux]).parse()
config = lxml.etree.Element("Configuration")
- selinux = SELinux(LOGGER, setup, config)
+ selinux = SELinux(config)
baseline = lxml.etree.Element("Bundle", name="selinux_baseline")
for etype, handler in selinux.handlers.items():