From e1db99666cdfcb3a4fc69d4a5f039960cadb2f8e Mon Sep 17 00:00:00 2001 From: Ivan Berezovskiy Date: Mon, 22 Jul 2013 17:43:31 +0400 Subject: [PATCH] Setup password for root using variable 'DIB_PASSWORD' Move ssh configuration for root login into 'root-passwd' element. Fixes: bug #1199970 Change-Id: Iaac460394482651d8cb3d73dd924fcb600d3065c --- elements/hadoop/post-install.d/30-setup-ssh | 2 -- elements/root-passwd/post-install.d/99-setup | 13 ++++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/elements/hadoop/post-install.d/30-setup-ssh b/elements/hadoop/post-install.d/30-setup-ssh index ae38321..d78a6ee 100755 --- a/elements/hadoop/post-install.d/30-setup-ssh +++ b/elements/hadoop/post-install.d/30-setup-ssh @@ -21,7 +21,6 @@ distro=$(lsb_release -is || :) echo $distro case "$distro" in Ubuntu ) - augtool -s set /files/etc/ssh/sshd_config/PasswordAuthentication yes augtool -s set /files/etc/ssh/sshd_config/GSSAPICleanupCredentials yes augtool -s set /files/etc/ssh/sshd_config/AuthorizedKeysFile .ssh/authorized_keys ;; @@ -29,7 +28,6 @@ case "$distro" in sed -i 's/ssh_pwauth: 0/ssh_pwauth: 1/' /etc/cloud/cloud.cfg augtool -s clear /files/etc/sudoers/Defaults[type=':nrpe']/requiretty/negate augtool -s set /files/etc/ssh/sshd_config/SyslogFacility AUTH - augtool -s set /files/etc/ssh/sshd_config/PermitRootLogin yes augtool -s set /files/etc/ssh/sshd_config/StrictModes yes augtool -s set /files/etc/ssh/sshd_config/RSAAuthentication yes augtool -s set /files/etc/ssh/sshd_config/PubkeyAuthentication yes diff --git a/elements/root-passwd/post-install.d/99-setup b/elements/root-passwd/post-install.d/99-setup index f0cd7fc..3ef8d92 100755 --- a/elements/root-passwd/post-install.d/99-setup +++ b/elements/root-passwd/post-install.d/99-setup @@ -1,4 +1,11 @@ #!/bin/bash -echo "Setting up root password" -echo -e "swordfish\nswordfish\n" | passwd - +if [ -z "$DIB_PASSWORD" ]; then + echo "Error during setup password for root" + exit 1 +fi +sed -i "s/disable_root: true/disable_root: false/" /etc/cloud/cloud.cfg +install-packages augeas-tools openssh-server openssh-client +augtool -s set /files/etc/ssh/sshd_config/PasswordAuthentication yes +augtool -s set /files/etc/ssh/sshd_config/PermitRootLogin yes +augtool -s set /files/etc/ssh/ssh_config/PasswordAuthentication yes +echo -e "$DIB_PASSWORD\n$DIB_PASSWORD\n" | passwd