Changing active directory user password with dsmod - active-directory

On windows Server 2016,i try to change a an active directory password with dsmod.
DSMOD user "cn=xxxxxxxx,cn=users,dc=xxxxxxxx,dc=xxxxxxxx" -pwd xxxxxxxx -mustchpwd yes
i have the message "objet de l'annuaire non trouvé" (i guess: "object of directory not found")
if i try to add the account with dsadd :
DSADD user "cn=xxxxxxxxxx,cn=users,dc=xxxxxxxxxx,dc=xxxxxxxxxx" -pwd xxxxxxxxxx -display xxxxxxxxxx -desc "xxxxxxxxxx"
i have the message "le compte spécifié existe déjà" (i guess: "account specified already exists")
What did i do wrong ?

• The command that you are using for modifying the password of a user in AD is correct as per the official documentation for this command. But please ensure that you are executing this command from the powershell with elevated privileges, specifically with domain administrator’s credentials as you are modifying the AD attributes for a specific user.
• Secondly, please ensure that the path of the user object in AD for which you want to change the password has been copied from Active Directory Site and Interfaces management portal, i.e., ADSI edit interface as it gives the correct DN (distinguished name) for that object in AD. This will ensure that the exact and perfect DN is used for the object for which password is to be changed. It will not leave any ambiguity there for any other likewise user object existing amidst other AD user objects.
• Next, I would suggest you to please check whether AD replication ports are open or not, i.e., TCP UDP 135, 137, 138, 139, 445, 389, 636, 3268, 3269, 88, 53, 1512, 42, 49152-65535. These ports are associated with various services regarding AD, viz., RPC Endpoint mapper, DNS< WINS resolution, replication, RPC dynamic ports, etc. Ensure that these are reachable from the server system through which you are trying to execute the command.
• Lastly, please check the server system’s logs regarding this issue to see whether any event or input for this is captured or not. Please check the official documentation link below for command execution related arguments: -
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc732954(v=ws.11)
https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc731279(v=ws.11)

Related

ldap queries - need the dn of the users who are authenticated via ldap protocol and their IP address

LDAP/AD Experts,
It might be simple for you but its challenging task for me!.
"ldap queries - need the dn of the users who are authenticated via ldap protocol and their IP address"
We are migrating authentication out of AD/LDAP.
We’re looking to migrate applications that are directly using AD for employees.
Its not specific to OU and Group but overall active directory.
We have plenty of applications which uses AD/LDAP for authentication.
How do I pull such data? At least need to have user details.
Getting the DN of a user is easy with any ldapsearch utility.
There is no method to obtain "the users who are authenticated" from LDAP. You could find the "time" a user did last Authenticate, regardless of how, from the lastLogon or LastLogonTimeStamp.
Generally, the IP Address of the user is not available as part of the user entry within Microsoft Active Directory.
You might be able to obtain this from some power-shell script, but I was unable to find anything from a quick search.

login failed while accessing the Active directory with logon name from WSO2 apim

I've connected my WSO2 api manager with external ldap i.e. Microsoft Active Directory.
I have a following user in my Active directory :
Username : WSO2 Admin
User logon Name : WSO2.Admin#india.test.com
NT logon Name : INDIA\WSO2.Admin
When I'm setting the Admin role for my user's Username in user-mgt.xml file. I'm able to login into the the WSO2 admin console with Username i.e. WSO2 Admin only and I'm also able to see all the users from active directory but If I'm trying to login into management console with the actual logon name i.e. india\WSO2.Admin or WSO2.Admin#india.test.com It's showing me login failed error.
<AdminUser>
<UserName>WSO2 Admin</UserName>
<Password>xxxxx</Password>
</AdminUser>
Can somebody please help me solving this?
In WSO2 carbon (base for all wso2 products, not just apim) realms and domains are having different meaning.
e. g. the domain #india.test.com in the carbon logon form denotes the tenant (the default tenant is carbon.super. You may try to log in with WSO2.Admin#carbon.super in theory it should work. (I did not try it myself)
as well the realm (in form of realm\username) hints the carbon to use a secondary userstore with specified realm parameter (I may be wrong in this format, if someone knows for sure, feel welcome to correct me)
I believe full domain should work with a Kerberos authenticator (used for applications, not for the Carbon management console), but this authenticator has been reworked and improved in current versions, so I don't know current state)

Kerberos SPN gets cached on Windows Servers?

