Setup password for root using variable 'DIB_PASSWORD'

Move ssh configuration for root login into 'root-passwd' element.

Fixes: bug #1199970

Change-Id: Iaac460394482651d8cb3d73dd924fcb600d3065c
This commit is contained in:
Ivan Berezovskiy 2013-07-22 17:43:31 +04:00
parent c4ff43713b
commit e1db99666c
2 changed files with 10 additions and 5 deletions

View File

@ -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

View File

@ -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