Recently I’ve been asked to deploy a portal infrastructure into one of the Polish corporations. The task was to bind together Liferay (portal with MySQL as internal database) with CAS (single sign-on authentication) and openLDAP (directory for holding user specific data like login, password, email etc.).
The general idea was that every user’s information should be held inside openLDAP. Liferay portal would delegate authentication to CAS web application where user’s login action would be authenticated against data from openLDAP. Because Liferay keeps its internal database, portal needs to periodically check openLDAP to see whether any data changed and update if needed.
Because the whole idea was kind of new for me, I had to do a small research before I got my hands dirty. On Internet I found many tutorials how to integrate Liferay with CAS, CAS with openLDAP and Liferay with openLDAP. Some of them worked, some not, some were simply obsolete. Moreover there was not one single tutorial to show how to bind all these technologies together. This post tries to fills this gap.
This post will be divided into four parts. Liferay version was 5.2.3 used with CAS 3.3. Installation and deployment was done on Linux Debian and on Ubuntu Linux (9.04).
1. Installing openLDAP
Warning: This will not run on Ubuntu 9.10! There were some changes done in Ubuntu that made installation of openLDAP really hard task. Ubuntu 9.04 is recommended.
To run installation you should simply run command below:
sudo apt-get install slapd ldap-utils
During installation you will be asked for administrator password. For purpose of this document this password will be ‘asdfgh’.
After installation ends, you should run configuration program:
sudo dpkg-reconfigure slapd
You will then need to answer few questions:
a) If you enable this option, no initial configuration or database will be created for you. Omit
OpenLDAP server configuration?
b) The DNS domain name is used to construct the base DN of the LDAP directory. For example,
‘foo.example.org’ will create the directory with ‘dc=foo, dc=example, dc=org’ as base DN.
You need to enter name base DN, which normally is just simply the DNS domain name.
For it.mycompany.com DN would be dc=it,dc=mycompany,dc=com
c) Please enter the name of the organization to use in the base DN of your LDAP directory.
Simply your organisation name. Can be anything.
d) The HDB backend is recommended. HDB and BDB use similar storage formats, but HDB adds
support for subtree enames. Both support the same configuration options.
In either case, you should review the resulting database configuration for your needs.
See/usr/share/doc/slapd/README.DB_CONFIG.gz for more details.
e) Do you want the database to be removed when slapd is purged?
f) Please enter the password for the admin entry in your LDAP directory.
Any, for this document it’s ‘asdfgh’
g) The obsolete LDAPv2 protocol is disabled by default in slapd. Programs and users should
upgrade to LDAPv3. If you have old programs which can’t use LDAPv3, you should select this
option and ‘olcAllows: bind_v2′ will be added to your cn=config directory.
Now to create simple structure that holds users and their groups, we run command:
ldapadd x D cn=admin,dc=it,dc=mycompany,dc=com W f ldap_data_set.ldif
where ldap_data_set.ldif looks like this:
——————- ldap_data_set.ldif ——————–
description: admins group
description: programisci hudsona
—————-end of ldap_data_set.ldif ——————
This will create structure described below:
| | admins
| | programmers
| | jdoe
| | kmoe
| | jhudson
Every user has password: ’123′.
And that’s simply it. We now have openLDAP installed with some user data in it.
[ldap1] – https://help.ubuntu.com/9.04/serverguide/C/openldap-server.html -> official Ubuntu tutorial
[ldap2] – https://help.ubuntu.com/community/OpenLDAPServer -> older version of [ldap1]
[ldap3] – http://docs.sun.com/source/816-6400-10/lmodify.html - SUN’s documentation - ldapmodify
[ldap4] – http://docs.sun.com/source/816-6400-10/lsearch.html – SUN’s documentation -
Installing Oracle XE on Ubuntu is quite easy and straightforward. Following steps show you how to install, configure and run Oracle XE database on Ubuntu Linux system.
1. Add new repository
1.1 Add this entry to your software sources: deb http://oss.oracle.com/debian unstable main non-free.
You can do it by simply clicking: System->Software Sources->Third-Party Software (as shown below) or add this entry into the /etc/apt/sources.list file. Choice is yours, same effect.
1.2 Add public key
Simply write into console wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add - . But of course you can do it navigating to System->Software Sources->Authentication
2. Run Oracle installation
sudo apt-get install oracle-xe
and after installation is finished, run configuration program:
sudo /etc/init.d/oracle-xe configure
where you anwer four simple questions:
- Oracle Application Express port (default 8080)
- Port for database connection (default 1521)
- Password for user SYSTEM – the administrator
- yes or no question whether you would like to run database with startup of your system
And that’s it! You have running Oracle instance. You can start playing with it by running SQL*Plus or web application at http://127.0.0.1:8080/apex.