Thursday, 21 February 2013

Setting up multi-tenancy environment in IBM Cognos 10.2 BI using LDAP


Multi-Tenancy has always been supported in IBM Cognos BI either by authentication source or with distributed installation & configuration. Cognos 10.2 BI has greatly enhanced it by newly provided built-in multi-tenancy capability which is incredibly valuable to IBM Cognos ISVs and business partners. It is particularly very useful to the organizations those have deployed Cognos BI in a federated manner and are looking to segment different sub-organizations within their shared IBM Cognos platform architecture more easily.

Multitenancy provides the capability to support multiple customers or organizations (tenants) by using a single deployment of an application, while ensuring that the users belonging to each tenant can access only the data that they are authorized to use. Such applications are called multi-tenant applications. IBM Cognos Business Intelligence (BI) provides capabilities that make it easier to administer and secure multi-tenant applications at the same time minimize the extra costs associated with these environments.

The following diagram shows how the Cognos BI multitenancy capabilities isolate access to objects in your content store. Users can access only the objects that they are authorized to access within each tenant grouping.















Figure. Content store configured to use the Cognos BI multitenancy capabilities

The system administrator can access all objects in the content store. In this example, the users would have access to the following objects:
  • Users belonging to Tenant 1 can access object_1, object_2 exclusively.
  • Users belonging to Tenant 2 can exclusively access object_4, object_5, and object_6.
  • object_3 is shared between users from both tenants but based on tenant properties they can access permitted data thru object_3.
This newly introduced multi-tenancy feature does not require performing additional administration tasks to manage tenants because it reuses your existing authentication infrastructure. When multi-tenancy is enabled, it does not affect how you currently manage your users and groups. It allows the administrator to create a TenantID and use the TenantID session parameter in Cognos modeling tool (Framework Manager) to restrict the access to the different components on Cognos Connection, using security features in the Cognos Namespace.  It also provides the ability to audit by Tenant and makes it much easier to administer and maintain the environment.

This article describes the step by step procedure to
1)     Configuring multi-tenancy feature in IBM Cognos 10.2 BI environment.
2)     Implementing multi-tenancy for sample tenants (exclusive & shared access)

Configuring Multi-tenancy in Cognos BI

1) First of all, identify how tenancy information (grouping) is determined in technical environment for the individual users. Then, the tenancy information can be associated to specific multi-tenancy properties. You can use any LDAP authentication provider here but for illustration we are using ApacheDS to determine tenancy information. 

If you are new to LDAP and need help in creating Apache Directory Server (ApacheDS) based LDAP environment to secure IBM Cognos 10.2 BI please refer my blog –
Using ApacheDS based LDAP to secure IBM Cognos 10.2 BI environment
It would take you thru steps of installation, configuration of ApacheDS along with Cognos LDAP integration. It’ll also help you manage ApacheDS environment using Apache Directory Studio.



Users
Attribute value for ‘l’
admin (domain administrator)
0
user1
1
user2
2
user3
3
user4
4


2) It is assumed that Cognos 10.2 BI server is already installed & configured and LDAP integration is completed. LDAP setting can be verified with ‘IBM Cognos Configuration’ (Start -> All Programs -> IBM Cognos 10 (‘IBM Cognos 10 – 64’ in case of 64-bit installation) in the Explorer window, under Security-> Authentication. For example, ‘ADS’ namespace shown with its properties.



3) Select ‘Advanced Properties’ from right window (Resource properties) and add two new values -

a)     Name – ‘multitenancy.TenantPattern’ value – ‘~/parameters/tenantID’
b)     Name – ‘AdditionalUserPropertiesToQuery’ value – ‘parameters’


4) Now, select ‘Custom Properties’ from right window (Resource properties) and add a new value –
Name – ‘tenantID’ value – ‘l’


5) From the File menu, click Save. Test connectivity to the namespace by right clicking on the name under Security, Authentication and selecting test. If the test is successful, this message box will appear.


Save the new configuration and restart Cognos service from toolbar.  
 

Implementing Multi-tenancy for sample tenants (exclusive access)

After multi-tenancy is enabled, the system administrator assigns tenant IDs to the existing content store objects. All objects belonging to a tenant have the same tenant ID. The tenant IDs are created when a user from a specific tenant logs on to IBM Cognos Business Intelligence, or the system administrator impersonates the tenant. Tenant IDs can also be created using the software development kit.
In our case we have 5 tenants with Tenant IDs assigned as shown in below chart -

