Skip to content

Commit 410c78c

Browse files
authored
Merge pull request #1902 from matejak/no_master_socket
Rename master socket to control socket
2 parents a04d087 + 194e7fe commit 410c78c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

utils/oscap-ssh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,31 +96,31 @@ function usage()
9696

9797
# $1, $2, ... SSH options (pass them as separate arguments)
9898
function ssh_execute_with_options {
99-
ssh -o ControlPath="$MASTER_SOCKET" $SSH_ADDITIONAL_OPTIONS "$@" -p "$SSH_PORT" "$SSH_HOST"
99+
ssh -o ControlPath="$CONTROL_SOCKET" $SSH_ADDITIONAL_OPTIONS "$@" -p "$SSH_PORT" "$SSH_HOST"
100100
}
101101

102102
# $1: The SSH command.
103103
# $2: More of additional options (optional, pass one space-separated string)
104104
function ssh_execute_with_command_and_options {
105-
ssh -o ControlPath="$MASTER_SOCKET" $SSH_ADDITIONAL_OPTIONS $2 -p "$SSH_PORT" "$SSH_HOST" "$1"
105+
ssh -o ControlPath="$CONTROL_SOCKET" $SSH_ADDITIONAL_OPTIONS $2 -p "$SSH_PORT" "$SSH_HOST" "$1"
106106
}
107107

108108
# $1: Local filename to copy
109109
# $2: Remote destination
110110
function scp_copy_to_temp_dir {
111-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$1" "$SSH_HOST:$REMOTE_TEMP_DIR/$2"
111+
scp -o ControlPath="$CONTROL_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$1" "$SSH_HOST:$REMOTE_TEMP_DIR/$2"
112112
}
113113

114114
# $1: Local directory name to copy
115115
# $2: Remote destination
116116
function scp_copy_dir_to_temp_dir {
117-
scp -r -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$1" "$SSH_HOST:$REMOTE_TEMP_DIR/$2"
117+
scp -r -o ControlPath="$CONTROL_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$1" "$SSH_HOST:$REMOTE_TEMP_DIR/$2"
118118
}
119119

120120
# $1: Remote filename to get
121121
# $2: Local destination
122122
function scp_retreive_from_temp_dir {
123-
scp -o ControlPath="$MASTER_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$SSH_HOST:$REMOTE_TEMP_DIR/$1" "$2"
123+
scp -o ControlPath="$CONTROL_SOCKET" -P "$SSH_PORT" $SSH_ADDITIONAL_OPTIONS "$SSH_HOST:$REMOTE_TEMP_DIR/$1" "$2"
124124
}
125125

126126
# $1: The name of the array holding command elements
@@ -190,8 +190,8 @@ shift 2
190190

191191
check_oscap_arguments "$@"
192192

193-
MASTER_SOCKET_DIR=$(mktemp -d)
194-
MASTER_SOCKET="$MASTER_SOCKET_DIR/ssh_socket"
193+
CONTROL_SOCKET_DIR=$(mktemp -d)
194+
CONTROL_SOCKET="$CONTROL_SOCKET_DIR/ssh_socket"
195195

196196
echo "Connecting to '$SSH_HOST' on port '$SSH_PORT'..."
197197
ssh_execute_with_options -M -f -N -o ServerAliveInterval=60 || die "Failed to connect!"
@@ -332,8 +332,8 @@ fi
332332

333333
echo "Removing remote temporary directory..."
334334
ssh_execute_with_command_and_options "rm -r $REMOTE_TEMP_DIR" || die "Failed to remove remote temporary directory!"
335-
echo "Disconnecting ssh and removing master ssh socket directory..."
335+
echo "Disconnecting ssh and removing control ssh socket directory..."
336336
ssh_execute_with_options -O exit || die "Failed to disconnect!"
337-
rm -r "$MASTER_SOCKET_DIR" || die "Failed to remove local master SSH socket directory!"
337+
rm -r "$CONTROL_SOCKET_DIR" || die "Failed to remove local control SSH socket directory!"
338338

339339
exit $OSCAP_EXIT_CODE

0 commit comments

Comments
 (0)