Skip to content

Commit d483a9d

Browse files
committed
fix: oscap-ssh: simplify sudo case
1 parent cf1b308 commit d483a9d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

utils/oscap-ssh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ echo "Starting the evaluation..."
306306
if [ -z "$OSCAP_SUDO" ]; then
307307
ssh_execute_with_command_and_options "cd $REMOTE_TEMP_DIR; oscap $(command_array_to_string "${oscap_args[@]}")" "$SSH_TTY_ALLOCATION_OPTION"
308308
else
309-
OSCAP_CMD="oscap $(command_array_to_string "${oscap_args[@]}"); rc=\$?; chown \$SUDO_USER $REMOTE_TEMP_DIR/*; exit \$rc"
310-
ssh_execute_with_command_and_options "cd $REMOTE_TEMP_DIR; $OSCAP_SUDO sh -c '$OSCAP_CMD'" "$SSH_TTY_ALLOCATION_OPTION"
309+
ssh_execute_with_command_and_options "cd $REMOTE_TEMP_DIR; umask 022; $OSCAP_SUDO scap $(command_array_to_string "${oscap_args[@]}")" "$SSH_TTY_ALLOCATION_OPTION"
311310
fi
312311
OSCAP_EXIT_CODE=$?
313312
echo "oscap exit code: $OSCAP_EXIT_CODE"

0 commit comments

Comments
 (0)