Capture Delete Account events in Active Directory -Terminate User

Capture Delete Account events in Active Directory -Terminate User

I want to terminate (LOGIN_DISABLED = TRUE) a user who was DELETED in Active Directory. I am able to make user terminated (LOGIN_DISABLED = TRUE) when an account in AD was disabled. I want to have the same capability on the DELETE event as well. 

Can you please guide me on how to accomplish this?

  • Suggested Answer

    There is sub-ctp-entitlementImpl policy that does just that with one of it's rules in AD, I recommend you just copy that rule (change conditions of execute), you could even turn on entitlements and use integrated default policies...

  • Hello, Yes I saw the rule and like you said I just copied it into my policy. I have put a screenshot containing the log for the policy. Unfortunately, the user Login Disabled attribute did not turn into TRUE. I have specified the Association like it is done in sub-ctp-entitlementImlp. There was no error in the logs at the same time. I have received a successfull completed operation log. Login Disabled attribute is also present in schema mapping.

    <nds dtdversion="2.2">
    <source>
    <product build="20180125_120000" instance="\OGUZ_TREE\system\driverset1\Active Directory Driver" version="4.1.2.0">AD</product>
    <contact>NetIQ Corporation</contact>
    </source>
    <input>
    <modify class-name="User" event-id="Active Directory Driver##183f509f401##0">
    <association>b22f20ae456f3b42893d660cc8aba8f9</association>
    <modify-attr attr-name="Login Disabled">
    <remove-all-values/>
    <add-value>
    <value type="string">true</value>
    </add-value>
    </modify-attr>
    </modify>
    </input>
    </nds>

    Thanks

  • Hi Oguz,

    In your trace I can see, that modify operation going thru.

    Could you validate the rest of your trace and publish here, how modify operation was executed on your vault or maybe blocked?

  • Verified Answer

    Hello, I have found a solution implementing this requirement. What I did was to create a separate policy under Publisher - Event Transformation package. In the policy, I have used 

    <do-set-dest-attr-value class-name="User" name="Login Disabled" when="after">
    <arg-value type="string">
    <token-text xml:space="preserve">true</token-text>
    </arg-value>
    </do-set-dest-attr-value>

    As action and in Condition I have put <if-operation mode="regex" op="equal">modify|delete</if-operation>. The reason I have used modify is after I create the policy in Event Transformation container, I have realized that the operation turned into modify. I was delete before when my policy is in Publisher-itp.

  • Hi, if it works great.

    We asked you for the whole trace so we could see and advise on what is wrong.
    Trace would be still good to properly advise, but this policy should be under Command Transformation Policies as is 

    sub-ctp-entitlementImpl
  • Hello, I have created my own policy under Publisher channel -> Command Transformation container. However, I am getting an exception when the user is deleted in Active Directory. I tried to use the same rule defined in sub-ctp-entitlementImpl, only I removed the object class conditions as it does not catch it as User.

    Below is my policy;

    <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE policy PUBLIC "policy-builder-dtd" "C:\netiq\idm\apps\Designer\plugins\com.novell.idm.policybuilder_4.0.0.202209141650\DTD\dirxmlscript4.8.4.dtd"><policy>
    <rule>
    <description>Set Login Disabled for Delete Events OGUZ</description>
    <comment xml:space="preserve">Sets Login Disabled to TRUE for Delete Events</comment>
    <conditions>
    <and>
    <if-operation mode="case" op="equal">remove-association</if-operation>
    </and>
    </conditions>
    <actions>
    <do-set-dest-attr-value class-name="User" name="Login Disabled" when="before">
    <arg-association>
    <token-association/>
    </arg-association>
    <arg-value type="string">
    <token-text xml:space="preserve">true</token-text>
    </arg-value>
    </do-set-dest-attr-value>
    <do-veto/>
    </actions>
    </rule>
    </policy>

    The exception I got is;

    [01/15/23 23:56:42.348]:ADTrace PT:Applying policy: %+C%14CNOVLADDCFG-pub-ctp-deleteUserOgz%-C.
    [01/15/23 23:56:42.350]:ADTrace PT: Applying to modify #1.
    [01/15/23 23:56:42.351]:ADTrace PT: Evaluating selection criteria for rule 'Set Login Disabled for Delete Events OGUZ'.
    [01/15/23 23:56:42.354]:ADTrace PT: (if-operation equal "remove-association") = FALSE.
    [01/15/23 23:56:42.354]:ADTrace PT: Rule rejected.
    [01/15/23 23:56:42.355]:ADTrace PT: Applying to remove-association #2.
    [01/15/23 23:56:42.356]:ADTrace PT: Evaluating selection criteria for rule 'Set Login Disabled for Delete Events OGUZ'.
    [01/15/23 23:56:42.359]:ADTrace PT: (if-operation equal "remove-association") = TRUE.
    [01/15/23 23:56:42.361]:ADTrace PT: Rule selected.
    [01/15/23 23:56:42.363]:ADTrace PT: Applying rule 'Set Login Disabled for Delete Events OGUZ'.
    [01/15/23 23:56:42.365]:ADTrace PT: Action: do-set-dest-attr-value("Login Disabled",class-name="User",when="before",arg-association(token-association()),"true").
    [01/15/23 23:56:42.375]:ADTrace PT: arg-association(token-association())
    [01/15/23 23:56:42.376]:ADTrace PT: token-association()
    [01/15/23 23:56:42.377]:ADTrace PT: Token Value: "".
    [01/15/23 23:56:42.378]:ADTrace PT: Arg Value: "".
    [01/15/23 23:56:42.380]:ADTrace PT:
    DirXML Log Event -------------------
    Driver: \OGUZ_TREE\system\driverset1\Active Directory Driver
    Channel: Publisher
    Object: (data\o2more2)
    Status: Error
    Message: Code(-9145) Error in vnd.nds.stream://OGUZ_TREE/system/driverset1/Active+Directory+Driver/Publisher/NOVLADDCFG-pub-ctp-deleteUserOgz#XmlData:13 : Unable to determine target object for action 'do-set-dest-attr-value("Login Disabled",
    class-name="User",when="before",arg-association(token-association()),"true")'.

  • Verified Answer

    When posting trace like this, you always start with the input document, then the processing of it, then the error.

    You are trtying you use the association of the event, but I forget what it looks like but I bet you do not have it in the doc in the <association> node.  Probably need to to use XPATH of  ./text()

  • I have made another test using XPATH ./text() and got the Code(-9039) Element &lt;modify> does not have a valid association

    Shared the full trace log for user test107

    I have moved the Login Disabled part to NOVLADDCFG-pub-ctp policy and inside "remove managed attributes when object disassociated". Because what I realized that I can catch the operation is equal to remove-association.

     test107.log

  • Looking at the trace you included, I see that what I suggested actually did work.

    [01/16/23 05:11:36.424]:ADTrace PT:
    <nds dtdversion="2.2">
      <source>
        <product build="20180125_120000" instance="\OGUZ_TREE\system\driverset1\Active Directory Driver" version="4.1.2.0">AD</product>
        <contact>NetIQ Corporation</contact>
      </source>
      <input>
        <remove-association event-id="Active Directory Driver##185bab4db3e##0">d79e842928610544bfe1cc156f4695d5</remove-association>
      </input>
    </nds>
    
    This triggers:
    [01/16/23 05:11:36.452]:ADTrace PT:    Applying rule 'remove managed attributes when object disassociated'.
    [01/16/23 05:11:36.453]:ADTrace PT:      Action: do-set-dest-attr-value("Login Disabled",arg-association("XPath("./text()")"),"true").
    [01/16/23 05:11:36.453]:ADTrace PT:        arg-association("XPath("./text()")")
    [01/16/23 05:11:36.455]:ADTrace PT:          token-text("XPath("./text()")")
    [01/16/23 05:11:36.457]:ADTrace PT:          Arg Value: "XPath("./text()")".
    [01/16/23 05:11:36.458]:ADTrace PT:        arg-string("true")
    [01/16/23 05:11:36.458]:ADTrace PT:          token-text("true")
    [01/16/23 05:11:36.458]:ADTrace PT:          Arg Value: "true".
    [01/16/23 05:11:36.458]:ADTrace PT:      Action: do-clear-dest-attr-value("DirXML-ADAliasName",when="before",arg-association(token-xpath("./text()"))).
    [01/16/23 05:11:36.462]:ADTrace PT:        arg-association(token-xpath("./text()"))
    [01/16/23 05:11:36.464]:ADTrace PT:          token-xpath("./text()")
    [01/16/23 05:11:36.466]:ADTrace PT:            Token Value: "d79e842928610544bfe1cc156f4695d5".
    [01/16/23 05:11:36.468]:ADTrace PT:          Arg Value: "d79e842928610544bfe1cc156f4695d5".
    [01/16/23 05:11:36.471]:ADTrace PT:      Action: do-clear-dest-attr-value("DirXML-ADContext",when="before",arg-association(token-xpath("./text()"))).
    [01/16/23 05:11:36.474]:ADTrace PT:        arg-association(token-xpath("./text()"))
    [01/16/23 05:11:36.476]:ADTrace PT:          token-xpath("./text()")
    [01/16/23 05:11:36.477]:ADTrace PT:            Token Value: "d79e842928610544bfe1cc156f4695d5".
    [01/16/23 05:11:36.480]:ADTrace PT:          Arg Value: "d79e842928610544bfe1cc156f4695d5".
    

  • Yes it worked. I did a small mistake by putting the XPATH("./text()") between "" and that's because it did not work. But after I reconfigure it it worked.

    Now am able to set a TRUE value for Login Disabled attribute of a user who was deleted in Active Directory.