Page 1 of 1 1
Topic Options
#209786 - 2015-01-07 04:27 PM Resetting password based on formula
zrdean Offline
Fresh Scripter

Registered: 2011-03-04
Posts: 5
Loc: Carrollton, Kentucky, USA
I'm having an idea but I'm having a hard time figuring out how to make it a reality.

Basically, I want to create a script that will prompt for a user name. The supervising user will type in the user's username and then the script will query AD for two characters from one attribute of that user and six characters from another attribute of the same user, then reset the password of the user to the result of that query.

Is this possible or am I dreaming too much?

Thanks in advance for any and all ideas.

Top
#209789 - 2015-01-07 08:49 PM Re: Resetting password based on formula [Re: zrdean]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
Definitely possible..

Prompt for the userID and save in a $User var.

Use the fnLDAPQuery to return a pair of values you want to use to create the new password. Use Left(), Right(), or SubStr() to cut the data you want. Save the password in $NewPassword.

The following will set the password:
 Code:
  $objUser = getobject('WinNT://' + $UserID + ',user')

  If $objUser
    $objUser.PasswordExpired = 1        ; force change at next logon
    $objUser.setPassword($NewPassword)  ; define new password
    $objUser.SetInfo
  Else
    'Failed to set password.' @CRLF
  EndIf
You'll need to play with the code to get what you want, but with fnLDAPQuery and the sample above, you've got some direction.

fnLDAPQuery is available here on KORG or (a slightly updated version) in the Kixtart UDF Library on my web site. Be sure to include the external function at the end of your script.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#209795 - 2015-01-09 02:27 AM Re: Resetting password based on formula [Re: Glenn Barnas]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Talk about a security nightmare though. Full on repeatable pattern password so that soon anyone can figure out your passwords. Either manually set them with a good random password generator or better yet let your users create their own.
Top
#209796 - 2015-01-09 03:07 AM Re: Resetting password based on formula [Re: NTDOC]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
It's better than some of the fortune 100 organizations I've consulted for who set every new password to "Welcome1" or "ChangeMe2!" \:D

A simple way to improve this is to create a string of 10 symbols, generate a random number between 0 and 9 and use that to index into the string to add a random symbol between the two standard character sets.

You can also randomly capitalize one of the chars, forcing the others to lower case (including any that might be naturally capitalized).

I'd imagine that this would be part of some helpdesk routine to reset a password when someone calls in about one they forgot, so the exposure should be pretty limited.
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.061 seconds in which 0.031 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org