<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=OldLDAP</id>
	<title>OldLDAP - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=OldLDAP"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OldLDAP&amp;action=history"/>
	<updated>2026-08-23T01:55:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=OldLDAP&amp;diff=2364&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=OldLDAP&amp;diff=2364&amp;oldid=prev"/>
		<updated>2016-04-06T20:15:48Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Jim Meyer&amp;#039;s User_Local.pm overlay ==&lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
&lt;br /&gt;
These pages offers an overlay for the RT::User object which provides integrated, configurable LDAP user authentication and user information services. Both services have been approached previously (See [[LdapOverlay]] for user authentication, [[AutoCreateFromExternalUserInfo]] and [[AutoCreateAndCanonicalizeUserInfo]] for user info). This implementation is heavily derivative of (and owes much to) those previous solutions.&lt;br /&gt;
&lt;br /&gt;
If you haven&amp;#039;t already read [[CleanlyCustomizeRT]], now&amp;#039;s the time. You&amp;#039;ll need it to understand what&amp;#039;s going on here.&lt;br /&gt;
&lt;br /&gt;
You might also want to read [[LdapSummary]], a summary of all the available LDAP-for-RT implementations.&lt;br /&gt;
&lt;br /&gt;
Please send any questions to Jim Meyer, [mailto:purp@acm.org purp@acm.org], with the phrase &amp;#039;&amp;#039;&amp;#039;RT LDAP&amp;#039;&amp;#039;&amp;#039; in the subject.&lt;br /&gt;
&lt;br /&gt;
=== Features ===&lt;br /&gt;
&lt;br /&gt;
* Integration of authentication and information services&lt;br /&gt;
* User-configurable map of LDAP attributes to RT attributes&lt;br /&gt;
* Uses LDAP info to bootstrap new user accounts&lt;br /&gt;
* Update RT account info from LDAP at login&lt;br /&gt;
* Multiple servers -- you can choose to use different servers for authentication and information&lt;br /&gt;
* Per-server configuration -- each server can have different user/password, base, filter, group, SSL settings, etc.&lt;br /&gt;
* Authentication stack -- you can choose the order of authentication methods; this allows you to fall back on RT&amp;#039;s internal authentication if LDAP fails, or vice versa. You can also implement other authentication methods and place them into the stack.&lt;br /&gt;
* Autocreate RT accounts at login for users who can validly authenticate somewhere within the authentication stack.&lt;br /&gt;
* Works with most LDAP and Windows Active Directory configurations&lt;br /&gt;
&lt;br /&gt;
=== News ===&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.08.24&amp;#039;&amp;#039;&amp;#039;: /Autohandler callback and rt CLI tool bugfix/&lt;br /&gt;
&lt;br /&gt;
Philip Kime noticed a problem where the authohandler callback caused the rt CLI tool to fail. The callback was emitting (an HTML comment to prove it&amp;#039;d been loaded) and it shouldn&amp;#039;t, causing an error like &amp;quot;rt: Malformed RT response from [...]&amp;quot;. The offending line has been removed from [[LdapAutocreateAuthCallback]]; you should remove it from your installation to avoid related issues.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.06.20&amp;#039;&amp;#039;&amp;#039;: /Critical Security Update/&lt;br /&gt;
&lt;br /&gt;
With many thanks to Walter Duncan (walter dot duncan at cox dot net), a critical security problem which would let unauth&amp;#039;d users log in has been patched. If you&amp;#039;re using the [[LdapAutocreateAuthCallback]], please update it immediately.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.06.05&amp;#039;&amp;#039;&amp;#039;: /v1.1b1 &amp;quot;Punch-Drunk Hamster&amp;quot; release/&lt;br /&gt;
&lt;br /&gt;
Now with /automatic update of RT account info from LDAP;/ that&amp;#039;s the big feature add this time around. Also lots of code refactoring, making it a bit more economical and/or efficient. Enough stuff got juggled around that I&amp;#039;d call the code /&amp;#039;&amp;#039;&amp;#039;POTENTIALLY VERY UNSTABLE&amp;#039;&amp;#039;&amp;#039;/ until I get some news about tests run by folks like you. =]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.06.02&amp;#039;&amp;#039;&amp;#039;: /[[AutoCreation]] of Authenticated Accounts Added/&lt;br /&gt;
&lt;br /&gt;
With the most enormous thanks possible to [[RuslanZakirov]] who got me thinking about it the right way, and also to [[DirkPape]] for his notes on Callbacks on the [[CleanlyCustomizeRT]] page, there&amp;#039;s now an [[LdapAutocreateAuthCallback]] which will autocreate RT accounts at login if the user provides valid LDAP authentication data. &amp;#039;&amp;#039;&amp;#039;This means anyone in LDAP can log into RT with no need to first create their RT account.&amp;#039;&amp;#039;&amp;#039; Instructions for upgrading your installation can be found at the top of the [[LdapAutocreateAuthCallback]] page. I know a large number of you asked for this; I&amp;#039;m sorry it took so long to get it right. It&amp;#039;s right, now. =]&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.03.29&amp;#039;&amp;#039;&amp;#039;: /Non-LDAP User Creation Added/&lt;br /&gt;
&lt;br /&gt;
Since I&amp;#039;ve not had a reply from the rt-devel crowd, I&amp;#039;ve incorporated the config variable &amp;quot;$RT::[[LdapAutoCreateNonLdapUsers]]&amp;quot; into the overlay. Setting this to a non-null value (e.g. 1) will cause RT to autocreate an account from email or when added to a ticket even if the user is not in LDAP. /*Note that this does not include auto-creation of accounts on failed web login. This is [http://www.gossamer-threads.com/lists/rt/users/54131#54131 discussed being] as a separate overlay as it may be useful in non-LDAP circumstances as well.*/&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.03.21&amp;#039;&amp;#039;&amp;#039;: /Documentation Reorg, testing looking good/&lt;br /&gt;
&lt;br /&gt;
At this point it seems the code is largely behaving, with one unexpected behavior in that account auto-creation from email fails if the user is not in LDAP. There&amp;#039;s a [http://www.gossamer-threads.com/lists/rt/users/54109 fix quick] posted to the rt-users mailing list; as soon as there&amp;#039;s a more permanent fix, I&amp;#039;ll post news and/or the fix here. Meanwhile, I&amp;#039;ve had good reports of SSL, drop-in replacement for other implementations, and Windows Active Directory (when you map Name =&amp;amp;gt; &amp;#039;s[[AMAccountName]]&amp;#039;, see below).&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;2006.01.06&amp;#039;&amp;#039;&amp;#039;: /v1.0b1 &amp;quot;Rabid Guinea Pig&amp;quot; release/&lt;br /&gt;
&lt;br /&gt;
Major integration and refactor of previous implementations. All functionality now resides in User_Local.pm, obsoleting previously required CurrentUser_Local.pm. &amp;#039;&amp;#039;&amp;#039;SSL connections to LDAP have not been tested. Non-Linux installations have not been tested. Drop-in replacement for previous implementations has only been partially tested.&amp;#039;&amp;#039;&amp;#039; If you can test either of these, please let me know where they work well and/or poorly. Thanks!&lt;br /&gt;
&lt;br /&gt;
=== Installation ===&lt;br /&gt;
&lt;br /&gt;
There are two essential pieces to this implementation: the RT::User overlay (User_Local.pm) and the configuration info required to use it. There&amp;#039;s a third, optional piece -- the Authentication callback. This last causes RT accounts to be created on the fly for valid LDAP users.&lt;br /&gt;
&lt;br /&gt;
*You must know whether or not you have multiple site customizations in User_Local.pm and how to avoid removing bits you want to keep for other non-LDAP reasons.* If you don&amp;#039;t know this, you should spend time understanding exactly what is in your existing User_Local.pm and whether or not it conflicts with the functions in this implementation.&lt;br /&gt;
&lt;br /&gt;
I&amp;#039;ll gladly answer some questions when I can, but I&amp;#039;ve got a new daughter (best fun ever), a new [[MacBook]] Pro (best computer ever), and a new day job (best challenge ever). I also, unfortunately, have no running RT installation nor an LDAP server to play with to set up failure states. You&amp;#039;ll understand that responses might take me a while. =\&lt;br /&gt;
&lt;br /&gt;
==== New Installs ====&lt;br /&gt;
&lt;br /&gt;
Installation is very straightforward if you haven&amp;#039;t installed any previous LDAP auth/info implementations and don&amp;#039;t currently have a User_Local.pm.&lt;br /&gt;
&lt;br /&gt;
1. Copy the code from [[LdapUserLocalOverlay]] into [=${RTHOME}/local/lib/RT/[[User Local|User_Local]].pm] (if it doesn&amp;#039;t exist, create it)&lt;br /&gt;
&lt;br /&gt;
2. Copy the config settings from [[LdapSiteConfigSettings]] into [=${RTHOME}/etc/[[RT SiteConfig|RT_SiteConfig]].pm] (I&amp;#039;d put it at the end, but it shouldn&amp;#039;t matter)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039; Active Directory users should use [[LdapSiteConfigSettingsForActiveDirectory]] as a template.&lt;br /&gt;
&lt;br /&gt;
3. Customize the configuration settings; pay careful attention to [[LdapAttrMap]], which is a hash reference to map RT&amp;#039;s attributes to the appropriate fields of your LDAP schema. *It&amp;#039;s very unlikely that the [[LdapAttrMap]] shown in [[LdapSiteConfigSettings]] will work for you without customization! In particular, [[ActiveDirectory]] users should map:*&lt;br /&gt;
&lt;br /&gt;
 Name =&amp;amp;gt; &amp;#039;sAMAccountName&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
If your LDAP server does not allow anonymous binding, $[[LdapUser]] and $[[LdapPass]] should be set to the appropriate DN and password for intial connection.&lt;br /&gt;
&lt;br /&gt;
4. Optionally, copy the code from [[LdapAutocreateAuthCallback]] into &amp;lt;code&amp;gt;${RTHOME}/local/html/Callbacks/LDAP/autohandler/Auth&amp;lt;/code&amp;gt; (most likely this doesn&amp;#039;t exist, so create it)&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Note&amp;#039;&amp;#039;&amp;#039; Users /must/ have the [[ModifySelf]] right in order for the information to self-update from LDAP&lt;br /&gt;
&lt;br /&gt;
5. If you haven&amp;#039;t already done so, you will need to install the Perl Net::LDAP module from CPAN. ( perl -MCPAN -eshell ; install Net::LDAP ).&lt;br /&gt;
&lt;br /&gt;
5a. You will also need (debian package names in this case:) libio-socket-ssl-perl and libnet-ssleay-perl for SSL to work.&lt;br /&gt;
&lt;br /&gt;
6. Stop your RT instance (e.g., /sbin/service httpd stop ) and [[CleanMasonCache]] then start the web server back up.&lt;br /&gt;
&lt;br /&gt;
==== Upgrading From Older Implementations ====&lt;br /&gt;
&lt;br /&gt;
# Back up your existing User_Local.pm and CurrentUser_Local.pm (found in &amp;lt;code&amp;gt;${RTHOME}/local/lib/RT&amp;lt;/code&amp;gt;)&lt;br /&gt;
# Comment out or remove any LDAP-related functions in these files which are from previous implementations. If you&amp;#039;re sure that either of these files contains only such functions, remove the file. For example, the [[AutoCreateAndCanonicalizeUserInfo]] implementation added [[CreateFromExternalUserInfo]](), [[LoadByEmail]](), [[LoadByName]](), and Load() to CurrentUser_Local.pm; it also added [[CanonicalizeEmailAddress]](), [[CanonicalizeUserInfo]](), and [[LookupExternalUserInfo]]() to User_Local.pm&lt;br /&gt;
# Comment out or remove any previous LDAP config settings in [=${RTHOME}/etc/[[RT SiteConfig|RT_SiteConfig]].pm]&lt;br /&gt;
# Follow the instructions in the &amp;#039;&amp;#039;&amp;#039;New Installs&amp;#039;&amp;#039;&amp;#039; section above.&lt;br /&gt;
&lt;br /&gt;
=== Configuration ===&lt;br /&gt;
&lt;br /&gt;
These settings may now be found at [[LdapSiteConfigSettings]].&lt;br /&gt;
&lt;br /&gt;
=== RT::User Overlay ===&lt;br /&gt;
&lt;br /&gt;
This file may now be found at [[LdapUserLocalOverlay]].&lt;br /&gt;
&lt;br /&gt;
=== Troubleshooting ===&lt;br /&gt;
&lt;br /&gt;
*Note: There is considerable installation/debugging discussion at http://www.justatheory.com/computers/programming/perl/rt/ldap_auth.html as relates to getting the configuration right for another implementation of LDAP authentication (and which may still apply to your problem). You should review that if you&amp;#039;re having difficulty getting this to work.*&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: Does it automatically add new accounts?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: Yes./&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: Does it automatically refresh the information from LDAP?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: Yes./&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: Help! My information is not automatically being updated from LDAP. Why is this?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: All users must have the [[ModifySelf]] right in order for the LDAP information to refresh/&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: Why don&amp;#039;t you have a running RT instance or an LDAP server?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: I do, at my day job. However, the config there is a considerable distance from what I&amp;#039;d refer to as &amp;quot;real world,&amp;quot; so the code we use for all of this has additional complications. Consequently, much of this implementation has been adjusted as I put it in the wiki, which also explains the multiple disclaimers and my general nervousness about the codebase./&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: How can I autocreate accounts with certain attributes (e.g. Privileged, etc.)&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: Put this into your [[RT SiteConfig|RT_SiteConfig]].pm:/&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;### Autocreating users&lt;br /&gt;
 #&lt;br /&gt;
 # What default attributes should we pass to RT::User-&amp;amp;gt;Create?&lt;br /&gt;
 Set($AutoCreate, {Privileged =&amp;amp;gt; 1});&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: My LDAP query is failing and because I want all of the results, I haven&amp;#039;t specified an LDAP filter. Why won&amp;#039;t it work?&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: You HAVE to specify a filter in your [[SiteConfig]], or change the User_Local.pm code to fix the bug/&lt;br /&gt;
&lt;br /&gt;
There is a bug in User_Local.pm that means that if you don&amp;#039;t specify a search filter in the [[SiteConfig]], the filter string that gets created by User_Local.pm is (replacing sAMAccountName for whatever you have mapped to your RT username field):&lt;br /&gt;
&lt;br /&gt;
 (&amp;amp;amp;(sAMAccountName=username)())&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
The problem is, you cannot have empty parenthesis in an LDAP search, hence, I recommend adding this line:&lt;br /&gt;
&lt;br /&gt;
 if ($ldap_filter eq &amp;quot;()&amp;quot;) { undef($ldap_filter) };&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
anywhere between&lt;br /&gt;
&lt;br /&gt;
 my $ldap_filter     = $ldap_config{&amp;#039;AuthFilter&amp;#039;};&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
 my $filter_string = &amp;#039;(&amp;amp;amp;(&amp;#039; . $RT::LdapAttrMap-&amp;amp;gt;{&amp;#039;Name&amp;#039;} . &amp;#039;=&amp;#039; .&lt;br /&gt;
   $self-&amp;amp;gt;Name . &amp;#039;)&amp;#039; . $ldap_filter . &amp;#039;)&amp;#039;;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
This way, if you don&amp;#039;t define a search filter, you get:&lt;br /&gt;
&lt;br /&gt;
 (&amp;amp;amp;(sAMAccountName=username))&lt;br /&gt;
&lt;br /&gt;
instead of&lt;br /&gt;
&lt;br /&gt;
 (&amp;amp;amp;(sAMAccountName=username)())&lt;br /&gt;
&lt;br /&gt;
which fails.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;* Added by Mike Peachey on 03/01/07 pending response from JimMeyer&lt;br /&gt;
 * I am still waiting on a response from JimMeyer to have this bug fixed in the released code - 20/11/2007&lt;br /&gt;
 &lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q: Ldap +SSL does not work&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
/A: You can try &amp;quot;ldaps://ldap.yourserver.com&amp;quot; as a servername/&lt;br /&gt;
&lt;br /&gt;
=== To Do ===&lt;br /&gt;
&lt;br /&gt;
* [[LdapConfigInfo]]() should take an optional list of required config vars and fail if they&amp;#039;re not all defined&lt;br /&gt;
* Refactor code to eliminate goofy &amp;lt;code&amp;gt;$ldap_foo = $ldap_config{foo}&amp;lt;/code&amp;gt; statements.&lt;br /&gt;
* Make LDAP-sourced user information immutable in all RT interfaces (web and CLI)&lt;br /&gt;
* Look into using PAM for authentication?&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>