Caveat Emptor:
#!/bin/sh
#-----------------------------------------------------------------------------
# Name: openvas-chgpass
# Status:
# Date:
# Description:
#
#
#-----------------------------------------------------------------------------
bindir=/usr/bin
sbindir=/usr/sbin
datadir=/usr/share
openvas_users_dir=/var/lib/openvas/users
# add the openvas installation path
PATH=$PATH:$sbindir:$bindir:/usr/ssl/bin:/usr/local/ssl/bin:/opt/ssl/bin
export PATH
umask 066
# check whether we have echo -n, depending
# on the current shell, used
case `echo -n` in
\-n) Xn= ; Xc='\c' ;;
*) Xn=-n ; Xc=
esac
# check if gettext is present
GETTEXT=`command -v gettext.sh`
if [ $? -ne 0 ]; then
# define dummy functions
gettext () {
echo $Xn "$1" $Xc
}
eval_gettext () {
eval_gettext_var="echo $1"
echo $Xn `eval $eval_gettext_var` $Xc
}
else
# initialize gettext
. $GETTEXT
export TEXTDOMAIN=openvas-scripts
export TEXTDOMAINDIR=$datadir/locale
fi
# Test if we have MD5
X=`echo x | openssl md5`
if [ "$X" = "401b30e3b8b5d629635a5c613cdb7919" -o \
"$X" = "401B30E3B8B5D629635A5C613CDB7919" ]; then
MD5CMD="openssl md5"
else
X=`echo x | md5sum | awk '{print $1}'`
if [ "$X" = "401b30e3b8b5d629635a5c613cdb7919" -o \
"$X" = "401B30E3B8B5D629635A5C613CDB7919" ]; then
MD5CMD=md5sum
else
gettext "No MD5 algorithm found in the current path!"; echo
gettext "Please make sure either openssl or md5sum is
available!"; echo
exit 1
fi
fi
if [ ! -d ${openvas_users_dir} ]; then
gettext "No openvassd user accounts directory"; echo
exit 1
fi
if [ -z "$(ls ${openvas_users_dir}/* 2>/dev/null)" ]; then
gettext "No openvassd user accounts"; echo
exit 1
fi
# Here we go
echo
gettext "Change password for openvassd user"; echo
gettext "List of openvassd login users"; echo
ls $openvas_users_dir
echo "---------------------------------"
echo
ok=`gettext "n"`
while [ "$ok" = `gettext "n"` ] ; do
echo $Xn "`gettext "Login :"` $Xc"
read login
# Abort with error if nothing to read in.
if [ $? = 1 -o -z "${login}" ]; then
gettext "No input, exiting."; echo
exit 1;
fi
if [ ! -d $openvas_users_dir/$login ]; then
gettext "This login (${login}) does not exist. Choose another
one."; echo
else
ok=`gettext "y"`
fi
done
askPasswd=`gettext "Login password :"`
askPasswdAgain=`gettext "Login password (again) :"`
sayPasswd=`gettext "Password :"`
ok="n"
while [ "$ok" = "n" ]; do
echo $Xn "$askPasswd $Xc"
stty -echo
read password
echo
echo $Xn "$askPasswdAgain $Xc"
read password_again
stty echo
echo
if [ -z "$password" ]; then
gettext "Your password can not be empty."; echo
else
if [ "$password" != "$password_again" ]; then
gettext "Passwords do not match!"; echo
else
ok="y"
fi
fi
done
test -c /dev/urandom &&
{
URANDOM=`dd if=/dev/urandom bs=16 count=16 2>/dev/null|$MD5CMD`
}
SEED=`(echo $SEED; date; df; ls -l; echo $URANDOM) | $MD5CMD | awk '{print $1}'`
H=`echo $Xn $SEED$password$Xc | $MD5CMD | awk '{print $1}'`
echo $H $SEED > "$openvas_users_dir/$login/auth/hash"
gettext "Openvassd user (${login}) password changed."; echo
exit 0
-----Original Message-----
From: Openvas-discuss [mailto:[email protected]] On
Behalf Of Jan-Oliver Wagner
Sent: Tuesday, May 14, 2013 5:15 AM
To: [email protected]
Subject: Re: [Openvas-discuss] rester admin password
On Freitag, 10. Mai 2013, Florent THOMAS wrote:
> i'm trying to connect to the IRC channel but it seems to be unused.
> So I post here my question
>
> I set up the admin password with special characters so that I can't
> login with admin password So how to reset the password?
>
> Any help would be appreciated,
I guess you mean a user with Administrator role?
Create a second one via openvasad and then use this second one to change the
password of the first one. You can delete the second one afterwards.
There are hackish options as well like replacing the hashes ;-)
--
Dr. Jan-Oliver Wagner | ++49-541-335084-0 | http://www.greenbone.net/
Greenbone Networks GmbH, Neuer Graben 17, 49074 Osnabrück | AG Osnabrück, HR B
202460
Geschäftsführer: Lukas Grunwald, Dr. Jan-Oliver Wagner
_______________________________________________
Openvas-discuss mailing list
[email protected]
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-discuss
_______________________________________________
Openvas-discuss mailing list
[email protected]
https://lists.wald.intevation.org/cgi-bin/mailman/listinfo/openvas-discuss