Spacer http://macenterprise.org MacResource.org - Mac OS X enterprise deployment project Spacer
Site Map Contact Us Site Map About Us Top Background
 
Search
 
 
Active Directory Plug-In Timeout values E-mail
Written by Philip Rinehart   
Tuesday, 26 September 2006
One of the problems that has recently cropped up in our deployment of Active Directory is the long timeouts logging in when users leave the internal network. Why is the such a problem?

The AD plug-in expects to be able to communicate with the GC (Global Catalog) Domain Controllers when logging in. If not, most of our users were experiencing large timeout values, sometimes as long as 20 minutes when off campus. This behavior in large part is due to a very common configuration, keeping the Domain Controllers behind a firewall, thus being unresolveable when not on the internal network.

For our deployment, this was a show stopper, as mobile users simply could not tolerate long delays when off campus. How could we potentially solve this issue? The solution lies in editing the ActiveDirectory.plist. The Directory Access utility allows direct configuration of the LDAP timeout, the Active Directory plug-in does not. Opening up the plist from /Library/Preferences/DirectoryService, search for the relevant sections of the plist. In this case, there is one top level key:

LDAP Connection Timeout
240
By default it is set at 240 seconds, or 4 minutes. That doesn't seem so bad, does it? Wait, there is more...

                AD GC Node

AD KP Server Port 464
AD KP Servers 1 dc.example.com AD Kerberos Server Port 88 AD Kerberos Servers
1 dc2.example.com LDAP Connection Timeout 240 LDAP SearchBase LDAP Server Port 3268 LDAP Servers 1 dc.example.com 2 dc.example2.com
This is a nested dictionary, containing timeout values for each domain controller. The more domain controllers, the longer the timeout value. In this case, our environment had 5 domain controllers. Simple math really for the timeout, 5 controllers x 4 minutes = 20 minutes delays!

Ouch! The solution is simple, edit the values for the Connection timeout, and the delay will be reduced by many orders of magnitude. This is critical for mobile users, as there information is cached, so the delay reduction should not cause problems. Note though, this file has the potential to change upon rebinding, or changing of any value in the AD Plug-in.

To make this a little less painful, here is a script which can be run after joining a machine, or any other time to change the values back to a lower value.
#!/usr/bin/python

import plistlib
import sys

try:
plist = plistlib.Plist.fromFile('/Library/Preferences/DirectoryService/ActiveDirectory.plist')
for key in plist['AD Domain Node List']:
plist['AD Domain Node List'][key]['LDAP Connection Timeout'] =
plist['LDAP Connection Timeout'] =
plist.write('/Library/Preferences/DirectoryService/ActiveDirectory.plist')
except IOError, (strerror):
print strerror
except:
print "Unexpected error:", sys.exc_info()[0]
Note: This code will overwrite your existing Active Directory configuration. Best practice is to backup the file first, this code is mainly intended as an example of how one can change keys using a script. Additionally, this example code, does not have timeout values, insert the desired values in the code above.
Add as favourites (265) | Quote this article on your site | E-mail

Comments (8)
RSS comments
1. 21-02-2007 23:48
Anyone have a working timeout value that they would be willing to post? Also post some background on your AD environment. 
 
I've tried everything from 5 - 240 with no luck. It can't be this easy? Can it? 
 
Thanks for the post! There is hope!
George B. Robb III
2. 01-03-2007 18:09
it did work fine for me (find below the script values I used) 
 
#!/usr/bin/python 
 
import plistlib 
import sys 
 
try: 
plist = plistlib.Plist.fromFile('/Library/Preferences/DirectoryService/ActiveDirectory.plist') 
for key in plist['AD Domain Node List']: 
plist['AD Domain Node List'][key]['LDAP Connection Timeout'] = 6 
plist['LDAP Connection Timeout'] = 6 
plist.write('/Library/Preferences/DirectoryService/ActiveDirectory.plist') 
except IOError, (strerror): 
print strerror 
except: 
print "Unexpected error:", sys.exc_info()[0]
Raul Gallego
3. 01-03-2007 18:10
Did you reboot the machine? Or kill DirectoryService? Usually it takes this to cause DirectoryService to re-read the configuration.
Philip Rinehart
4. 03-03-2007 16:00
In my test computer I did restart the machine. Then I sent the script to 60 Macs at the office with ARD and I haven't had any more complaints on this subject. Thanks a lot for the tip Phillip, it was extreamly helpful.
Raul Gallego
5. 04-06-2007 13:44
I think this may also be done using the 'defaults' command? 
 
sudo defaults write /Library/Preferences/DirectoryService "LDAP Connection Timeout" seconds 
 
(replace "seconds" with your timeout value in seconds) 
 
 
then just reboot or do a sudo killall DirectoryService 
 
This appears to work for me once the AD plugin reinitializes. I just tried setting my Macbook Pro to 8 seconds since we have around 20 child domains in our forest, each with their own DC's... Might that be too short of a timeout value?
William Knight
6. 04-06-2007 17:00
I have not found that it works, as the Active Directory plist is a completely separate plist.
Philip Rinehart
7. 17-08-2007 11:57
This is exactly what i need, but can't get the script to work... how do i take the above script and put it into a working file on my Mac... (not a much of a Mac guy... or a script guy) Thanks to anyone that can help!
Jeff Olthoff
8. 16-10-2007 09:41
Oops, i didnt do the full path in my previous post about using the defaults cmd. I didnt include the actual file name in the path, just its parent directory. ActiveDirectory should be added to the end of the path so the command looks like this 
sudo defaults write /Library/Preferences/DirectoryService /ActiveDirectory "LDAP Connection Timeout" seconds  
 
(replace "seconds" with your timeout value in seconds)
William Knight

Only registered users can write comments.
Please login or register.

Powered by AkoComment Tweaked Special Edition v.1.4.4

Last Updated ( Tuesday, 13 March 2007 )
 
< Prev   Next >