Tenants
Tenant ID assigned
admin (domain administrator)
0
user1
1
user2
2
user3
3
user4
4

1) Now we’ll make ‘admin’ as a system administrator so login as ‘admin’ and launch IBM Cognos Administration.


Click on ‘Users, Groups, and Roles’ under ‘Security’ tab and select Cognos Namespace.


Scroll to bottom and select ‘set properties’ for the ‘System Administrators’ Group





From the ‘Members’ tab, we need to add some valid administrators (‘admin’ in our case) by selecting ‘Add’. Check ‘Select Users in the List’



Now we can remove the ‘Everyone’ group from the ‘System Administrators’ by selecting the checkbox next to everyone and selecting ‘Remove’. Select OK.

2) In a multitenant environment, all objects in the content store are either public or belong to a single tenant. As a system administrator, you must ensure that the existing objects have a proper tenant ID or are meant to remain public. For example, you can assign tenant IDs to data source connections, but leave the data source itself public.

If the tenant content is not organized into separate folders, you can create a root folder in Cognos Connection for each tenant exclusively. Having separate folders for each tenant helps to preserve the uniqueness of names in the Cognos BI environment.

Every object (folder, package, report, connection etc) in the content store has a tenant ID value that indicates which tenant the object belongs to. This value is based on the tenant ID associated with the session of the user who created the object. Here we’ll provide exclusive access of folders to respective tenants.

As shown below, 5 folders are created having same name as users. Click on ‘Set properties’ icon.


On the General tab, click Set next to the Tenant ID. Choose a tenant ID from the list of available IDs, and click OK. Choose ‘1’ for user1. Similarly set respective tenant ID on folder for all tenants (users). The LDAP administrator can add the ‘l’ attribute to those users who do not have this property set now, without having to reconfigure IBM Cognos BI v10.2.


3) Now for testing purpose, logoff as ‘admin’ and login as ‘user1’. Notice that user1 can only see folder ‘user1’.


If you try to set properties for ‘user1’ folder, notice that ‘TenantID’ property does not exist because user1 is not system administrator.



Implementing Multi-tenancy for sample tenants (shared access)

Now, we’ll see how to provide the shared access to an object which behaves differently for different tenant based on their tenant ID value. There are two ways.
  • No tenant ID assigned to publicly available objects hence they are available to all tenants without any change in behavior.
  • Using the TenantID session parameter in Cognos modeling tool (Framework Manager) to restrict the access at runtime. Multitenancy would be implemented to all the objects (reports, queries, analysis etc.) that are based on such metadata model/packages. Even if you don’t set tenantID property for these objects from Cognos Connection, objects would be available to all tenants but behave differently for different tenants.

Here we’ll quickly filter the metadata model using tenant ID session parameter and export the package to create a demo report to be used by all tenants.

1) Open ‘IBM Cognos Framework Manager’ (Start -> All Programs -> IBM Cognos 10). If it is not available then first install, configure and make sure its working. 

Here’s we are using two tables ‘ORDER_HEADER’ and ‘ORDER_DETAILS’ from ‘GOSALES’ schema of ‘great_outdoors_sales’ datasource connection (GS_DB). Tenant_ID is added in ORDER_HEADER, as you can see in below snapshot. We created a copy of ORDER_HEADER in GS_DB database and renamed its ORDER_METHOD_CODE column with TENANT_ID.


2) Test the results for TENANT_ID, RETAILER_NAME, QUANTITY and UNIT_SALE_PRICE with Auto Sum box checked. Notice that all the values for TENANT_ID would be from 1 to 7. Click on ‘Close’ button.


3) Double click on ‘ORDER_HEADER’ query subject and add a filter in ‘filters’ tab with “[great_outdoors_sales].[ORDER_HEADER].[TENANT_ID] = #sq($tenantID)#” expression.


Save project and publish the package (‘multitenancy_pack’ in our case).

4) Launch Report Studio from Cognos Connection using ‘multitenancy_pack’ package. Create a report to demonstrate multitenancy feature, as shown in below snapshot.

In a 1x2 table, two objects are placed – one bar chart and one list using RETAILER_NAME, QUANTITY and UNIT_SALE_PRICE query items. REVENUE is the calculated field –

REVENUE = QUANTITY * UNIT_SALE_PRICE

TENANT_ID is placed in title as a ‘Singleton’ object with ‘Aggregate function’ property set to ‘none’.

Save the report as ‘Demo Report’ and close Report Studio.


