Closed
Description
Issue:
When you run a command that invokes the sr3_ssh
script, it sets up a ssh-agent
but that agent's socket is not cleaned up if the script unexpectedly exits. This leads to an absolute metric truckload of $TMPDIR/ssh-*
dirs being created on the host.
Steps to reproduce
ls -dl $TMPDIR/ssh-*
> # nothing returned
sr3l 'echo blah'
> host1: blah
> host2: blah
> host3: blah
ls -dl $TMPDIR/ssh-*
> # nothing returned because the agent was cleaned up properly
sr3l 'echo blah'
> host1: blah
^C #<--- Force the run to stop before it completes.
ls -dl $TMPDIR/ssh-*
drwx------ 2 user user 26 Feb 6 19:58 /tmp/ssh-XXXXXX2j1w9S/
Suggested Fix:
Add a trap to the bash script for on-exit signals:
trap 'ssh-agent -k' EXIT
Metadata
Metadata
Assignees
Labels
No labels