From 045cf9441d8c4bfeb178925bf140848ab251f779 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 27 Oct 2008 15:48:23 -0700 Subject: Fix password changer to deal with update config format Colons are no longer used in config file format, so the sed command to change password was having no effect. Bugfix 3665 --- scripts/install-system | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) mode change 100644 => 100755 scripts/install-system (limited to 'scripts') diff --git a/scripts/install-system b/scripts/install-system old mode 100644 new mode 100755 index ff7a5d41..d755339d --- a/scripts/install-system +++ b/scripts/install-system @@ -854,6 +854,11 @@ copy_config () { fi } +set_encrypted_password() { + sed -i \ + -e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password: \"$2\"/" $3 +} + change_password() { local user=$1 local pwd1="1" @@ -861,9 +866,9 @@ change_password() { until [ "$pwd1" == "$pwd2" ] do - read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 1>&0 + read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 2>&0 echo - read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 1>&0 + read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 2>&0 echo if [ "$pwd1" != "$pwd2" ] @@ -873,10 +878,7 @@ change_password() { # escape any slashes in resulting password local epwd=$(mkpasswd -H md5 "$pwd1" | sed 's:/:\\/:g') - - sed -i \ - -e "/ user $user {/,/}/s/encrypted-password:.*\$/encrypted-password: \"$epwd\"/" \ - $rootfsdir$ofrconfdir/config.boot + set_encrypted_password $user $epwd $rootfsdir$ofrconfdir/config.boot } system_setup () { -- cgit v1.2.3 From 1b0ad6073975f6a728d2fce1a266f22636f574cb Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 27 Oct 2008 15:59:56 -0700 Subject: Handle config file format change in standalone reset Corollary to earlier bugfix in install-system --- scripts/standalone_root_pw_reset | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset index f08bf7d6..34113129 100755 --- a/scripts/standalone_root_pw_reset +++ b/scripts/standalone_root_pw_reset @@ -23,6 +23,11 @@ # The Vyatta config file: CF=/opt/vyatta/etc/config/config.boot +set_encrypted_password() { + sed -i \ + -e "/ user $1 {/,/}/s/encrypted-password .*\$/encrypted-password: \"$2\"/" $3 +} + change_password() { local user=$1 local pwd1="1" @@ -30,9 +35,9 @@ change_password() { until [ "$pwd1" == "$pwd2" ] do - read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 1>&0 + read -p "Enter $user password:" -r -s pwd1 <>/dev/tty 2>&0 echo - read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 1>&0 + read -p "Retype $user password:" -r -s pwd2 <>/dev/tty 2>&0 echo if [ "$pwd1" != "$pwd2" ] @@ -42,10 +47,7 @@ change_password() { # escape any slashes in resulting password local epwd=$(mkpasswd -H md5 "$pwd1" | sed 's:/:\\/:g') - - sed -i \ - -e "/ user $user {/,/}/s/encrypted-password:.*\$/encrypted-password: \"$epwd\"/" \ - $CF + set_encrypted_password $user $epwd $CF } echo "Standalone root password recovery tool." -- cgit v1.2.3 From 6bf9995ed54f023e4147c6011de6a1d5191e766d Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Mon, 27 Oct 2008 16:13:44 -0700 Subject: Fix Bug 3840 System error reported on initial SNMP commit with trap target redirect error to /dev/null --- scripts/snmp/vyatta-snmp.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/snmp/vyatta-snmp.pl b/scripts/snmp/vyatta-snmp.pl index 6de63fb0..58dc374f 100644 --- a/scripts/snmp/vyatta-snmp.pl +++ b/scripts/snmp/vyatta-snmp.pl @@ -163,7 +163,7 @@ sub snmp_write_snmpv3_user { my $vyatta_user = shift; my $user = "rouser $vyatta_user\n"; - system ("sed -i '/user[[:space:]]*vyatta[[:alnum:]]*/d' $snmp_snmpv3_user_conf;"); + system ("sed -i '/user[[:space:]]*vyatta[[:alnum:]]*/d' $snmp_snmpv3_user_conf 2>/dev/null;"); open(my $fh, '>>', $snmp_snmpv3_user_conf) || die "Couldn't open $snmp_snmpv3_user_conf - $!"; print $fh $user; close $fh; -- cgit v1.2.3 From 0f62025ad48e9a50299dea4cbce8640b1fc973d6 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 27 Oct 2008 16:18:45 -0700 Subject: Make stanalone passwd reset work --- scripts/standalone_root_pw_reset | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/standalone_root_pw_reset b/scripts/standalone_root_pw_reset index 34113129..715c67fc 100755 --- a/scripts/standalone_root_pw_reset +++ b/scripts/standalone_root_pw_reset @@ -65,7 +65,7 @@ fi # OK, now we know we are running in standalone mode. Talk to the # user. # -echo "Do you wish to reset the root password" +echo "Do you wish to change the root password" echo -n "to the original default value (vyatta)? (Yes/No) [No]: " read response response=${response:0:1} @@ -96,6 +96,8 @@ cp $CF ${CF}.before_pwrecovery echo "Setting the root password..." +change_password root + echo $(date "+%b%e %T") $(hostname) "Root password changed" \ | tee -a /var/log/auth.log >>/var/log/messages -- cgit v1.2.3