Skip to content

Commit 0149253

Browse files
committed
[rottssh] set mode 700 for socket and log files
Protect from unauthorized access also on local node
1 parent 9326938 commit 0149253

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

config/rootssh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ elif [[ "$1" == "--as-listener--" ]] ; then
5353
#remember processid to be able kill it
5454
nc_procid=$!
5555

56+
# protect socket and log file from reading
57+
chmod 0700 $listener_socket $listener_socket.log
58+
5659
# remove netcat listening on socket
5760
trap "kill -SIGINT $nc_procid >/dev/null 2>&1; rm -f $listener_socket.log" 0 1 2 3 6
5861

@@ -158,16 +161,15 @@ else
158161

159162
listener_processid=$!
160163

161-
# start ssh
164+
# by the exit kill listener and remove temporary files
165+
trap "kill -SIGINT $listener_processid > /dev/null 2>&1; rm -f $listener_local $listener_local.log $listener_remote $root_socket" 0 1 2 3 6
166+
167+
# starting ssh
162168

163169
if [[ "x$ssh_command" == "x" ]] ; then
164170
ssh_command="\$SHELL"
165171
fi
166172

167-
# by the exit kill listener and remove temporary files
168-
trap "kill -SIGINT $listener_processid > /dev/null 2>&1; rm -f $listener_local $listener_local.log $listener_remote $root_socket" 0 1 2 3 6
169-
170-
171173
ssh -t -R $listener_remote:$listener_local -L $localport:$root_socket $ssh_destination $ssh_args \
172174
"chmod 0700 $listener_remote; export ROOT_WEBDISPLAY=server; export ROOT_LISTENER_SOCKET=$listener_remote; export ROOT_WEBGUI_SOCKET=$root_socket; $ssh_command; rm -f $listener_remote $root_socket"
173175

0 commit comments

Comments
 (0)