5) Logoff and login as ‘user3’ and run the ‘demo report’ created in above step. Notice that data values are filtered for respective tenant ID value which is ‘3’ for user3. Report title shows the tenant ID as area code.

Now logoff again and login as ‘user4’ to run the same report. You can notice the change in data values for user4. Similarly many such reports can be created using package multitenancy_pack. 







Besides the capabilities shown above, you can export and import the tenant content using the Cognos deployment capabilities. The deployment archive includes all tenant content and all public content associated with the tenant.
After multi-tenancy is enabled, you can also record tenant activities using an audit logging database. Cognos provides sample audit reports that show how to use the tenancy information to monitor certain user activities. For more information about how to use Cognos configuration to set up a logging database, see the IBM Cognos Business Intelligence Installation Guide and Configuration Guide.

Wednesday, 20 February 2013

Using Apache Directory Server (ApacheDS) based LDAP to secure IBM Cognos 10.2 BI environment



IBM Cognos 10.2 Business Intelligence (BI) is a enterprise class, web-based, integrated business intelligence suite by IBM which provides toolset not only traditional BI capabilities like reporting, analysis, scorecarding, monitoring of events and metrics but also expands these capabilities with planning, scenario modeling, real-time monitoring, and predictive analytics. These capabilities deliver an easy-to-use and unified experience that is collaboration and social networking enabled. The IBM Cognos BI has Service-oriented architecture - designed for scalability, availability, and openness. 

The Apache Directory Project (http://directory.apache.org/ ) is an open source project of the Apache Software Foundation, provides directory solutions entirely written in Java. These include a directory server, which has been certified as LDAP v3 compliant by the Open Group (ApacheDS), and Eclipse-based directory tools (Apache Directory Studio). In below sections, we’ll use both in our integration steps. 

ApacheDS is an extensible and embeddable directory server entirely written in Java, which has been certified LDAPv3 compatible by the Open Group. Besides LDAP (Lightweight Directory Access Protocol) it supports Kerberos 5 and the Change Password Protocol. It has been designed to introduce triggers, stored procedures, queues and views to the world of LDAP which has lacked these rich constructs.

Apache Directory Studio is an Eclipse RCP application and a complete directory tooling platform intended to be used with any LDAP server however it is particularly designed for use with the ApacheDS.

This blog article describes the step by step procedure for –
1)     Setting up ApacheDS environment
2)     Integrating IBM Cognos 10.2  Business Intelligence Server with ApacheDS 2.0.0-M10.

Using ApacheDS (LDAP repository) with IBM Cognos 10.2 BI one can leverage existing security features for authentication and data transfer.  

Setting up ApacheDS & Apache Directory Studio Environment

1) ApacheDS is a multi-platform application and runs on Mac OS X, Linux and Windows. Open http://directory.apache.org/apacheds/downloads.html in browser and download installer (~10MB) for your platform. Also download users guide from ‘Documentation’ section shown below in screenshot.


2) Installation process should be started by double clicking on downloaded .exe file (in case of Windows. Installation steps are easy to follow. Attention needed on below shown screen that asks to locate the java run time (JRE 1.6). Users who don’t have JRE installed should abandon the install (click Cancel). Install the JRE and re-run the ApacheDS install. In case JRE is already installed, assign the path and complete the installation.


3) On the completion of installation, you can see ‘ApacheDS – default’ as a new windows service (Start->Programs->Administrative Tools->Services). The default port used by ApacheDS for ldap service is 10389.


4) Installer (~140 MB) for Apache Directory Studio can be downloaded from http://directory.apache.org/studio/downloads.html. Also download user guide from ‘Documentation’ section shown below in screenshot. Installation steps are similar to ApacheDS.


5) Once installed you can find folders & icons in ‘Start -> Program Files’ as shown below. Click on ‘Apache Directory Studio’ link in ‘Apache Directory Studio’ folder. First time it should show you Welcome screen. You may close it.


 










6) Create Connection with LDAP server –

The bottom left corner shows all of the LDAP connections. As can be seen, the view is empty, meaning a connection still needs to be specified. To create a new connection, click the New Connection button.


In the wizard's first page enter a connection name as well as the hostname and the port of the LDAP server. To check the connection parameter you entered you may click to Check Network Parameter. Click Next when done.
Here is a list of common directory servers and the ports they use by default: 
Directory Server
Default Port
Apache Directory Server
10389
OpenDS
1389
OpenLDAP, Fedora, Sun, Active Directory
389




In the wizard's second page select the authentication method. If you choose the simple bind method also enter your bind DN or user and bind password. To check the authentication parameter you entered you may click to Check Authentication. Click Finish when done.

