Query default Domain Controller OU LDAP - active-directory

I am trying to figure out how to query a domain to find out where the default domain controllers OU via LDAP. I am consultant and do know that 99.9% of domains I will come across with have their the standard OU=domain controllers,DC=domain,DC=root. However, I'm trying to account for that .1% of admins that for what ever reason have moved it to like OU=why,OU=canteven,DC=domain,DC=root. I know that PowerShell can do this with Get-ADDomain but the tool my development team uses is Python. POSH will print a line like:
DomainControllersContainer : OU=Domain Controllers,DC=test,DC=lab
But again, the tools my developers are working on uses python so I'm stuck with traditional LDAP. Does anyone know where this is stored in AD? I just need the attribute path so I know where to point my Dev team. Thanks!

You might be better to utilize DNS for location of Domain Controllers.
You might be able to use some of this information:
https://ldapwiki.com/wiki/How%20Domain%20Controllers%20Are%20Located%20in%20Windows
As far as I know, there is no "default". The concept of "sites" is done from a ip segment condition.
You can also locate a lot of information about domain controllers via LDAP Queries.

Related

Centrex/Asterisk with multiple distincts AD

A little bit of context, I'm currently working on a school project, and I have to set up a "Centrex" style Asterisk server, preparing and tunning thing to reach a production ready installation.
So far I've found informations about coupling your Asterisk to 1 LDAP/AD, with an LDIF file and some configuration of the Asterisk server.
But is it even feasible to use multiple distinct LDAP/AD ? Or are you supposed to connect to only one LDAP/AD per Asterisk server ?
If possible, how much of an hassle would it be to set up ?
I am running CentOS 7.7 with a fresh install of Asterisk 16.
Asterisk is opensource soft. Since almost nobody need connect 2 or more AD to server, this feature have no implementation.
There is 2 possible solution for this
1) read and modifiy ldap driver in asterisk. Just copy/paste to make second with other name. Require c/c++ programming experience
2) read openldap documentation and do do changes in it. Like make sub-trees etc. Require openldap/AD administration experience.
Both seams like require advanced experience.
I would say that typically, LDAP-aware applications only connect to one LDAP tree at a time. This has to do with differences in search locations, schema, etc.
Looking at the Asterisk LDAP integration docs, it looks like it follows the same pattern: it can integrate with one LDAP tree.
If you really want to link multiple ADs / LDAP directory trees, you might be able to use LDAP referrals but that requires quite a lot of knowledge.

How do I find-out what versions of Active Directory I am connecting to when using LDAP?

I would like to know what version of AD I am connecting to when using LDAP to connect to an Active Directory.
How can I do this?
I am using python3-ldap pure-python module to connect to LDAP, but I guess that's not so important. Maybe there is a special object that I need to query?
If you look at RootDSE on a domain controller, you can look at three attributes - domainControllerFunctionality, domainFunctionality, and forestFunctionality. Those will tell you the OS of the DC, and the functional levels of the domain and forest, respectively.
That said, what is it you're trying to accomplish here? This might not be the best approach.

What are the benefits of running Kerberos with an authorization-backing server like LDAP/Active Directory/SPNEGO?

I've been tasked with implementing a Single Sign-On solution in an environment which uses Kerberos with an Active Directory server for the actual storing of the users and their groups. I understand that Kerberos does not support privileges/groups and that this is the reason to be forced to use a backing server like, for example, LDAP, or Active Directory. This is all fine and clear, but what I don't quite understand is why you would still be using Kerberos, when you could simply be connecting to LDAP or Active Directory directly instead and dropping the whole overhead of yet another server.
What am I missing here...? Please advise! Many thanks in advance!
Their is no overhead for another server. Active Directory combines all necessary services in one product.
Kerberos has tremendous benenfits:
One login for all systems
Transparent subsequent login
Ciphered ticket exchange, even full transport encryption is possible
Delegation of credential is supported out of the box
Implemented and well documented in Unix and Windows for almost two decades
I use Kerberos via AD for years in Java and C on Unix and Windows with great success. I wouldn't use anything else in a corporate environment.

Integrate multiple LDAP user data into one LDAP

I want to integrate mutiple LDAP (AD, OpenDS, OpenLDAP etc) user data into one LDAP (OpenDS). Is there any tool which does it? Also, I need my LDAP to be in sync with all other LDAPs so that any change in user info will be reflected in my LDAP as well.
If there isn't a tool for it, can it be achieved through coding? I am new to LDAP and any guidance will be helpful.
Thanks in advance.
This is what most Metadirectory tools are designed to do.
There are two approaches.
1) Sync all data and changes from all the various sources into a central LDAP repository. The Metadirectory itself.
2) Federate or have some kind of proxy that allows a consolidated view. Often these are called Virtual Directories.
You might want to take a look at OpenIDM open source project at openidm.forgerock.org, which can be used to synchronize entries between different services, including LDAP servers.
OpenIDM has in production deployments with 2 ways synchronization between AD and OpenDJ (OpenDJ is OpenDS continuation as an open source project. Upgrade from OpenDS is straightforward).
Kind regards,
Ludo

Spring security LDAP compatible implementations

I've written a web applciation for a client in which authentication/authorization is done by spring security based on the 'internal' database. Now, the client has asked to switch to using their Active Directory instead. I'm a green as can be where LDAP is concerned but looking at the sample code and such it doesn't seem too difficult.
I do have a more general question concerning LDAP. As I gather this is a network protocol for which several implementations are available (among those Active Directory). Now, installing AD on my PC doesn't realy appeal to me (if it is even possible?). However, if all implementations follow the LDAP protocol I would assume that I could simply install Apache Directory on my PC, write the 'code' and then deploy this on a environment with Active Directory and (apart from some config changes) this should work.
Can any one confirm/deny this?
Thanks,
Stijn
It would be lovely if the LDAP standard was implemented the same on all major platforms, but while true in general, there are sufficient differences that you should plan on working against the target LDAP server instance in development.
For Active Directory you could run a Domain Controller in a VM on your workstation (since you cannot install AD on a workstation). You could install ADAM which is a standalone'ish AD like service. But even that is not a 100% match.
Usually the core issues are related to authentication but the generic functionality for querying with filters and so on are the same cross backend server.

Resources