From: Konrad Rzeszutek Wilk Date: Fri, 14 Jun 2013 16:49:37 +0000 (-0400) Subject: debugspace: Add init.custom and ssh_stuff to deal with SSH keys. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1deaa9f972bd7cceef52c60b0223784c9a38fb2d;p=xentesttools%2Fbootstrap.git debugspace: Add init.custom and ssh_stuff to deal with SSH keys. Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/root_image/debugspace/init.custom b/root_image/debugspace/init.custom new file mode 100755 index 0000000..0deb6ac --- /dev/null +++ b/root_image/debugspace/init.custom @@ -0,0 +1,22 @@ +#!/bin/sh + +echo 10 > /proc/sys/kernel/printk + +sed -e 's/:\/bin\/sh$/:\/bin\/bash/' -i /etc/passwd + +MY_SSH_STUFF=/root/ssh_stuff/ + +if [ -e "$MY_SSH_STUFF/ssh_host_key" ]; then + mv -f $MY_SSH_STUFF/ssh_* /etc/ssh/ + + mkdir -p /root/.ssh + mv -f $MY_SSH_STUFF/authorized_keys2 /root/.ssh/ + chmod 700 /root/.ssh + chmod 600 /root/.ssh/authorized_keys2 + chmod 700 /root + + export DEVELOPER_MANAGES_SSH_KEYS=1 + export DEVELOPER_FIXED_SSH_PASSWD=password + + /usr/bin/sshd_server -start +fi diff --git a/root_image/debugspace/ssh_stuff/README b/root_image/debugspace/ssh_stuff/README new file mode 100644 index 0000000..a6f5c22 --- /dev/null +++ b/root_image/debugspace/ssh_stuff/README @@ -0,0 +1,36 @@ +I am tired of using that newly generated SSH key all the time. How can I +put my own SSH key on the root image? + +In the bootstrap/debugspace/ssh_stuff create your SSH keys: + + /usr/bin/ssh-keygen -t rsa1 -b 1024 -f ssh_host_key -N '' | tail -1 + /usr/bin/ssh-keygen -t dsa -b 1024 -f ssh_host_dsa_key -N '' | tail -1 + /usr/bin/ssh-keygen -t rsa -b 1024 -f ssh_host_rsa_key -N '' | tail -1 + + chmod 400 ssh_host_key + chmod 400 ssh_host_dsa_key + chmod 400 ssh_host_rsa_key + + rm -f ssh_host_key.pub + rm -f ssh_host_dsa_key.pub + rm -f ssh_host_rsa_key.pub + +Then you need to generate your own SSH keys: + + +[konrad@localhost ssh_stuff]$ ssh-keygen -t rsa +Generating public/private rsa key pair. +Enter file in which to save the key (/home/konrad/.ssh/id_rsa): +Created directory '/home/konrad/.ssh'. +Enter passphrase (empty for no passphrase): +Enter same passphrase again: +Your identification has been saved in /home/konrad/.ssh/id_rsa. +Your public key has been saved in /home/konrad/.ssh/id_rsa.pub. +.. + +Copy the .ssh/id_rsa.pub in the bootstrap/debugspace/ssh_stuff/authorized_keys2 +file. + +The next time you login in the XTT environment it should not ask you for any +password (except the password you might have choosen when creating your local +key).