Debian Codegraph @

utils/oscap-ssh

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 # Copyright 2015 Martin Preisler <[email protected]>
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 function diescip-shell shell shell-project 0.0.0 die().()
20 {
21 echoscip-shell system . . echo. "$*" >&2
22 exit 1
23 }
24
25 function invalidscip-shell shell shell-project 0.0.0 invalid().()
26 {
27 echoscip-shell system . . echo. -e "$*\n" >&2
28 usagescip-shell shell shell-project 0.0.0 usage().
29 exit 1
30 }
31
32 function usagescip-shell shell shell-project 0.0.0 usage().()
33 {
34 echoscip-shell system . . echo. "oscap-ssh -- Tool for running oscap over SSH and collecting results."
35 echoscip-shell system . . echo.
36 echoscip-shell system . . echo. "Usage:"
37 echoscip-shell system . . echo.
38 echoscip-shell system . . echo. "$ oscap-ssh user@host 22 info INPUT_CONTENT"
39 echoscip-shell system . . echo. "$ oscap-ssh user@host 22 xccdf eval [options] INPUT_CONTENT"
40 echoscip-shell system . . echo.
41 echoscip-shell system . . echo. "Only source data streams are supported as 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 # --check-engine-results is not supported
49 # use --results-arf instead
50 echoscip-shell system . . echo. " --oval-results"
51 echoscip-shell system . . echo. " --results"
52 echoscip-shell system . . echo. " --results-arf"
53 echoscip-shell system . . echo. " --report"
54 echoscip-shell system . . echo. " --skip-validation"
55 echoscip-shell system . . echo. " --fetch-remote-resources"
56 echoscip-shell system . . echo. " --local-files"
57 echoscip-shell system . . echo. " --progress"
58 echoscip-shell system . . echo. " --datastream-id"
59 echoscip-shell system . . echo. " --xccdf-id"
60 echoscip-shell system . . echo. " --benchmark-id"
61 echoscip-shell system . . echo. " --remediate"
62 echoscip-shell system . . echo.
63 echoscip-shell system . . echo. "$ oscap-ssh user@host 22 oval eval [options] INPUT_CONTENT"
64 echoscip-shell system . . echo.
65 echoscip-shell system . . echo. "supported oscap oval eval options are:"
66 echoscip-shell system . . echo. " --id"
67 echoscip-shell system . . echo. " --variables"
68 echoscip-shell system . . echo. " --directives"
69 echoscip-shell system . . echo. " --results"
70 echoscip-shell system . . echo. " --report"
71 echoscip-shell system . . echo. " --skip-validation"
72 echoscip-shell system . . echo. " --datastream-id"
73 echoscip-shell system . . echo. " --oval-id"
74 echoscip-shell system . . echo.
75 echoscip-shell system . . echo. "$ oscap-ssh user@host 22 oval collect [options] INPUT_CONTENT"
76 echoscip-shell system . . echo.
77 echoscip-shell system . . echo. "supported oscap oval collect options are:"
78 echoscip-shell system . . echo. " --id"
79 echoscip-shell system . . echo. " --syschar"
80 echoscip-shell system . . echo. " --variables"
81 echoscip-shell system . . echo. " --skip-validation"
82 echoscip-shell system . . echo.
83 echoscip-shell system . . echo. "specific option for oscap-ssh (must be first argument):"
84 echoscip-shell system . . echo. " --sudo"
85 echoscip-shell system . . echo.
86 echoscip-shell system . . echo. "To supply additional options to ssh/scp, define the SSH_ADDITIONAL_OPTIONS variable"
87 echoscip-shell system . . echo. "For instance, to ignore known hosts records, define SSH_ADDITIONAL_OPTIONS='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"
88 echoscip-shell system . . echo.
89 echoscip-shell system . . echo. "specific option for oscap-ssh (must be first argument):"
90 echoscip-shell system . . echo.
91 echoscip-shell system . . echo. "See \`man oscap\` to learn more about semantics of these options."
92 }
93
94 # $1, $2, ... SSH options (pass them as separate arguments)
95 function ssh_execute_with_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_options(). {
96 sshscip-shell system . . ssh. -o ControlPath="$CONTROL_SOCKET" $SSH_ADDITIONAL_OPTIONS "$@" -p "$SSH_PORT" "$SSH_HOST"
97 }
98
99 # $1: The SSH command.
100 # $2: More of additional options (optional, pass one space-separated string)
101 function ssh_execute_with_command_and_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_command_and_options(). {
102 sshscip-shell system . . ssh. -o ControlPath="$CONTROL_SOCKET" $SSH_ADDITIONAL_OPTIONS $2 -p "$SSH_PORT" "$SSH_HOST" "$1"
103 }
104
105 # $1: Local filename to copy
106 # $2: Remote destination
107 function scp_copy_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_to_temp_dir(). {
108 scpscip-shell system . . scp. -o ControlPath="$CONTROL_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$1" "$SSH_HOST:$REMOTE_TEMP_DIR/$2"
109 }
110
111 # $1: Local directory name to copy
112 # $2: Remote destination
113 function scp_copy_dir_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_dir_to_temp_dir(). {
114 scpscip-shell system . . scp. -r -o ControlPath="$CONTROL_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$1" "$SSH_HOST:$REMOTE_TEMP_DIR/$2"
115 }
116
117 # $1: Remote filename to get
118 # $2: Local destination
119 function scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). {
120 scpscip-shell system . . scp. -o ControlPath="$CONTROL_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$SSH_HOST:$REMOTE_TEMP_DIR/$1" "$2"
121 }
122
123 # $1: The name of the array holding command elements
124 # Returns: String, where individual command components are double-quoted, so they are not interpreted by the shell.
125 # For example, an array ('-p' '(all)') will be transformed to "\"-p\" \"(all)\"", so after the shell expansion, it will end up as "-p" "(all)".
126 function command_array_to_stringscip-shell shell shell-project 0.0.0 command_array_to_string(). {
127 eval "printf '\"%s\" ' \"\${$1[@]}\""
128 }
129
130 function first_argument_is_sudoscip-shell shell shell-project 0.0.0 first_argument_is_sudo(). {
131 [scip-shell system . . `[`. "$1" == "sudo" ] || [scip-shell system . . `[`. "$1" == "--sudo" ]
132 return $?
133 }
134
135 function sanity_check_argumentsscip-shell shell shell-project 0.0.0 sanity_check_arguments(). {
136 if [scip-shell system . . `[`. $# -lt 1 ]; then
137 invalidscip-shell shell shell-project 0.0.0 invalid(). "No arguments provided."
138 elif [scip-shell system . . `[`. "$1" == "-h" ] || [scip-shell system . . `[`. "$1" == "--help" ]; then
139 usagescip-shell shell shell-project 0.0.0 usage().
140 exit 0
141 elif first_argument_is_sudoscip-shell shell shell-project 0.0.0 first_argument_is_sudo(). "$@"; then
142 OSCAP_SUDO="sudo"
143 # force pseudo-tty allocation so that users can type their password if necessary
144 SSH_TTY_ALLOCATION_OPTION="-t"
145 shift
146 fi
147 if [scip-shell system . . `[`. $# -lt 2 ]; then
148 invalidscip-shell shell shell-project 0.0.0 invalid(). "Missing ssh host and ssh port."
149 fi
150 }
151
152 function check_oscap_argumentsscip-shell shell shell-project 0.0.0 check_oscap_arguments(). {
153 if [scip-shell system . . `[`. "$1" == "--v" ] || [scip-shell system . . `[`. "$1" == "--version" ]; then
154 truescip-shell system . . true.
155 elif [scip-shell system . . `[`. "$1" == "-h" ] || [scip-shell system . . `[`. "$1" == "--help" ]; then
156 truescip-shell system . . true.
157 elif [scip-shell system . . `[`. "$1" == "info" ]; then
158 truescip-shell system . . true.
159 elif [scip-shell system . . `[`. "$1 $2" == "xccdf eval" ]; then
160 truescip-shell system . . true.
161 elif [scip-shell system . . `[`. "$1 $2" == "oval eval" ]; then
162 truescip-shell system . . true.
163 elif [scip-shell system . . `[`. "$1 $2" == "oval collect" ]; then
164 truescip-shell system . . true.
165 else
166 diescip-shell shell shell-project 0.0.0 die(). "This script only supports 'sudo' as first argument, '-h', '--help', '--v', '--version', 'info', 'xccdf eval', 'oval eval' and 'oval collect'."
167 fi
168 }
169
170
171 hash ssh 2> /dev/nullscip-shell filesystem . . `/dev/null`. || diescip-shell shell shell-project 0.0.0 die(). "Cannot find ssh, please install the OpenSSH client."
172 hash scp 2> /dev/nullscip-shell filesystem . . `/dev/null`. || diescip-shell shell shell-project 0.0.0 die(). "Cannot find scp, please install the OpenSSH client."
173 hash mktemp 2> /dev/nullscip-shell filesystem . . `/dev/null`. || diescip-shell shell shell-project 0.0.0 die(). "Cannot find mktemp, please install coreutils."
174
175
176 OSCAP_SUDO=""
177 # SSH_ADDITIONAL_OPTIONS may be defined in the calling shell
178 SSH_TTY_ALLOCATION_OPTION=""
179
180 sanity_check_argumentsscip-shell shell shell-project 0.0.0 sanity_check_arguments(). "$@"
181 first_argument_is_sudoscip-shell shell shell-project 0.0.0 first_argument_is_sudo(). "$@" && shift
182
183 SSH_HOST="$1"
184 SSH_PORT="$2"
185
186 shift 2
187
188 check_oscap_argumentsscip-shell shell shell-project 0.0.0 check_oscap_arguments(). "$@"
189
190 CONTROL_SOCKET_DIR=$(mktempscip-shell system . . mktemp. -d)
191 CONTROL_SOCKET="$CONTROL_SOCKET_DIR/ssh_socket"
192
193 echoscip-shell system . . echo. "Connecting to '$SSH_HOST' on port '$SSH_PORT'..."
194 ssh_execute_with_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_options(). -M -f -N -o ServerAliveInterval=60 || diescip-shell shell shell-project 0.0.0 die(). "Failed to connect!"
195 echoscip-shell system . . echo. "Connected!"
196
197 REMOTE_TEMP_DIR=$(ssh_execute_with_command_and_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_command_and_options(). "mktemp -d") || diescip-shell shell shell-project 0.0.0 die(). "Failed to create remote temporary directory!"
198
199 oscap_args=("$@")
200
201 LOCAL_CONTENT_PATH=""
202 LOCAL_TAILORING_PATH=""
203 LOCAL_LOCAL_FILES_PATH=""
204 LOCAL_CPE_PATH=""
205 LOCAL_VARIABLES_PATH=""
206 LOCAL_DIRECTIVES_PATH=""
207 TARGET_RESULTS=""
208 TARGET_RESULTS_ARF=""
209 TARGET_REPORT=""
210 TARGET_SYSCHAR=""
211 OVAL_RESULTS=""
212 STIG_RESULTS=""
213
214 # We have to rewrite various paths to a remote temp dir
215 for i in $(seqscip-shell system . . seq. 0 `exprscip-shell system . . expr. $# - 1`); do
216 let j=i+1
217
218 case "${oscap_args[i]}" in
219 ("--tailoring-file")
220 LOCAL_TAILORING_PATH=${oscap_args[j]}
221 oscap_args[j]="$REMOTE_TEMP_DIR/tailoring.xml"
222 ;;
223 ("--stig-viewer")
224 STIG_RESULTS=${oscap_args[j]}
225 oscap_args[j]="$REMOTE_TEMP_DIR/stig_results.xml"
226 ;;
227 ("--local-files")
228 LOCAL_LOCAL_FILES_PATH=${oscap_args[j]}
229 oscap_args[j]="$REMOTE_TEMP_DIR/local_files"
230 ;;
231 ("--cpe")
232 LOCAL_CPE_PATH=${oscap_args[j]}
233 oscap_args[j]="$REMOTE_TEMP_DIR/cpe.xml"
234 ;;
235 ("--variables")
236 LOCAL_VARIABLES_PATH=${oscap_args[j]}
237 oscap_args[j]="$REMOTE_TEMP_DIR/variables.xml"
238 ;;
239 ("--directives")
240 LOCAL_DIRECTIVES_PATH=${oscap_args[j]}
241 oscap_args[j]="$REMOTE_TEMP_DIR/directives.xml"
242 ;;
243 ("--results")
244 TARGET_RESULTS=${oscap_args[j]}
245 oscap_args[j]="$REMOTE_TEMP_DIR/results.xml"
246 ;;
247 ("--results-arf")
248 TARGET_RESULTS_ARF=${oscap_args[j]}
249 oscap_args[j]="$REMOTE_TEMP_DIR/results-arf.xml"
250 ;;
251 ("--report")
252 TARGET_REPORT=${oscap_args[j]}
253 oscap_args[j]="$REMOTE_TEMP_DIR/report.html"
254 ;;
255 ("--syschar")
256 TARGET_SYSCHAR=${oscap_args[j]}
257 oscap_args[j]="$REMOTE_TEMP_DIR/syschar.xml"
258 ;;
259 ("--oval-results")
260 OVAL_RESULTS="yes"
261 ;;
262 *)
263 ;;
264 esac
265 done
266
267 if [scip-shell system . . `[`. "$1" != "--v" ] && [scip-shell system . . `[`. "$1" != "--version" ] && [scip-shell system . . `[`. "$1" != "-h" ] && [scip-shell system . . `[`. "$1" != "--help" ]; then
268 # Last argument should be the content path
269 LOCAL_CONTENT_PATH="${oscap_args[`exprscip-shell system . . expr. $# - 1`]}"
270 oscap_args[`exprscip-shell system . . expr. $# - 1`]="$REMOTE_TEMP_DIR/input.xml"
271 fi
272
273 [scip-shell system . . `[`. "$LOCAL_CONTENT_PATH" == "" ] || [scip-shell system . . `[`. -f "$LOCAL_CONTENT_PATH" ] || diescip-shell shell shell-project 0.0.0 die(). "Expected the last argument to be an input file, '$LOCAL_CONTENT_PATH' isn't a valid file path or the file doesn't exist!"
274 [scip-shell system . . `[`. "$LOCAL_TAILORING_PATH" == "" ] || [scip-shell system . . `[`. -f "$LOCAL_TAILORING_PATH" ] || diescip-shell shell shell-project 0.0.0 die(). "Tailoring file path '$LOCAL_TAILORING_PATH' isn't a valid file path or the file doesn't exist!"
275 [scip-shell system . . `[`. "$LOCAL_LOCAL_FILES_PATH" == "" ] || [scip-shell system . . `[`. -d "$LOCAL_LOCAL_FILES_PATH" ] || diescip-shell shell shell-project 0.0.0 die(). "Directory '$LOCAL_LOCAL_FILES_PATH' isn't a valid directory path or the directory doesn't exist!"
276 [scip-shell system . . `[`. "$LOCAL_CPE_PATH" == "" ] || [scip-shell system . . `[`. -f "$LOCAL_CPE_PATH" ] || diescip-shell shell shell-project 0.0.0 die(). "CPE file path '$LOCAL_CPE_PATH' isn't a valid file path or the file doesn't exist!"
277 [scip-shell system . . `[`. "$LOCAL_VARIABLES_PATH" == "" ] || [scip-shell system . . `[`. -f "$LOCAL_VARIABLES_PATH" ] || diescip-shell shell shell-project 0.0.0 die(). "OVAL variables file path '$LOCAL_VARIABLES_PATH' isn't a valid file path or the file doesn't exist!"
278 [scip-shell system . . `[`. "$LOCAL_DIRECTIVES_PATH" == "" ] || [scip-shell system . . `[`. -f "$LOCAL_DIRECTIVES_PATH" ] || diescip-shell shell shell-project 0.0.0 die(). "OVAL directives file path '$LOCAL_DIRECTIVES_PATH' isn't a valid file path or the file doesn't exist!"
279
280 if [scip-shell system . . `[`. "$LOCAL_CONTENT_PATH" != "" ]; then
281 echoscip-shell system . . echo. "Copying input file '$LOCAL_CONTENT_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
282 scp_copy_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_to_temp_dir(). "$LOCAL_CONTENT_PATH" input.xml || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy input file to remote temporary directory!"
283 fi
284 if [scip-shell system . . `[`. "$LOCAL_TAILORING_PATH" != "" ]; then
285 echoscip-shell system . . echo. "Copying tailoring file '$LOCAL_TAILORING_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
286 scp_copy_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_to_temp_dir(). "$LOCAL_TAILORING_PATH" tailoring.xml || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy tailoring file to remote temporary directory!"
287 fi
288 if [scip-shell system . . `[`. "$LOCAL_LOCAL_FILES_PATH" != "" ]; then
289 echoscip-shell system . . echo. "Copying directory '$LOCAL_LOCAL_FILES_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
290 scp_copy_dir_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_dir_to_temp_dir(). "$LOCAL_LOCAL_FILES_PATH" local_files || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy directory $LOCAL_LOCAL_FILES_PATH to remote temporary directory!"
291 fi
292 if [scip-shell system . . `[`. "$LOCAL_CPE_PATH" != "" ]; then
293 echoscip-shell system . . echo. "Copying CPE file '$LOCAL_CPE_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
294 scp_copy_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_to_temp_dir(). "$LOCAL_CPE_PATH" cpe.xml || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy CPE file to remote temporary directory!"
295 fi
296 if [scip-shell system . . `[`. "$LOCAL_VARIABLES_PATH" != "" ]; then
297 echoscip-shell system . . echo. "Copying OVAL variables file '$LOCAL_VARIABLES_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
298 scp_copy_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_to_temp_dir(). "$LOCAL_VARIABLES_PATH" variables.xml || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy OVAL variables file to remote temporary directory!"
299 fi
300 if [scip-shell system . . `[`. "$LOCAL_DIRECTIVES_PATH" != "" ]; then
301 echoscip-shell system . . echo. "Copying OVAL directives file '$LOCAL_DIRECTIVES_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
302 scp_copy_to_temp_dirscip-shell shell shell-project 0.0.0 scp_copy_to_temp_dir(). "$LOCAL_DIRECTIVES_PATH" directives.xml || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy OVAL directives file to remote temporary directory!"
303 fi
304
305 echoscip-shell system . . echo. "Starting the evaluation..."
306 # changing directory because of --oval-results support. oval results files are
307 # dumped into PWD, and we can't be sure by the file names - we need controlled
308 # environment
309 if [scip-shell system . . `[`. -z "$OSCAP_SUDO" ]; then
310 ssh_execute_with_command_and_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_command_and_options(). "cd $REMOTE_TEMP_DIR; oscap $(command_array_to_stringscip-shell shell shell-project 0.0.0 command_array_to_string(). oscap_args)" "$SSH_TTY_ALLOCATION_OPTION"
311 else
312 OSCAP_CMD="oscap $(command_array_to_stringscip-shell shell shell-project 0.0.0 command_array_to_string(). oscap_args); rc=\$?; chown \$SUDO_USER $REMOTE_TEMP_DIR/*; exit \$rc"
313 ssh_execute_with_command_and_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_command_and_options(). "cd $REMOTE_TEMP_DIR; $OSCAP_SUDO sh -c '$OSCAP_CMD'" "$SSH_TTY_ALLOCATION_OPTION"
314 fi
315 OSCAP_EXIT_CODE=$?
316 echoscip-shell system . . echo. "oscap exit code: $OSCAP_EXIT_CODE"
317
318 echoscip-shell system . . echo. "Copying back requested files..."
319 if [scip-shell system . . `[`. "$TARGET_RESULTS" != "" ]; then
320 scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). results.xml "$TARGET_RESULTS" || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy the results file back to local machine!"
321 fi
322 if [scip-shell system . . `[`. "$STIG_RESULTS" != "" ]; then
323 scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). stig_results.xml "$STIG_RESULTS" || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy the STIG results file back to local machine!"
324 fi
325 if [scip-shell system . . `[`. "$TARGET_RESULTS_ARF" != "" ]; then
326 scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). results-arf.xml "$TARGET_RESULTS_ARF" || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy the ARF file back to local machine!"
327 fi
328 if [scip-shell system . . `[`. "$TARGET_REPORT" != "" ]; then
329 scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). report.html "$TARGET_REPORT" || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy the HTML report back to local machine!"
330 fi
331 if [scip-shell system . . `[`. "$TARGET_SYSCHAR" != "" ]; then
332 scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). syschar.xml "$TARGET_SYSCHAR" || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy the OVAL syschar file back to local machine!"
333 fi
334 if [scip-shell system . . `[`. "$OVAL_RESULTS" == "yes" ]; then
335 scp_retreive_from_temp_dirscip-shell shell shell-project 0.0.0 scp_retreive_from_temp_dir(). '*.result.xml' "./" || diescip-shell shell shell-project 0.0.0 die(). "Failed to copy OVAL result files back to local machine!"
336 fi
337
338 echoscip-shell system . . echo. "Removing remote temporary directory..."
339 ssh_execute_with_command_and_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_command_and_options(). "rm -r $REMOTE_TEMP_DIR" || diescip-shell shell shell-project 0.0.0 die(). "Failed to remove remote temporary directory!"
340 echoscip-shell system . . echo. "Disconnecting ssh and removing control ssh socket directory..."
341 ssh_execute_with_optionsscip-shell shell shell-project 0.0.0 ssh_execute_with_options(). -O exit || diescip-shell shell shell-project 0.0.0 die(). "Failed to disconnect!"
342 rmscip-shell system . . rm. -r "$CONTROL_SOCKET_DIR" || diescip-shell shell shell-project 0.0.0 die(). "Failed to remove local control SSH socket directory!"
343
344 exit $OSCAP_EXIT_CODE