MindTouch Developer Center > Deki > FAQ > User Management > How do I...Enable single sign on with Active Directory?
Redirected from User:Crb/How do I...enable single sign on with Active Directory?

How do I...Enable single sign on with Active Directory?

This method uses Winbind, the Samba method for allowing NT groups to show up as if they were local.  It's very easy.

Note: this guide assumes your wiki is installed in /var/www/dekiwiki: it might be in /var/www/deki-hayes if you have upgraded an older VM.

Upgrade your wiki to 8.05.1 or greater

Start by ensuring you're at the latest code level (8.05.2 at time of writing).  Update your wiki with:

/usr/bin/updateWiki.sh

Install Winbind and the Apache module

Attached to this page is a version of the NTLM authentication module built for Debian Etch.  There are versions available for Ubuntu also.

# Install winbind and libapache2-mod-auth-ntlm-winbind 
apt-get install winbind
wget http://wiki.opengarden.org/@api/deki/files/2921/=libapache2-mod-auth-ntlm-winbind_0.1%252bgit20080610-0.1_i386.deb \
      -O libapache2-mod-auth-ntlm-winbind_0.1+git20080610-0.1_i386.deb
dpkg -i libapache2-mod-auth-ntlm-winbind_0.1+git20080610-0.1_i386.deb

# Enable the module
a2enmod auth_ntlm_winbind

# Allow Apache to connect to Winbind
usermod -a -G winbindd_priv www-data

Configuring Winbind

Change, uncomment or add the following six options in the [global] section of /etc/samba/smb.conf:

workgroup = SHORTDOMAINNAME 
security = domain
password server = *
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind use default domain = yes

Note: Samba does not need to be running for Winbind to work.  Replace SHORTDOMAINNAME with the domain name (as in DOMAIN\user), but the * gets entered as-is.

Now, you must join this machine to your domain, and restart Winbind: 

# you will be prompted for a password after this:
net join DOMAINNAME -U username

/etc/init.d/winbind restart
wbinfo -u

If you see a list of users (without a DOMAINNAME\ prefix), then congratulations, you have successfully configured Winbind.

Configuring the beta LDAP service

First, you need a copy of the new DLL:

cd /var/www/dekiwiki/bin/services 
wget http://wiki.opengarden.org/@api/deki/files/2344/=mindtouch.deki.ldap.dll -O mindtouch.deki.ldap.dll

# restart the service so the SID of the LDAP provider will be accepted
/etc/init.d/dekiwiki restart

Now, configure it in Deki.

Service management

Log into your wiki.  You first need to set up your LDAP service.  (under Control Panel, Service Management). You can edit an existing one if you have one, or create a new LDAP service. NOTE: If you've already had an LDAP service setup with users already existing, be sure to edit the service rather than creating a new one.

Save this service.  Note the number it is allocated, as you will use this below. (On a new VM, it will probably be '10').

If you were previously using Active Directory integration. please note in particular that bindingdn and bindingpw change from variables to a single hardcoded username and password, and that the SID changes too.

Configuration

Under Control Panel/Configuration, add two new values:

  • security/allow-trusted-auth: true
  • security/trusted-auth-provider-id: (the number of your LDAP service)

Log out of the wiki, and restart Dekihost again:

/etc/init.d/dekiwiki restart

(At this point it might be a good idea to log into your wiki and grant your LDAP user 'admin' rights, as it is difficult to log in as a local user once your browser is automatically authenticating you.)

Configuring Apache

In /var/www/dekiwiki, create a file named .htaccess. Add this content:

AuthName "NTLM Authentication"
NTLMAuth on
NTLMAuthHelper "/usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp"
NTLMBasicAuthoritative on
AuthType NTLM
require valid-user

You can set AuthName to anything you want.

This will force Apache to ask require NTLM credentials before serving any content, and also pass the username to Deki for single sign on.

Restart Apache:

/etc/init.d/apache2 force-reload

You are now good to go!

Hit http://mywiki/, and as long as your browser is set up for NTLM, you will automatically be logged in.

auto-logged-in.png

Feels good!

Configuring your web browser

If your URL is in the Local Intranet site in IE, then the browser will present your credentials automatically.  You can add the site manually if it doesn't automatically get detected.

Firefox users can set the property network.automatic-ntlm.trusted-uris in about.config.

Troubleshooting

Try browsing to http://mywiki/@api/deki/services/def...users/username (where 10 is the number of your LDAP service) to see if the LDAP service is returning correct results.

Tag page

Files 1

FileSizeDateAttached by 
 libapache2-mod-auth-ntlm-winbind_0.1+git20080610-0.1_i386.deb
Apache2 Winbind module for the Deki Wiki VM
9.37 kB15:40, 11 Jun 2008crbActions
Viewing 13 of 13 comments: view all
In our environment, there are some machines that are not joined as part of the domain; is it possible to mix both auto-signon and the deki signon page?

