You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ "$LOCAL_CONTENT_PATH"=="" ] || [ -f"$LOCAL_CONTENT_PATH" ] || 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!"
@@ -206,54 +244,54 @@ fi
206
244
207
245
if [ "$LOCAL_CONTENT_PATH"!="" ];then
208
246
echo"Copying input file '$LOCAL_CONTENT_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
209
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$LOCAL_CONTENT_PATH""$SSH_HOST:$REMOTE_TEMP_DIR/input.xml"|| die "Failed to copy input file to remote temporary directory!"
247
+
scp_copy_to_temp_dir "$LOCAL_CONTENT_PATH" input.xml || die "Failed to copy input file to remote temporary directory!"
210
248
fi
211
249
if [ "$LOCAL_TAILORING_PATH"!="" ];then
212
250
echo"Copying tailoring file '$LOCAL_TAILORING_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
213
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$LOCAL_TAILORING_PATH""$SSH_HOST:$REMOTE_TEMP_DIR/tailoring.xml"|| die "Failed to copy tailoring file to remote temporary directory!"
251
+
scp_copy_to_temp_dir "$LOCAL_TAILORING_PATH" tailoring.xml || die "Failed to copy tailoring file to remote temporary directory!"
214
252
fi
215
253
if [ "$LOCAL_CPE_PATH"!="" ];then
216
254
echo"Copying CPE file '$LOCAL_CPE_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
217
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$LOCAL_CPE_PATH""$SSH_HOST:$REMOTE_TEMP_DIR/cpe.xml"|| die "Failed to copy CPE file to remote temporary directory!"
255
+
scp_copy_to_temp_dir "$LOCAL_CPE_PATH" cpe.xml || die "Failed to copy CPE file to remote temporary directory!"
218
256
fi
219
257
if [ "$LOCAL_VARIABLES_PATH"!="" ];then
220
258
echo"Copying OVAL variables file '$LOCAL_VARIABLES_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
221
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$LOCAL_VARIABLES_PATH""$SSH_HOST:$REMOTE_TEMP_DIR/variables.xml"|| die "Failed to copy OVAL variables file to remote temporary directory!"
259
+
scp_copy_to_temp_dir "$LOCAL_VARIABLES_PATH" variables.xml || die "Failed to copy OVAL variables file to remote temporary directory!"
222
260
fi
223
261
if [ "$LOCAL_DIRECTIVES_PATH"!="" ];then
224
262
echo"Copying OVAL directives file '$LOCAL_DIRECTIVES_PATH' to remote working directory '$REMOTE_TEMP_DIR'..."
225
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$LOCAL_DIRECTIVES_PATH""$SSH_HOST:$REMOTE_TEMP_DIR/directives.xml"|| die "Failed to copy OVAL directives file to remote temporary directory!"
263
+
scp_copy_to_temp_dir "$LOCAL_DIRECTIVES_PATH" directives.xml || die "Failed to copy OVAL directives file to remote temporary directory!"
226
264
fi
227
265
228
266
echo"Starting the evaluation..."
229
267
# changing directory because of --oval-results support. oval results files are
230
268
# dumped into PWD, and we can't be sure by the file names - we need controlled
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$SSH_HOST:$REMOTE_TEMP_DIR/results.xml""$TARGET_RESULTS"|| die "Failed to copy the results file back to local machine!"
276
+
scp_retreive_from_temp_dir results.xml "$TARGET_RESULTS"|| die "Failed to copy the results file back to local machine!"
239
277
fi
240
278
if [ "$TARGET_RESULTS_ARF"!="" ];then
241
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$SSH_HOST:$REMOTE_TEMP_DIR/results-arf.xml""$TARGET_RESULTS_ARF"|| die "Failed to copy the ARF file back to local machine!"
279
+
scp_retreive_from_temp_dir results-arf.xml "$TARGET_RESULTS_ARF"|| die "Failed to copy the ARF file back to local machine!"
242
280
fi
243
281
if [ "$TARGET_REPORT"!="" ];then
244
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$SSH_HOST:$REMOTE_TEMP_DIR/report.html""$TARGET_REPORT"|| die "Failed to copy the HTML report back to local machine!"
282
+
scp_retreive_from_temp_dir report.html "$TARGET_REPORT"|| die "Failed to copy the HTML report back to local machine!"
245
283
fi
246
284
if [ "$TARGET_SYSCHAR"!="" ];then
247
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$SSH_HOST:$REMOTE_TEMP_DIR/syschar.xml""$TARGET_SYSCHAR"|| die "Failed to copy the OVAL syschar file back to local machine!"
285
+
scp_retreive_from_temp_dir syschar.xml "$TARGET_SYSCHAR"|| die "Failed to copy the OVAL syschar file back to local machine!"
248
286
fi
249
287
if [ "$OVAL_RESULTS"=="yes" ];then
250
-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT""$SSH_HOST:$REMOTE_TEMP_DIR/*.result.xml""./"|| die "Failed to copy OVAL result files back to local machine!"
288
+
scp_retreive_from_temp_dir '*.result.xml'"./"|| die "Failed to copy OVAL result files back to local machine!"
251
289
fi
252
290
253
291
echo"Removing remote temporary directory..."
254
-
ssh -o ControlPath="$MASTER_SOCKET" -p "$SSH_PORT""$SSH_HOST""rm -r $REMOTE_TEMP_DIR"|| die "Failed to remove remote temporary directory!"
292
+
ssh_execute_with_command_and_options"rm -r $REMOTE_TEMP_DIR"|| die "Failed to remove remote temporary directory!"
255
293
echo"Disconnecting ssh and removing master ssh socket directory..."
256
-
ssh -o ControlPath="$MASTER_SOCKET" -p "$SSH_PORT""$SSH_HOST" -O exit|| die "Failed to disconnect!"
294
+
ssh_execute_with_options -O exit|| die "Failed to disconnect!"
257
295
rm -r "$MASTER_SOCKET_DIR"|| die "Failed to remove local master SSH socket directory!"
Copy file name to clipboardExpand all lines: utils/oscap-ssh.8
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -60,10 +60,16 @@ Supported options are:
60
60
Specific option for oscap-ssh (must be first argument):
61
61
--sudo
62
62
63
-
.SH EXEMPLARY USAGE
63
+
.SS Environment variables
64
+
oscap-ssh checks out the SSH_ADDITIONAL_OPTIONS environment variable, and pastes its contents into the command-line of ssh to the location where options are expected.
65
+
Supply the variable in form of a string that corresponds to a section of the ssh command-line and that consists of options you want to pass.
66
+
67
+
.SH EXAMPLE USAGE
64
68
.SS Simple XCCDF evaluation
65
69
The following command evaluates a remote Fedora machine as root. HTML report is written out as report.html on the local machine. Can be executed from any machine that has ssh, scp and bash. The local machine does not need to have openscap installed.
70
+
It also uses the SSH_ADDITIONAL_OPTIONS variable to configure ssh in such way that contents of the known_hosts file are ignored.
0 commit comments