Been integrating Kerberos authentication in my SSO project. Came across a peculiar scenario.
I made a new user and attached an SPN to it. Followed steps on this question and got everything working. By everything I mean :-
kinit username - and then entering password gave me the message that ticket was saved.
kinit spn(int the format HTTP/FQDN) - and then entering password gave me the message that ticked was saved.
After some time I decided to try this over once again, and so I used the command
setspn -D spn username
to detach the spn from username. Then I deleted this user(username) from AD.
Next I created a new user say username1 and did as per this question to register the same spn as in above step for this new user.
Now kinit username1 - and entering password gave the message that ticket is saved, however kinit spn - and entering password gave me the error
client not found in Kerberos database.
Note that everything works fine if I use a different(new) spn.
So the question is, does Windows server have certain cache wherein some links are still present due to which I am not able to use this spn again? Or did I do some mistake while detaching the spn from user?
Thanks,
Nikhil
After reviewing what you wrote in Chat, as well as the full problem history, the problem is actually two problems. (1) You need to always delete the in-use SPN before creating the keytab. (2) Inside the ktpass.exe keytab creation command, you will need to map the user using the SPN of HTTP/vinw12sec5225.eqsectest.local, instead of the short logon name krbspn. Also, I will just make an observation - you do not need to place the SPN in all caps. That makes it hard to read, though for sake of continuity, I did not change that. Only the Kerberos realm should be in all caps. Based on the information you provided, to resolve this case, you should perform the following commands:
setspn -D HTTP/VINW12SEC5225.EQSECTEST.LOCAL krbspn
ktpass /princ HTTP/VINW12SEC5225.EQSECTEST.LOCAL#EQSECTEST.LOCAL /ptype krb5_nt_principal /crypto All /mapuser krbspn#EQSECTEST.LOCAL /out c:\ticket\krbspn.keytab -kvno 0 /pass eQ#12345
klist -e -k -t c:\ticket\krbspn.keytab
For a reference, I show an example of how to create a keytab when Microsoft Active Directory is in use as the Directory Service here: Kerberos Keytabs – Explained. I also provide an accompanying explanation of each ktpass.exe syntax parameter.
To help resolve what still could be wrong after the above steps, then using Notepad++ (not regular Notepad) right-click and edit your keytab file, simply copy the contents of the keytab file (don't make any changes) and then examine the results. The secret key inside will be encrypted - that's ok, look at how the SPN is formulated inside the keytab. It should match to what is shown for the SPN on the AD account. When these don't match you will get "client not found in Kerberos database" error. Also ensure the application server config is pointed to the right keytab file and restart the application service if anything is changed regarding the keytab.

program using task scheduler that echos user while running as admin

I'm trying to create a program which echo's a current user.
As the program needs to be run as admin using the task scheduler the %username% always returns admin, NOT the user.
What I'm looking for in the end is a batch that echo's time stamp, user info and pc info every time a user logs on, off, locks, unlocks, switches user, ...
I ran into similar issue before, try using whoami
The current user IS admin. Windows supports multiple users (although only 1 live one at a time). What you can do is query for users logged on and choose the interactive one.
Lists of potential users
wmic PATH Win32_SystemUsers get /format:List
wmic PATH WIN32_UserAccount get /format:List
wmic PATH WIN32_Account get /format:List
All the users logged on incl system accounts.
NB Administrators will have two logons - one as a limited user and one elevated.
wmic PATH Win32_LoggedOnUser get /format:List
To find info about the logon types
wmic PATH Win32_LogonSession get /format:list
List of logon types - you want 2.
LogonTypeData type: uint32Access type: Read-only
Numeric value that indicates the type of logon session.
Value
Meaning
0
Used only by the System account.
Interactive2
Intended for users who are interactively using the machine, such as a user being logged on by a terminal server, remote shell, or similar process.
Network3
Intended for high-performance servers to authenticate clear text passwords. LogonUser does not cache credentials for this logon type.
Batch4
Intended for batch servers, where processes can be executed on behalf of a user without their direct intervention; or for higher performance servers that process many clear-text authentication attempts at a time, such as mail or web servers. LogonUser does not cache credentials for this logon type.
Service5
Indicates a service-type logon. The account provided must have the service privilege enabled.
Proxy6
Indicates a proxy-type logon.
Unlock7
This logon type is intended for GINA DLLs logging on users who are interactively using the machine. This logon type allows a unique audit record to be generated that shows when the workstation was unlocked.
NetworkCleartext8
Preserves the name and password in the authentication packages, allowing the server to make connections to other network servers while impersonating the client. This allows a server to accept clear text credentials from a client, call LogonUser, verify that the user can access the system across the network, and still communicate with other servers.
NewCredentials9
Allows the caller to clone its current token and specify new credentials for outbound connections. The new logon session has the same local identify, but uses different credentials for other network connections.
RemoteInteractive10
Terminal Services session that is both remote and interactive.
CachedInteractive11
Attempt cached credentials without accessing the network.
CachedRemoteInteractive12

I want to use an LDAP client here at work to talk to Active Directory. How can I discover on my own the IP I should be aiming at?

I know I could just ask, but that would involve bureaucratic entanglements.
Try ping or nslookup _ldap._tcp. with your AD Domain (e.g. _ldap._tcp.test.com) in a console (cmd.exe) - this should give you the AD Server IP.
_ldap._tcp.*
Is a general SRV entry made by your active directory server for locating LDAP (AD) servers in your domain. Your domain itself should match your Windows Login Domain. If this isn't the case right-click on your "My Computer" Icon on your Desktop or in your Explorer and click Properties. In the System Properties there is a Tab showing your Computer Name and its Network ID, which also contains its DOMAIN/WORKGROUP name. This is what you should append to the resource locator above.
Btw. how did you get access to that machine without your Domain Login? :)
Edit: The FOOAD name would be the "old" Domain name, and foo.something.something the new DNS based name - this should give you the server address. Also try the suggestion by Almond, which is more specific regarding the requested service.
I believe that on an AD network that is DNS enabled the root zone points at all the AD servers. So, for instance, if your official AD username is joebloe#company.ad, doing an nslookup of company.ad from cmd.exe will tell you all the IPs of the controllers (and hence all the IPs you could use for LDAP).
This is edited to change the zone name, but one my work system:
C:\Documents and Settings\jj33>nslookup companyname.ad
Server: palpatine.companyname.ad
Address: 172.19.1.3
Name: companyname.ad
Addresses: 172.16.3.2, 172.16.6.2, 172.19.1.3, 172.16.7.9
172.19.1.14, 172.19.1.11
C:\Documents and Settings\jj33>
On my (XP) machine, this shows me my AD domain:
Right click "My Computer"
Select "Computer Name" tab
See "Domain:" field
Open command prompt if you can, type ipconfig /all look at the entry for primary dns suffix. This mostly likely the domain that your workstation is on. Another potenial way is to log out and look at the domain listed below username/password in the login window.
Once you have your domain name open command prompt again and type the following:
nslookup _LDAP._TCP.dc._msdcs.mydomain
this will give you a ip address for the domain controller.

Resources