File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 44
55set -e
66
7+ # Backup our ssh keys if they aren't already.
8+ if [ -d " /share/workers/defaults/ssh" ] && [ ! -d " /share/workers/defaults/ssh/$( hostname -s) " ]; then
9+ mkdir " /share/workers/defaults/ssh/$( hostname -s) "
10+ cp -r /etc/ssh/ssh_host_* " /share/workers/defaults/ssh/$( hostname -s) "
11+ fi
12+
713if [ -d ~ abc/.ssh ]; then
814 chown -R abc: ~ abc
915fi
@@ -15,3 +21,11 @@ if [ -x "/bin/systemctl" ]; then
1521 /bin/systemctl restart supervisor
1622 fi
1723fi
24+
25+ # Replace the ssh keys with the backup if they're different; then restart sshd.
26+ if [ -d " /share/workers/defaults/ssh/$( hostname -s) " ] && \
27+ ! diff -q " /share/workers/defaults/ssh/$( hostname -s) /ssh_host_ecdsa_key" /etc/ssh/ssh_host_ecdsa_key > /dev/null 2>&1
28+ then
29+ cp -r " /share/workers/defaults/ssh/$( hostname -s) /ssh_host_*" /etc/ssh/
30+ /bin/systemctl restart sshd
31+ fi
You can’t perform that action at this time.
0 commit comments