Thursday, May 09, 2013

Avaya One-X Communicator softphone LDAP directory


Avaya One-X communicator softphone LDAP directory

Where I work most users are installing to One-X Communicator softphone on their PCs and one complain they always have is the lack of a corporate directory.
Using the corporate Active Directory server is tempting but:
  1. A lot of politics
  2. Several teams (and external provider) needs to approve
  3. Security team will probably ask for a special setup
  4. Windows server team will not want to manage this
  5. I haven't found a user with the full correct details on the active directory.

Therefore I choose to use one of the small unused servers laying around and use it for Virtualbox/LDAP server. Also this will allow me to implement something new, learn from it and have better control. It will be more work at the end but I have a better view of which user has which extension than a chance to use/update the company Active Directory.

Note I will be using VirtualBox for this "project". One reason is the server I have is not the latest and it doesn't allow me to use any other virtualization technology (at least that I could find), also it will allow me to later add other servers to the same box without messing with the LDAP server. I will normally create the new setup on a VirtualBox server running on my laptop and then move the image to the "live" server once is ready for production. Finally VirtualBox will allow me to have full backups ready to run in case the hardware goes down.

Installation steps:

Step 1) Install Debian on server

I will be using Debian as base for the server. Simple, stable and I more familiar with it. I can of cheat on this step as I do my basic install connected not to the corporate network but to a broadband account. Once the installation is done, I either assign a static IP or use the corporate DHCP.

I downloaded the latest netinstall version from the Debian Website - at the time of this was debian-7.0.0-i386-netinst.iso - and run a basic install with desktop

Installation is quite simple and there are several guides on the network on how to do it. A few screenshots of the installation are shown below:

First screen, go with the install!



Select the graphical package for the server as it will be needed to run VirtualBox..



Once the installation is done, as root don't forget to run the normal updates:

apt-get update
apt-get upgrade

The system details are show below:
user@myserver:~$ uname -a
Linux myserver 2.6.32-5-686 #1 SMP Mon Feb 25 01:04:36 UTC 2013 i686 GNU/Linux
user@myserver:~$

Step 2) Install VirtualBox

Next go to the Virtualbox site - https://www.virtualbox.org/ - and download the latest version for Debian. In my case it was: virtualbox-4.2_4.2.12-84980~Debian~squeeze_i386.deb

Now, I am writing this after I have this working and I am checking my history to remember each step and on the history I found all the below steps. I don't recall the reason or problems I did most of them had but adding them here. Basically after step (1), I installed a bunch of application to have them available in case needed in the future.

apt-get update
apt-get upgrade
apt-get install dkms
apt-get install firmware-linux-nonfree
apt-get install linux-headers-$(uname -r)
apt-get install gcc
apt-get install build-essential module-assistant
apt-get install minicom
apt-get install ncurses-dev fakeroot bzip2
apt-get install build-essential checkinstall cdbs devscripts dh-make fakeroot libxml-parser-perl check avahi-daemon
apt-get install gparted
apt-get install p7zip-full p7zip-rar
apt-get install gnome-desktop-environment
apt-get install remmina
apt-get install remmina-plugin-vnc
apt-get install tightvncserver
apt-get install openssh
apt-get update
apt-get upgrade

Once all is installed/updated, go to the command line again as root and install the VirtualBox downloaded package as follows:

dpkg -i virtualbox-4.2_4.2.12-84980~Debian~squeeze_i386.deb

The installation should work and you should be able to launch VirtualBox from your Menu panel.


(note the image was captured after the full setup, therefore the ldap server appears)




Step 3) Install VirtualBox Guest - Debian

Now we install a new guest Debian on VirtualBox. To install the guest just create a new server in Virtualbox and follow the wizard. Once the wizard ends, add the debian-7.0.0-i386-netinst.iso as the CD-Rom for the image and start the machine.




The installation process is the same as with the host server. The only difference is that I don't install a desktop environment as it s not needed and will make the images smaller.

Once the guest install is done, log in and remove the virtualbox-ose packages that comes with Debian. This will cause errors when installing the VirtualBox Linux Additions to the gust image. The steps I did were:

apt-get update
apt-get upgrade
dpkg -l | grep virtualbox-ose-guest
apt-get remove --purge virtualbox-ose-guest-x11
apt-get autoremove
dpkg -l | grep virtualbox-ose-guest
apt-get remove --purge virtualbox-ose-guest-utils
apt-get remove --purge virtualbox-ose-guest-dkms

With the OSE packages gone, now load the VBoxGuestAdditions.iso into the guest OS. The path to the file in Debian is /usr/share/virtualbox/VBoxGuestAdditions.iso. The below image shows this selection:



Final steps are to install a few applications to the guest needed and to mount the VboxGuestAddtions and run the installation script.

apt-get update
apt-get upgrade
apt-get install build-essential module-assistant
m-a prepare
mount /media/cdrom
sh /media/cdrom/VBoxLinuxAdditions.run
umount /media/cdrom

To end this, Debian by default saves the "virtual" MAC address of your server that will cause an error if you ever try to clone the image and start a new/parallel version. As the cloned version has a new MAC address but the server files still point to the old MAC address, the network services will not start. To work around this, edit the following files:

cd /lib/udev/rules.d/
vi 75-persistent-net-generator.rules

Add the following lines:

# ignore Virtualbox virtual interfaces
ATTR{address}=="08:00:27:*", GOTO="persistent_net_generator_end"

Then

cd /etc/udev/rules.d/
vi 70-persistent-net.rules

Delete entries if any


Well that is all, you should have a HOST server and a Guest server running at this point. In theory :)


Step 4) Install LDAP and phpldapadmin

The installation of these two packages is straight forward with the following commands:

apt-get install slapd ldap-utils
apt-get install phpldapadmin


The installation will ask you for user and password details (take note of them!). That is all..

Step 5) Configure LDAP

Add the below lines to the ldap.conf file:

vi /etc/ldap/ldap.conf

ldap_version 3
URI ldap://localhost:389
SIZELIMIT 0
TIMELIMIT 0
DEREF never
BASE dc=corp, dc=mycompany, dc=com

Replace the example configuration

vi /etc/phpldapadmin/config.php

Changed:
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
  auto-detect it for you. */
$servers->setValue('server','base',array('dc=example,dc=com'));

to :
/* Array of base DNs of your LDAP server. Leave this blank to have phpLDAPadmin
  auto-detect it for you. */
$servers->setValue('server','base',array('dc=corp,dc=mycompany,dc=com'));

Changed:
$servers->setValue('login','bind_id','cn=admin,dc=example,dc=com');
to :
$servers->setValue('login','bind_id','cn=admin,dc=corp,dc=mycompany,dc=com');

At the stage, you will be able to http to the phpldapadmin server http://guest machine IP/phpldapadim and log in with the password entered during the ldap installation step.








Step 6) Add entries to LDAP

Once logged into phpLDAPAdmin, add some example data to it. In the below example I added cn=users, then a ou= sales with 3 users.

I assigned an extension and mobile phone to each of them.





Step 7) Change settings on Avaya One-X communicator and test

On your One-X settings go to the public directory options and enter the IP address of the ldap server and on the search root field the details just created through phpldapadmin. In this example was cn=users, dc=corp, dc=mycompany, dc=com


On the Preferences settings, click "Public Directory" so when the user types a name it will look on the LDAP server.


Finally, go to the One-X sofphone and enter one of the names you created. They will be appear and by clicking on the "handset" icon you can select which number to dial.



Well, hope it works for you and have fun adding names into the LDAP server. The import utility on phpLDAPAdmin is very helpful doing this.