From ebfb2ed46dc72aa78e1477607ccf77b1f552fcf0 Mon Sep 17 00:00:00 2001 From: Chuck Short Date: Thu, 14 May 2009 12:11:49 +0200 Subject: * debian/init: Move init script to run before ssh and regenerate the ssh host kes in the init script rather than /etc/rc.local (LP: #370628) * ec2-set-apt-sources.py: - Move sources.list to /var/ec2 so it doesnt get removed after user reboots. * ec2-set-defaults.py: - Move locale to /var/ec2/ so it doesnt get remove after user reboots. * ec2-set-hostname.py - Create an /etc/hostname as well. --- debian/init | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'debian/init') diff --git a/debian/init b/debian/init index 15345b6a..3f982be5 100644 --- a/debian/init +++ b/debian/init @@ -17,11 +17,34 @@ NAME=ec2-init . /lib/lsb/init-functions if [ ! -d /var/run/ec2 ]; then - mkdir /var/run/ec2 + mkdir /var/ec2 fi +first_boot() { + # check to see if we are booting for the first time + if [ ! -f /var/ec2/.first-boot ]; then + log_daemon_msg "Running EC2 first boot" + rm -f /etc/ssh/ssh_host_*_key* + ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N '' | logger -s -t "ec2" + ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N '' | logger -s -t "ec2" + + # This allows user to get host keys securely through console log + echo | logger -s -t "ec2" + echo | logger -s -t "ec2" + echo "#############################################################" | logger -s -t "ec2" + echo "-----BEGIN SSH HOST KEY FINGERPRINTS-----" | logger -s -t "ec2" + ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub | logger -s -t "ec2" + ssh-keygen -l -f /etc/ssh/ssh_host_dsa_key.pub | logger -s -t "ec2" + echo "-----END SSH HOST KEY FINGERPRINTS-----" | logger -s -t "ec2" + echo "#############################################################" | logger -s -t "ec2" + update-motd + touch /var/ec2/.first-boot + fi +} + case "$1" in start) + first_boot log_daemon_msg "Setting EC2 defaults" if ec2-set-defaults 2> /dev/null then -- cgit v1.2.3