Change Active Directory Password via CFLDAP - HELP!!

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Change Active Directory Password via CFLDAP - HELP!!

    Hello all!

    Has anyone successfully made CFLDAP change an Active Directory user password?
    I've been hitting the wall for the past week, searched the archive, with no
    luck.

    I have set-up SSL between CF and AD, and I am binding to the directory with an
    Account Operator account. AD password requirements have been turned off,
    except password length which is 5 and the password that we try to change is
    clearly more than 5 characters. Once I run the code below, I get the following
    error message:

    An error has occured while trying to execute modify :[LDAP: error code 53 -
    0000001F: SvcErr: DSID-031A0FBC, problem 5003 (WILL_NOT_PERFORM), data 0
    One or more of the required attributes may be missing/incorrect or you do not
    have permissions to execute this operation on the server

    Can anyone help? What we are doing wrong?



    <cfset unicodePass = '"tester123"'> <!--- Set the pass, include the quotes
    --->

    <cfset unPwd = ToBase64(unicodePass)> <!--- Convert to Base64 --->

    <CFLDAP action="MODIFY"
    server="#this.ldapServer#"
    DN="#getUserDNRet#"
    attributes="unicodePwd=#unpwd#"
    modifyType="replace"
    username="domainName\AccountOperatorUserName"
    password="AccountOperatorPasswordr"
    secure="CFSSL_BASIC"
    port="636"
    >
    dmichailov Guest

  2. Similar Questions and Discussions

    1. using CFLDAP to set passwords in Active Directory
      Hi Im using CFLDAP to create users in an active directory. This is working fine however im creating accounts with blank passwords. When i try...
    2. change password in active directory by webapplication (vb.net)
      Dear Sir, I want to change password of users in active directory by asp.net form.this is my code, but i recieve error could anyone help me to...
    3. Use CFLDAP to Add user onto Active Directory
      How do you change a password? What I found out so far was that the password must be: - enclosed in quotes - converted to unicode then base64 -...
    4. CFLDAP and Active Directory
      :frown; I'm attempting to write an application in CF which reads a SQL database and then verifies that the information in a MS Exchange address...
    5. CFLDAP - Active Directory Groups
      I want to add/delete users to an Active Directory group using CFLDAP? Does anyone know how to do this? Thank you very much!
  3. #2

    Default Re: Change Active Directory Password via CFLDAP - HELP!!

    Bump. Anyone?
    dmichailov Guest

  4. #3

    Default Re: Change Active Directory Password via CFLDAP - HELP!!

    Check the security permissions of users in the active directory console. I believe there is an option to allow or disallow users from changing their own passwords.
    amac0001 Guest

  5. #4

    Default Re: Change Active Directory Password via CFLDAP - HELP!!

    Still no luck.

    The users have permission to change their passwords. Also note that I am using
    Account Operator account to reset the password, also tried to use domain
    administrator's account, but still getting the same WILL_NOT_PERFORM error.

    Could it be because of the UNICODE/base64 encoding of the password?

    Can anyone help? Has anyone done this successfully?

    dmichailov Guest

  6. #5

    Smile Re: Change Active Directory Password via CFLDAP - HELP!!

    VICTORY!

    Like many, I had been searching for a way to reset the active directory password via CFLDAP. From what I understood, it should be possible if you set up an SSL connection. After much difficulty, I was able to set up the certs on both servers. I verified that they were working by performing a CFLDAP query using secure="CFSSL_BASIC" over port 636. But I still could not set unicodePwd. I figured it has something to do with the particular encoding of the password but couldn't find a way to make it work.

    I found some embedded Java code which claimed to work for the reset, but it did not work for me. However, with a little tweaking, I was able to get it to work. Here is the code that worked for me:

    <cfset new_pwd = "NewPassword123!">
    <cfset new_pwd_quotes = """"#new_pwd#""">
    <cfset unicode_pwd = new_pwd_quotes.getBytes("UTF-16LE") >

    <cfset adminName = "CN=Administrator, CN=Users, dc=ad2003-dev, dc=com">
    <cfset adminPwd = "adminPassword">
    <cfset userToReset = "CN=Ed Test, OU=Users, OU=Development, OU=IB,
    dc=ad2003-dev, dc=com"> <!--- Retrieve this info via an earlier CFLDAP --->

    <cfset ldapsURL = "ldaps://someLDAPServer.somedomain.com:636">

    <cfset javaEnv = CreateObject("java", "java.util.Hashtable").Init()>
    <cfset javaEnv.put("java.naming.factory.initial", "com.sun.jndi.ldap.LdapCtxFactory")>
    <cfset javaEnv.put("java.naming.provider.url", ldapsURL)>
    <cfset javaEnv.put("java.naming.security.principal", adminName)>
    <cfset javaEnv.put("java.naming.security.credentials", adminPwd)>
    <cfset javaEnv.put("java.naming.security.authentication", "simple")>
    <cfset javaEnv.put("java.naming.security.protocol", "ssl")>

    <cfset javaCtx = CreateObject("java", "javax.naming.directory.InitialDirContext").Init(j avaEnv)>
    <cfset javaAttr = CreateObject("java", "javax.naming.directory.BasicAttributes").Init("un icodePwd", unicode_pwd)>

    <cfset javaCtx.modifyAttributes(userToReset, javaCtx.REPLACE_ATTRIBUTE, javaAttr)>
    <cfset javaCtx.close()>


    See this post for the original embedded Java code:
    http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335974


    I hope this helps someone!
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139