Manage your Active Directory from Linux with adtool
Active Directory is one of those Microsoft tools that so many have no choice but to use. Although I much prefer LDAP because it is so much easier to set up and manage. But for much of the enterprise world Active Directory is the tool used. Does this mean you are locked into managing Active Directory from a Windows machine? No. If you are a creature of the command line you can manage your AD from the Linux command line. It's not that difficult and, in the end, will give you many more options to keep your AD server managed.
Of course it is not just a matter of working on the Linux end of things. There is one issue to settle on the MS end. You have to activate Secure LDAP on your AD Server. This process goes beyond the scope of this article, but the steps are pretty clear.
Here are the steps to enable Secure LDAP on your Windows 2003 AD server (I will leave out the details):
- Create an Active Directory domain controller certificate request.
- Create a Certification Authority.
- Sign the certificate request by the Certification Authority.
- Export the root certificate Certification Authority.
- Import the root certificate Certification Authority onto the Domain Controller.
- Import the LDAP Server certificate onto the Domain Controller.
- Set up the UMRA (LDAP Client) computer.
- Verify Secure LDAPS using SSL.
Fortunately adtool will be found in your distributions' repositories. So all you have to do is follow these steps:
- Fire up Synaptic (or whichever Add/Remove Software utility you use).
- Do a search for "adtool" (no quotes).
- Mark the results for installation.
- Click Apply to install.
- Close Synaptic.
This is a bit of configuration you need to handle before you can use adtool on your AD server. First create the file (if it doesn't exist) /etc/adtool.cfg and add the following contents:
Where YOUR.DOMAIN.HERE is the actual address to your Active Directory server.
Where PASSWORD is the password for the AD user that has proper permissions to manage the AD server.
You will also need to make sure the following is in your /etc/ldap/ldap.conf file:
BASEÂ Â Â dc=YOUR,dc=DOMAIN,dc=HERE
URIÂ Â Â Â ldaps://YOUR.DOMAIN.HERE
Without the above configuration you will not be able to accept the SSL certificates from the server.
The basic usage of the adtool command is simple. Of course you will have to understand Active Directory in order to really understand the usage of this tool. Below I will give you samples of commands to handle the basic tasks for AD. Any information in ALL CAPS would be altered to fit your needs.
Create a new organizational unit:
adtool oucreate ORGANIZATION NAME ou=user,dc=DOMAIN,dc=COM
Add a user:
adtool useradd USER ou=ORGANIZATION ou=user,cd=DOMAIN,dc=COM
Set a user password:
adtool setpass USER PASSWORD
Unlock a user:
adtool unlock USER
Create a group
adtool groupcreate GROUP ou=user,cd=DOMAIN,dc=COM
Add a user to a group:
adtool groupadd allusers USER
Add an email address for the user:
adtool attributereplace USER mail EMAIL@ADDRESS
We've only really scratched the surface of this powerful tool. But from this you should be able to see how easy adtool can be as well as how helpful it is.Advertisement