Debian Codegraph @

utils/oscap-chroot

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 # Copyright 2016 Red Hat Inc., Durham, North Carolina.
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2 of the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 #
19 # Authors:
20 # Martin Preisler <[email protected]>
21
22 function diescip-shell shell shell-project 0.0.0 die().()
23 {
24 echoscip-shell system . . echo. "$*" >&2
25 exit 1
26 }
27
28 function invalidscip-shell shell shell-project 0.0.0 invalid().()
29 {
30 echoscip-shell system . . echo. -e "$*\n" >&2
31 usagescip-shell shell shell-project 0.0.0 usage().
32 exit 1
33 }
34
35 function usagescip-shell shell shell-project 0.0.0 usage().()
36 {
37 echoscip-shell system . . echo. "oscap-chroot -- Tool for offline SCAP evaluation of filesystems mounted in arbitrary paths."
38 echoscip-shell system . . echo.
39 echoscip-shell system . . echo. "Usage:"
40 echoscip-shell system . . echo.
41 echoscip-shell system . . echo. "$ oscap-chroot CHROOT_PATH xccdf eval [options] INPUT_CONTENT"
42 echoscip-shell system . . echo.
43 echoscip-shell system . . echo. "supported oscap xccdf eval options are:"
44 echoscip-shell system . . echo. " --profile"
45 echoscip-shell system . . echo. " --tailoring-file"
46 echoscip-shell system . . echo. " --tailoring-id"
47 echoscip-shell system . . echo. " --cpe (external OVAL dependencies are not supported yet!)"
48 echoscip-shell system . . echo. " --oval-results"
49 echoscip-shell system . . echo. " --check-engine-results"
50 echoscip-shell system . . echo. " --results"
51 echoscip-shell system . . echo. " --results-arf"
52 echoscip-shell system . . echo. " --report"
53 echoscip-shell system . . echo. " --skip-validation"
54 echoscip-shell system . . echo. " --fetch-remote-resources"
55 echoscip-shell system . . echo. " --local-files"
56 echoscip-shell system . . echo. " --progress"
57 echoscip-shell system . . echo. " --datastream-id"
58 echoscip-shell system . . echo. " --xccdf-id"
59 echoscip-shell system . . echo. " --benchmark-id"
60 echoscip-shell system . . echo.
61 echoscip-shell system . . echo. "$ oscap-chroot CHROOT_PATH oval eval [options] INPUT_CONTENT"
62 echoscip-shell system . . echo.
63 echoscip-shell system . . echo. "supported oscap oval eval options are:"
64 echoscip-shell system . . echo. " --id"
65 echoscip-shell system . . echo. " --variables"
66 echoscip-shell system . . echo. " --directives"
67 echoscip-shell system . . echo. " --results"
68 echoscip-shell system . . echo. " --report"
69 echoscip-shell system . . echo. " --skip-validation"
70 echoscip-shell system . . echo. " --datastream-id"
71 echoscip-shell system . . echo. " --oval-id"
72 echoscip-shell system . . echo.
73 echoscip-shell system . . echo. "$ oscap-chroot CHROOT_PATH oval collect [options] INPUT_CONTENT"
74 echoscip-shell system . . echo.
75 echoscip-shell system . . echo. "supported oscap oval collect options are:"
76 echoscip-shell system . . echo. " --id"
77 echoscip-shell system . . echo. " --syschar"
78 echoscip-shell system . . echo. " --variables"
79 echoscip-shell system . . echo. " --skip-validation"
80 echoscip-shell system . . echo.
81 echoscip-shell system . . echo. "See \`man oscap\` to learn more about semantics of these options."
82 }
83
84 if [scip-shell system . . `[`. $# -lt 1 ]; then
85 invalidscip-shell shell shell-project 0.0.0 invalid(). "No arguments provided."
86 elif [scip-shell system . . `[`. "$1" == "-h" ] || [scip-shell system . . `[`. "$1" == "--help" ]; then
87 usagescip-shell shell shell-project 0.0.0 usage().
88 exit 0
89 elif [scip-shell system . . `[`. "$#" -gt 1 ]; then
90 truescip-shell system . . true.
91 else
92 invalidscip-shell shell shell-project 0.0.0 invalid(). "Invalid arguments provided."
93 fi
94
95 # Learn more at https://www.redhat.com/archives/open-scap-list/2013-July/msg00000.html
96 export OSCAP_PROBE_ROOT
97 OSCAP_PROBE_ROOT="$(cd "$1" && pwdscip-shell system . . pwd.)" || diescip-shell shell shell-project 0.0.0 die(). "Invalid CHROOT_PATH argument."
98 export OSCAP_EVALUATION_TARGET="chroot://$OSCAP_PROBE_ROOT"
99 shift 1
100
101 oscap "$@"
102 EXIT_CODE=$?
103
104 exit $EXIT_CODE