Browse Source

Setup password for root using variable 'DIB_PASSWORD'

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

Fixes: bug #1199970

Change-Id: Iaac460394482651d8cb3d73dd924fcb600d3065c
Ivan Berezovskiy 5 years ago
parent
commit
e1db99666c

+ 0
- 2
elements/hadoop/post-install.d/30-setup-ssh View File

@@ -21,7 +21,6 @@ distro=$(lsb_release -is || :)
21 21
 echo $distro
22 22
 case "$distro" in
23 23
    Ubuntu )
24
-      augtool -s set /files/etc/ssh/sshd_config/PasswordAuthentication yes
25 24
       augtool -s set /files/etc/ssh/sshd_config/GSSAPICleanupCredentials yes
26 25
       augtool -s set /files/etc/ssh/sshd_config/AuthorizedKeysFile .ssh/authorized_keys
27 26
    ;;
@@ -29,7 +28,6 @@ case "$distro" in
29 28
       sed -i 's/ssh_pwauth:   0/ssh_pwauth:   1/' /etc/cloud/cloud.cfg
30 29
       augtool -s clear /files/etc/sudoers/Defaults[type=':nrpe']/requiretty/negate
31 30
       augtool -s set /files/etc/ssh/sshd_config/SyslogFacility AUTH
32
-      augtool -s set /files/etc/ssh/sshd_config/PermitRootLogin yes
33 31
       augtool -s set /files/etc/ssh/sshd_config/StrictModes yes
34 32
       augtool -s set /files/etc/ssh/sshd_config/RSAAuthentication yes
35 33
       augtool -s set /files/etc/ssh/sshd_config/PubkeyAuthentication yes

+ 10
- 3
elements/root-passwd/post-install.d/99-setup View File

@@ -1,4 +1,11 @@
1 1
 #!/bin/bash
2
-echo "Setting up root password"
3
-echo -e "swordfish\nswordfish\n" | passwd
4
-
2
+if [ -z "$DIB_PASSWORD" ]; then
3
+   echo "Error during setup password for root"
4
+   exit 1
5
+fi
6
+sed -i "s/disable_root: true/disable_root: false/" /etc/cloud/cloud.cfg
7
+install-packages augeas-tools openssh-server openssh-client
8
+augtool -s set /files/etc/ssh/sshd_config/PasswordAuthentication yes
9
+augtool -s set /files/etc/ssh/sshd_config/PermitRootLogin yes
10
+augtool -s set /files/etc/ssh/ssh_config/PasswordAuthentication yes
11
+echo -e "$DIB_PASSWORD\n$DIB_PASSWORD\n" | passwd

Loading…
Cancel
Save