Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

warden: Re-use same keys to speed up creation

At this point we don't care about security and only use SSH because it
is convenient. When the container its SSH is opened up to the outside
this will need to be revisited.

Change-Id: I32b4507671a140edccdcfefea7f7602ffa7b0ac7
  • Loading branch information...
commit 664f9b9f488f6b2f548098836a2ee51e4686d74f 1 parent fc3c53e
@pietern pietern authored
Showing with 19 additions and 2 deletions.
  1. +2 −0  warden/root/linux/clear.sh
  2. +17 −2 warden/root/linux/skeleton/setup.sh
View
2  warden/root/linux/clear.sh
@@ -5,6 +5,8 @@ set -o errexit
shopt -s nullglob
cd $(dirname "${0}")
+rm -rf tmp
+
for instance in instances/*; do
./destroy.sh $(basename ${instance}) &
done
View
19 warden/root/linux/skeleton/setup.sh
@@ -86,13 +86,28 @@ echo AuthorizedKeysFile /etc/ssh/authorized_keys/%u >> /etc/ssh/sshd_config
echo UseDNS no >> /etc/ssh/sshd_config
EOS
+tmp=$(pwd)/../../tmp/
+mkdir -p ${tmp}
+
# Setup host keys for SSH
mkdir -p ssh
-ssh-keygen -t rsa -N '' -C "${id}@$(hostname)" -f ssh/ssh_host_rsa_key
+if [ -f ${tmp}/ssh_host_rsa_key ]; then
+ cp ${tmp}/ssh_host_rsa_key* ssh/
+else
+ ssh-keygen -t rsa -N '' -C "${id}@$(hostname)" -f ssh/ssh_host_rsa_key
+ cp ssh/ssh_host_rsa_key* ${tmp}
+fi
+
cp ssh/ssh_host_rsa_key* ${target}/etc/ssh/
# Setup access keys for SSH
-ssh-keygen -t rsa -N '' -C '' -f ssh/access_key
+if [ -f ${tmp}/access_key ]; then
+ cp ${tmp}/access_key* ssh/
+else
+ ssh-keygen -t rsa -N '' -C '' -f ssh/access_key
+ cp ssh/access_key* ${tmp}
+fi
+
mkdir -p ${target}/etc/ssh/authorized_keys
cat ssh/access_key.pub >> ${target}/etc/ssh/authorized_keys/root
chmod 644 ${target}/etc/ssh/authorized_keys/root
Please sign in to comment.
Something went wrong with that request. Please try again.