Updated Branches: refs/heads/master 82d00c5fd -> a5ab63602
CLOUDSTACK-1340: Fix typos, paths, create user cloud and make 'em invincible Signed-off-by: Rohit Yadav <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a5ab6360 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a5ab6360 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a5ab6360 Branch: refs/heads/master Commit: a5ab63602d5ceaf09f1c2a3c63f5763767102a05 Parents: 82d00c5 Author: Rohit Yadav <[email protected]> Authored: Wed Feb 27 18:24:50 2013 +0530 Committer: Rohit Yadav <[email protected]> Committed: Wed Feb 27 18:40:51 2013 +0530 ---------------------------------------------------------------------- .../appliance/definitions/systemvmtemplate/base.sh | 4 +- .../definitions/systemvmtemplate/cleanup.sh | 2 - .../definitions/systemvmtemplate/postinstall.sh | 17 +++++++++++--- .../definitions/systemvmtemplate/preseed.cfg | 8 +++--- .../definitions/systemvmtemplate/zerodisk.sh | 5 +++- 5 files changed, 23 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a5ab6360/tools/appliance/definitions/systemvmtemplate/base.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/systemvmtemplate/base.sh b/tools/appliance/definitions/systemvmtemplate/base.sh index a6b69e6..d8f6901 100644 --- a/tools/appliance/definitions/systemvmtemplate/base.sh +++ b/tools/appliance/definitions/systemvmtemplate/base.sh @@ -6,8 +6,8 @@ apt-get -y update apt-get -y install curl unzip apt-get clean -# Set up sudo -echo 'vagrant ALL=NOPASSWD:ALL' > /etc/sudoers.d/vagrant +# Set up sudo, TODO: Check security concerns +echo 'cloud ALL=NOPASSWD:ALL' > /etc/sudoers.d/cloud # Tweak sshd to prevent DNS resolution (speed up logins) echo 'UseDNS no' >> /etc/ssh/sshd_config http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a5ab6360/tools/appliance/definitions/systemvmtemplate/cleanup.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/systemvmtemplate/cleanup.sh b/tools/appliance/definitions/systemvmtemplate/cleanup.sh index 2dad612..c6a1e90 100644 --- a/tools/appliance/definitions/systemvmtemplate/cleanup.sh +++ b/tools/appliance/definitions/systemvmtemplate/cleanup.sh @@ -18,5 +18,3 @@ rm /lib/udev/rules.d/75-persistent-net-generator.rules echo "Adding a 2 sec delay to the interface up, to make the dhclient happy" echo "pre-up sleep 2" >> /etc/network/interfaces -# Remove the vagrant user -deluser --group --force -remove-home vagrant http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a5ab6360/tools/appliance/definitions/systemvmtemplate/postinstall.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/systemvmtemplate/postinstall.sh b/tools/appliance/definitions/systemvmtemplate/postinstall.sh index 4bce4a5..cbe2aab 100644 --- a/tools/appliance/definitions/systemvmtemplate/postinstall.sh +++ b/tools/appliance/definitions/systemvmtemplate/postinstall.sh @@ -68,8 +68,14 @@ install_packages() { setup_accounts() { # Setup sudo to allow no-password sudo for "admin" groupadd -r admin - # Create a 'cloud' user - useradd -G admin cloud + # Create a 'cloud' user if it's not there + id cloud + if [[ $? -ne 0 ]] + then + useradd -G admin cloud + else + usermod -a -G admin cloud + fi echo "root:$ROOTPW" | chpasswd echo "cloud:`openssl rand -base64 32`" | chpasswd sed -i -e '/Defaults\s\+env_reset/a Defaults\texempt_group=admin' /etc/sudoers @@ -156,8 +162,11 @@ configure_services() { cp -rv $snapshot_dir/patches/systemvm/debian/config/* / cp -rv $snapshot_dir/patches/systemvm/debian/vpn/* / mkdir -p /usr/share/cloud/ - tar -cvf /usr/share/cloud/cloud-scripts.tar $snapshot_dir/patches/systemvm/debian/config/* - tar -rvf /usr/share/cloud/cloud-scripts.tar $snapshot_dir/patches/systemvm/debian/vpn/* + cd $snapshot_dir/patches/systemvm/debian/config + tar -cvf /usr/share/cloud/cloud-scripts.tar * + cd $snapshot_dir/patches/systemvm/debian/vpn + tar -rvf /usr/share/cloud/cloud-scripts.tar * + cd /opt rm -fr $snapshot_dir cloudstack.tar.gz chkconfig --add cloud-early-config http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a5ab6360/tools/appliance/definitions/systemvmtemplate/preseed.cfg ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/systemvmtemplate/preseed.cfg b/tools/appliance/definitions/systemvmtemplate/preseed.cfg index b4d2895..ac9edd3 100644 --- a/tools/appliance/definitions/systemvmtemplate/preseed.cfg +++ b/tools/appliance/definitions/systemvmtemplate/preseed.cfg @@ -223,11 +223,11 @@ d-i passwd/root-password-again password password #d-i passwd/root-password-crypted password [MD5 hash] # To create a normal user account. -d-i passwd/user-fullname string Vagrant User -d-i passwd/username string vagrant +d-i passwd/user-fullname string Cloud Stack +d-i passwd/username string cloud # Normal user's password, either in clear text -d-i passwd/user-password password vagrant -d-i passwd/user-password-again password vagrant +d-i passwd/user-password password cloud +d-i passwd/user-password-again password cloud # or encrypted using an MD5 hash. #d-i passwd/user-password-crypted password [MD5 hash] # Create the first user with the specified UID instead of the default. http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a5ab6360/tools/appliance/definitions/systemvmtemplate/zerodisk.sh ---------------------------------------------------------------------- diff --git a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh index d9f978a..3fc80f7 100644 --- a/tools/appliance/definitions/systemvmtemplate/zerodisk.sh +++ b/tools/appliance/definitions/systemvmtemplate/zerodisk.sh @@ -1,10 +1,13 @@ # Clean up stuff copied in by veewee rm -f /root/* +echo "Cleaning up" + # Zero out the free space to save space in the final image: for path in / /boot /usr /var /opt /tmp do dd if=/dev/zero of=$path/zero bs=1M sync - rm -f $i/zero + rm -f $path/zero + echo "Completed zero-ing out disk on $path" done
