2014-04-24 12:14:54 -07:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Copyright (C) 2014 Canonical Ltd.
|
|
|
|
# Author: Steve Beattie <steve@nxnw.org>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of version 2 of the GNU General Public
|
|
|
|
# License published by the Free Software Foundation.
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
|
|
|
|
import os
|
2022-08-28 22:40:28 -04:00
|
|
|
import sys
|
2022-08-07 20:32:07 -04:00
|
|
|
from argparse import ArgumentParser
|
2014-04-24 12:14:54 -07:00
|
|
|
|
2022-08-07 20:32:07 -04:00
|
|
|
from testlib import read_features_dir
|
|
|
|
|
2022-08-07 12:26:24 -04:00
|
|
|
DEFAULT_FEATURES_DIR = '/sys/kernel/security/apparmor/features'
|
|
|
|
|
2014-04-24 12:14:54 -07:00
|
|
|
|
|
|
|
def main():
|
|
|
|
p = ArgumentParser()
|
|
|
|
|
|
|
|
p.add_argument('fdir', action="store", nargs='?', metavar="features_dir",
|
|
|
|
default=DEFAULT_FEATURES_DIR, help="path to features directory")
|
|
|
|
config = p.parse_args()
|
|
|
|
|
|
|
|
if not os.path.exists(config.fdir):
|
2023-02-19 16:26:14 -05:00
|
|
|
print('Unable to find apparmor features directory "{}"'.format(config.fdir), file=sys.stderr)
|
2014-04-24 12:14:54 -07:00
|
|
|
return 1
|
|
|
|
|
|
|
|
features = read_features_dir(config.fdir)
|
|
|
|
print(features)
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|
2022-08-07 12:26:24 -04:00
|
|
|
|
2014-04-24 12:14:54 -07:00
|
|
|
if __name__ == "__main__":
|
2022-08-28 22:40:28 -04:00
|
|
|
sys.exit(main())
|