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 +239,54 @@ fi
206
239
207
240
if [ "$LOCAL_CONTENT_PATH"!="" ];then
208
241
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!"
242
+
scp_copy_to_temp_dir "$LOCAL_CONTENT_PATH" input.xml || die "Failed to copy input file to remote temporary directory!"
210
243
fi
211
244
if [ "$LOCAL_TAILORING_PATH"!="" ];then
212
245
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!"
246
+
scp_copy_to_temp_dir "$LOCAL_TAILORING_PATH" tailoring.xml || die "Failed to copy tailoring file to remote temporary directory!"
214
247
fi
215
248
if [ "$LOCAL_CPE_PATH"!="" ];then
216
249
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!"
250
+
scp_copy_to_temp_dir "$LOCAL_CPE_PATH" cpe.xml || die "Failed to copy CPE file to remote temporary directory!"
218
251
fi
219
252
if [ "$LOCAL_VARIABLES_PATH"!="" ];then
220
253
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!"
254
+
scp_copy_to_temp_dir "$LOCAL_VARIABLES_PATH" variables.xml || die "Failed to copy OVAL variables file to remote temporary directory!"
222
255
fi
223
256
if [ "$LOCAL_DIRECTIVES_PATH"!="" ];then
224
257
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!"
258
+
scp_copy_to_temp_dir "$LOCAL_DIRECTIVES_PATH" directives.xml || die "Failed to copy OVAL directives file to remote temporary directory!"
226
259
fi
227
260
228
261
echo"Starting the evaluation..."
229
262
# changing directory because of --oval-results support. oval results files are
230
263
# 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!"
271
+
scp_retreive_from_temp_dir results.xml "$TARGET_RESULTS"|| die "Failed to copy the results file back to local machine!"
239
272
fi
240
273
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!"
274
+
scp_retreive_from_temp_dir results-arf.xml "$TARGET_RESULTS_ARF"|| die "Failed to copy the ARF file back to local machine!"
242
275
fi
243
276
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!"
277
+
scp_retreive_from_temp_dir report.html "$TARGET_REPORT"|| die "Failed to copy the HTML report back to local machine!"
245
278
fi
246
279
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!"
280
+
scp_retreive_from_temp_dir syschar.xml "$TARGET_SYSCHAR"|| die "Failed to copy the OVAL syschar file back to local machine!"
248
281
fi
249
282
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!"
283
+
scp_retreive_from_temp_dir '*.result.xml'"./"|| die "Failed to copy OVAL result files back to local machine!"
251
284
fi
252
285
253
286
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!"
287
+
ssh_execute_with_options"rm -r $REMOTE_TEMP_DIR"|| die "Failed to remove remote temporary directory!"
255
288
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!"
289
+
ssh -o ControlPath="$MASTER_SOCKET"$SSH_ADDITIONAL_OPTIONS-p "$SSH_PORT""$SSH_HOST" -O exit|| die "Failed to disconnect!"
257
290
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