From fd96bf680d36b5c2694dc57658597332e6e96cc0 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 18 Jun 2008 10:25:00 -0700 Subject: Prompt for vyatta and root password Bugfix: 2900 During install give user option of setting root and vyatta password. Don't leave systems open to attack. --- scripts/install-system | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'scripts') diff --git a/scripts/install-system b/scripts/install-system index 3df0e0ca..1259af3b 100755 --- a/scripts/install-system +++ b/scripts/install-system @@ -535,6 +535,30 @@ copy_config () { fi } +change_password() { + local user=$1 + local pwd + read pwd + local epwd=$(mkpasswd -H md5 $pwd) + + sed -i \ + -e "/ user $user {/,/}/s/encrypted-password:.*\$/encrypted-password: \"$epwd\"/" \ + $rootfsdir$ofrconfdir/config.boot +} + +system_setup () { + echo -n "Would you like to set the passwords for system users (Yes/No) [Yes]: " + local response=$(get_response "Yes" "Yes No Y N") + + if [ "$response" == "yes" ] || [ "$response" == "y" ]; then + echo -n 'System adminstrator (root) password: ' + change_password root + echo -n 'Router adminstrator (vyatta) password: ' + change_password vyatta + fi +} + + # setup grub on the boot sector of a user queried drive install_grub () { orig_install_drive="$INSTALL_DRIVE" @@ -956,6 +980,12 @@ install_root_filesystem "$ROOT_PARTITION" # Copy the config files copy_config "$CONFIG_PARTITION" +# Modify config to match system +# Assume user wants to keep password from old config +if [ ! -d /mnt/config ]; then + system_setup +fi + # check for xen part images in /var/xen setup_xen_partition_images -- cgit v1.2.3