Here is a list of common directory servers and the administrator's bind DN and password they use by default:
 

Directory Server
Default Bind DN
Default Bind Password
Apache Directory Server
uid=admin,ou=system
secret
OpenDS, Sun, Fedora
cn=Directory Manager
specified at setup
OpenLDAP
specified at setup, see slapd.conf
specified at setup, see slapd.conf


Observe that the Connections view now shows the created connection. You can view and change its configuration by right clicking and selecting ‘Open Configuration’.

6) Browse the directory –

The LDAP Browser view is on the top left. The category DIT shows the hierarchical content of the directory. You may expand and collapse the tree. When selecting an entry its attributes and values will be displayed in an Entry editor.

In the DIT category the directory information tree of the LDAP directory is displayed in its natural hierarchical structure. The first hierachy level contains the base entries, the Root DSE and the schema entry. When expanding an entry its direct children are fetched from directory. To expand and collapse an entry you could also double-click.
The following icons are used to distinguish entry types:

Icon
Description
Entry with object class person, inetOrgPerson, posixAccount, user
Entry with object class groupOfNames, groupOfUniqueNames, posixGroup, group
Entry with object class organization, organizationalUnit, container
Entry with object class domain, domainComponent, country, locality
Entry with object class alias
Entry with object class referral
The schema entry.
The root DSE entry.
All other entries

Below screenshot showing the attributes for User admin (uid=admin). To add more attributes as per your needs, click on ‘New Attribute…’ icon (pointed with arrow below).


7) Create a sample hierarchy structure in “dc=eaxmple,dc=com” domain –
By default, there’s no entry under dc=eaxmple,dc=com
Right click on  dc=eaxmple,dc=com and select New > New Entry... that Opens the ‘New Entry wizard’. This wizard helps you to create a new entry. The creation of a new LDAP entry is a four-step process:

  1. Select entry creation method.
  2. Specify object classes of the new entry.
  3. Specifiy the distinguished name of the new entry.
  4. Enter attributes and values of the new entry.

Final structure should look as shown in screenshot below. Also note that many attributes are added for every user. Please refer to user guide in case more information required.




Integrating IBM Cognos 10.2  BI Server with ApacheDS

1. It is assumed that Cognos 10.2 BI server is already installed and is in working condition. Open ‘IBM Cognos Configuration’ from Start -> All Programs -> IBM Cognos 10 – 64.

In the Explorer window, under Security, right-click Authentication, and then click New resource -> Namespace.





In the Name box, type a name for your authentication namespace (we used ‘ADS’ here) and in the Type list, select ‘LDAP – General default values’ and click OK.

Select the newly created namespace. In the ‘Resource Properties’ window in right, for the Namespace ID property, specify a unique identifier for the namespace as LDAP_ADS is assigned in the below screenshot. All entries with Red arrows are manually provided to integrate with the ApacheDS environment we created in above section.


If you want the ApacheDS to bind to the directory server using a specific Bind user DN (Distinguished Name) and password when performing searches, then specify these values. 
If no values are specified, the LDAP authentication provider binds as anonymous.
If external identity mapping is enabled, Bind user DN and password are used for all LDAP access. If external identity mapping is not enabled, Bind user DN and password are used only when a search filter is specified for the User lookup property.
You can use user attributes from ApacheDS in namespace configuration. To configure this, you must map these attributes with appropriate property name as shown in below snapshot.
‘Custom properties’ would be available as session parameters through Framework Manager.



From the File menu, click Save. Test connectivity to the namespace by right clicking on the name under Security, Authentication and selecting test. If the test is successful, this message box will appear.


If you want to disable anonymous access, make sure you disable it by setting ‘Allow anonymous access?’ property for ‘Cognos’ namespace as shown below in snapshot.



Restart Cognos service from toolbar.  
Now anyone who wants to access Cognos (http://localhost/ibmcognos), would be asked for authentication credential. Let us login with LDAP administrator credential.
                                                                                                                

Directory administrator would have Cognos admin privileges. Go to Cognos administration.



In ‘IBM Cognos Administration’, explore ‘Users, Groups, and Roles’ under ‘Security’ tab. One can see the new namespace (ADS). Click on it to view all users belongs to the directory.


Administrator now can assign different privileges and roles to these directory users as per application security requirements by setting relevant properties. Once security permissions are assigned, LDAP users are ready to use Cognos BI. For more information on security, please refer to “IBM Cognos BI Administration and Security Guide”.