There is talk from other systems (moodle, etc) of creating a sub-page that automatically forces ntlm authentication, with some code on the main page that decides whether or not to go there. Is this type of thing feasible? Could we use the deki api to make a different ntlm service? (Brainstorming)
Posted 18:06, 26 Jun 2008
The Moodle idea is good and I will be investigating how to do that in future. It will require a new property somewhere in Deki to say which network range/s to present SSO to.
Posted 11:23, 13 Jul 2008
I tried to follow this, without luck. At this step:

net join DOMAINNAME -U username

what username should I be entering, my own? When I try my own, I enter my password, but then I get this error:

[(current date time)] utils/net_ads.c:ads_startup(289)
ads_connect: Invalid or incomplete multibyte or wide character
ADS join did not work, fallig back to RPC...
Unabled to find suitable server
Unabled to find suitable server

Any ideas? Thanks

Posted 15:39, 28 Jul 2008
I too encountered the error mentioned by msalamon but was able to get things working by ensuring my values were like this:

in smb.com set workgroup = domain_name WITHOUT the .com

Using this command to join the domain:
"net join domain_name.com -U admin_username"

I have a question, how is the service number determined? edited 20:41, 28 Jul 2008
Posted 20:23, 28 Jul 2008
At the point of net join DOMAINNAME -U username I get the error" cannot join as standalone machine".

I'm using a virtal machine and i'm using my DOMAINNAME.com. In the smb.conf, i used the DOMAINNAME without .com.
Posted 17:00, 4 Aug 2008
Hello, I was able to get the winbind to connect successfully to AD.. NTLM is authenticating correctly. I have two issues happening.

1. When the user connects to http://wiki the initial NTLM authentication gets passed from the browser. But it does not pass them to Deki.
I get the dreaded "We could not authenticate you."

2. When creating an AD user manually it wants me to enter ONLY the users correct AD Username/Password. If the user logs in manually the account is created automatically.

I checked the API log and it seems that the samAccountName is getting passed but the bindDN is not.. It is showing up as false..

Any suggestions?

-Mike
Posted 17:58, 5 Aug 2008
PPatel:

I erased the /etc/samba/smb.conf and replaced with this config and it allowed me to join the machine to Active directory

unix charset = LOCALE
workgroup = enterYourDomainNameHere
server string = enterServerDescriptionHereButNotRequired
security = DOMAIN
password server = enterTheIPofYourDomainControllerHere
username map = /etc/samba/smbusers
log level = 1
log file = /var/log/samba/%m.log
max log size = 50
server signing = auto
client use spnego = No
dns proxy = No
ldap ssl = no
idmap uid = 10000-20000
idmap gid = 10000-20000
template shell = /bin/bash
Posted 18:02, 5 Aug 2008
It should be noted that the location of the entries in the smb.conf file seems to be important. I originally had problems because I had had to add the "password server" and "winbind use default domain" entries and I chose to add them at the bottom of the existing file. When I moved them up directly underneath the existing entries for "idmap", everything came together. Appparently the entries must be in the "[global]" section of the file. edited 18:07, 20 Aug 2008
Posted 18:06, 20 Aug 2008
I'm curious whether anyone has this SSO working in a secure manner for external uses? We have a corporate wiki that is accessible on our internal network, using these SSO instructions. We want to make the wiki available to authenticated users on the internet, but provide SSL encryption for the login (or the whole wiki if necessary). A main component of this security is using our Apache Reverse Proxy server. Does anyone have something similar set up?
Posted 22:28, 28 Aug 2008
Just thought of something...SSO isn't necessary for our external users. Is it possible to force internal users to use the .htaccess file, and for everyone else, bypass it entirely, which will make use of our reverse proxy with SSL at login time. Basically a conditional .htaccess, where a deny would avoid using the .htaccess instead of blocking the connection.
Posted 14:57, 29 Aug 2008
Progress...adding the following directives to the .htaccess file allows for the reverse proxy to bypass the NTLM authentication:
allow from "ip address of revproxy"
satisfy any

Now my problem is figuring out how to serve 2 separate SSL certificates from one reverse proxy with 1 IP. Damn activesync not supporting wildcard certificates!
Posted 17:33, 29 Aug 2008
I couldn't get this to work in the VM edition using VMWare Server until I changed password server = * to password server = domaincontroller. It's probably a networking problem on this LAN, but even forwarding ports in the VMWare Virtual Network Settings (UDP:137,138/TCP:139) didn't help. Hope this helps someone save a few hours!
Posted 02:02, 23 Oct 2008
jadus: you can't serve two SSL certs with one IP. SSL doesn't support name-based virtual hosting.
Posted 22:17, 23 Oct 2008
Viewing 13 of 13 comments: view all
You must login to post a comment.
Powered by MindTouch Deki v.8.08.2