diff options
author | Chuck Short <zulcss@ubuntu.com> | 2009-05-14 12:11:49 +0200 |
---|---|---|
committer | Chuck Short <zulcss@ubuntu.com> | 2009-05-14 12:11:49 +0200 |
commit | ebfb2ed46dc72aa78e1477607ccf77b1f552fcf0 (patch) | |
tree | 43ac6c2aa8d16a1f6d8d9fbf596605a4a9c1c32a /debian/init | |
parent | dd112c3afe50c75ae9b00f142b550c6e0d95f47b (diff) | |
download | vyos-cloud-init-ebfb2ed46dc72aa78e1477607ccf77b1f552fcf0.tar.gz vyos-cloud-init-ebfb2ed46dc72aa78e1477607ccf77b1f552fcf0.zip |
* 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.
Diffstat (limited to 'debian/init')
-rw-r--r-- | debian/init | 25 |
1 files changed, 24 insertions, 1 deletions
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 |