Tuesday, April 21, 2015

OAuth2 Provider - ERROR: The authorization server can not authorize the resource owner

I helped to configure a basic OAuth2 Provider for a customer in their SSO infrastructure. In fact, I configured in 2 environment for the same customer. The first was configured months ago and worked like a charm. The second one was recently configured and we encountered errors during integration test with a OAuth2 Client.




During the integration testing, we were very sure the users key in the user name and password correctly. But right after successful user authentication, we always got the error - "ERROR: The authorization server can not authorize the resource owner".


Why? Pretty hard to guess. So I switched the OpenAM debug log level from ERROR to MESSAGE.


Wow! The logs were many and each was huge and hard to debug. So I changed strategy. Besides setting the debug level to MESSAGE, I also ensured that the Merge Debug Files was switched to On.





Much better this time as the log was sequential and was telling a good story of what exactly happened that led to the error.


In OpenAM debug log, the following was shown right above the error message:
Entitlement:04/21/2015 12:14:57:224 PM SGT: Thread[ajp-apr-2443-exec-3,5,main]
[PolicyEval] PolicyEvaluator.evaluate
Entitlement:04/21/2015 12:14:57:224 PM SGT: Thread[ajp-apr-2443-exec-3,5,main]
[PolicyEval] search result: privilege=OAuth2ProviderPolicy
Entitlement:04/21/2015 12:14:57:224 PM SGT: Thread[ajp-apr-2443-exec-3,5,main]
[PolicyEval] Privilege.doesSubjectMatch: falseEntitlement:04/21/2015 12:14:57:224 PM SGT: Thread[ajp-apr-2443-exec-3,5,main]
[PolicyEval] Advices: {}


The PolicyEval happened right before the error message - "ERROR: The authorization server can not authorize the resource owner" was thrown.



Somehow, the Subjects "OAuth2ProviderSubject" in OAuth2ProviderPolicy policy was missing. After adding it back, the error was gone.


.

Friday, March 27, 2015

OpenAM Web Policy Agent Version

I was upgrading a few OpenAM Web Policy Agent to version 3.3.4 for a customer yesterday and found something which I have been always wanted to comment about.




In OpenSSOAgentBootstrap.properties, you'll see the following:

#------------------------------------------------------------------------------
# Web Agents Bootstrap File
#
# OpenAM Policy Agent
#
# Version: 3.0

####################################################


The same goes to OpenSSOAgentConfiguration.properties.


#------------------------------------------------------------------------------
# Web Agents Configuration Property File
#
# OpenAM Policy Agent
#
# Version: 3.0

####################################################



I would very much prefer it indicates the exact version from operational point of view. (The ones who implement/deploy a system usually are not the ones maintaining it)


#------------------------------------------------------------------------------
# Web Agents Bootstrap File
#
# OpenAM Policy Agent
#
# Version: 3.3.4

#####################################################



Yes, I know the policy agent version will be displayed in the amAgent debug log. But over time, it gets rotated.


2015-03-26 21:29:37.108       -1 12788:773c80 all: =======================================
2015-03-26 21:29:37.108       -1 12788:773c80 all: Version: 3.3.4
2015-03-26 21:29:37.108       -1 12788:773c80 all: Revision: 12082
2015-03-26 21:29:37.108       -1 12788:773c80 all: Build Date: Jan 15 2015 17:13:06
2015-03-26 21:29:37.108       -1 12788:773c80 all: Build Machine: constable.internal.forgerock.com
2015-03-26 21:29:37.108       -1 12788:773c80 all: =======================================
2015-03-26 21:29:37.117       -1 12788:773c80 all: naming_validator(): validation disabled



By the way, there are 2 new features introduced in OpenAM Policy Agent 3.3.4.



There are also some important changes in version 3.3.4.





The following 3 properties are introduced in OpenSSOAgentBootstrap.properties.

# Agent initialization related properties
#
# - init.retry.max:   maximum number of consecutive agent initialization retries. Default (not set) value is 0.
# - init.retry.wait:  wait time (value in seconds) between retries. Default (not set) value is 0.
# - nss.shutdown:     enables (value: on) or disables (value: off) Mozilla NSS/NSPR framework shutdown in the agent module.
#                     Set this property to off in case the agent is used together with other Web Server modules using NSS/NSPR.
#                     Default (not set) value is on.
#
# Hot-Swap Enabled: No
#
com.forgerock.agents.init.retry.max =
com.forgerock.agents.init.retry.wait =
# com.forgerock.agents.nss.shutdown = on


.

Thursday, March 26, 2015

OpenAM Security Patch

I am preparing myself before heading to my customer's site to help them patch their OpenAM 10.0.2 servers.


The past patches used to be standalone. So if there are 2 security advisories that introduced 3 patches, then one had to perform patch 3 times.

Today, I am seeing an accumulated patch released by ForgeRock for OpenAM.



So besides #201503-01 and #201503-02, it contains previous patches that were introduced some months back.

Is this a good move? Pretty convenient I would say because this particular customer has not applied #201502-* yet.

So this saves my time.


.

Thursday, March 19, 2015

Configuration Data Store Indexes for External OpenDJ

In production, the Configuration Data Store is usually an external OpenDJ server. In fact, most usually a pair of OpenDJ servers.



There is a section in OpenAM documentation - Preparing an External Configuration Data Store, which is useful . Read here.

The most important item is to set indexes on OpenDJ during configuration. See below:


In a recent deployment, I have forgotten to set the above indexes and the machine where OpenDJ servers were running on always hit 90-100% CPU. Very top-ish through the day.

After the indexes were set, the OpenDJ servers went back to normal.  Proper indexing does help.


.

Thursday, March 5, 2015

ForgeRock has set up APJ HQ in Singapore

Finally, it's official. ForgeRock announced that it has set up its Asia-Pacific Japan (APJ) regional headquarters in Singapore. Full press release here.





In fact, we have been working closely with Sumal & team since December 2014. Customers in the Asia region, especially those in Singapore, have been asking for ForgeRock's presence years ago. This has finally become a reality.

In addition, support engineers will also be stationed in Singapore to better serve customers in this region.

This is a great start to the year!


By the way, Singapore Press Holdings is Azimuth's customer. :)

.

Tuesday, February 3, 2015

OpenAM Policy Configuration - HA Issue

When attempting to configure Policy Configuration (Access Control > Realm > Services > Policy Configuration) for High-Availability,  only "Primary LDAP Server" is available.

Strange isn't it?

Nevertheless, based on quick memory of how HA is configured for Data Store (Access Control > Realm > Data Stores > Datastore), I added the secondary LDAP server hostname and port number into the 2nd line of Primary LDAP Server.





Bomb! OpenAM debug log complained of "failed to get LDAP server name. If you enter more than one server name in the policy config service's Primary LDAP Server field, please make sure the ldap server name is preceded with the local server name".




So the configurations allowed are:
1. All OpenAM nodes hit the same OpenDJ server (no load-balance; no HA)
2. Each OpenAM node to hit a dedicated OpenDJ server (load-balanced, but still no HA)





Should we have a LB in front of a set of OpenDJ servers, with MMR configured, and all OpenAM nodes shall hit the LB? Maybe that's the only workaround as of now.



By the way, I share the same pain as this bugster - Consistency for LDAP configuration across OpenAM.


.


Thursday, January 29, 2015

OpenAM Log Directory - Different School of Thought

There is a thread in OpenAM mailing list that discusses on how to re-configure the default log directory to a different directory.





With no offense to anyone, I have never find the need to change from the default setting in OpenAM via the Administration Console.

In most production environment, there is usually a dedicated filesystem partition for logging purpose. Our practice has always been to create a symbolic link from the default log directory to the dedicated filesystem partition - be it on Unix or Windows.

Nothing too difficult and easy to achieve. Why spend so much time trying to re-configure?

Different school of thought, maybe.

.

Wednesday, January 28, 2015

OpenAM Logging

If you have been debugging OpenAM a lot by looking through the debug logs set in MESSAGE level, you'll get "lost" at times as the logs can get very verbose.




Just saw this commit in OpenAM repository... 





Hopefully this enhancement helps!


.

Tuesday, January 27, 2015

OpenAM CTS Configuration Parameters - Root Suffix

Be careful if you use an external OpenDJ as the OpenAM CTS store.

The documentation has the following suggested root suffix.


It seems to suggest that root suffix for my deployment should look like "ou=openam-cts,o=xx.xx.sg". (RED arrow). However, during testing, I found out that sessions are created right under "ou=openam-cts,o=xx.xx.sg, and not the desired "ou=famrecords,ou=openam-session,ou=tokens,dc=openam-cts,o=xx.xx.sg".




The actual format for root suffix should be "ou=famrecords,ou=openam-session,ou=tokens,[your organization]".



This will create the OpenAM sessions nicely under ou=famrecords.


.

Tuesday, January 13, 2015

Quick note on OpenAM CTS stores

The following is extracted from OpenAM documentation (nightly maybe), but important:






  • Prevent random or round-robin load balancing to external CTS stores. 
  • No load balancer is needed between OpenAM and an external CTS store. Instead configure multiple directory server replicas in the Connection Strings of the configuration. 
  • When OpenAM writes to a directory server in the external CTS store, directory server replication pushes the write to other directory servers in the same replication group. When under load operations in an OpenAM server can happen more quickly than the network can push replication updates. Therefore, balancing the LDAP traffic from OpenAM to the CTS store in random or round robin fashion leads to errors where a read operation arrives at a replica before the expected write operation can cross the network. 
  • For complex deployments you might opt for an external directory service as the CTS store with a load balancer between OpenAM and the directory service. In this case, the choice of load balancing algorithm is important to ensure consistency under load within the CTS layer. High loads with a round-robin or random algorithm cause replication conflicts within the CTS layer, which the CTS layer is unable to resolve. The load balancer must operate only for failover, and not to balance LDAP traffic between directory servers. In other words, the load balancer in front of the external CTS store must use an Active/Passive configuration, whereby the load balancer sends all requests to the same directory server until that server becomes unavailable, and then all requests go to the standby directory server, and so on. Load balancers must not use an Active/Active configuration, as this leads to the type of errors described above.


.

Friday, January 9, 2015

FATAL ERROR: Cannot obtain Application SSO token

It has been more than a month since I last posted. How time flies? :) Happy New Year!

So, I did 2 marathons last month - Singapore Marathon 2014 and Taipei Fubon Marathon 2014. I kept my pace slow as these were supposed to be my built-up runs for a 100km race in Hong Kong next week.




Back to OpenAM…. :)

One could hit into this error fairly common - "FATAL ERROR: Cannot obtain Application SSO token".

Just a moment ago while I was configuring SSO Admin Tool for a customer, I hit into the error. Prior to hitting the error, I added a site in OpenAM console and assigned the only OpenAM instance to this new site. I also made sure that site name was added as a -D parameter in ssoadm script.

$ vi ssoadm
    -D"com.iplanet.am.naming.map.site.to.server=https://dsauth.abc.com:443/am=https://f50d.abc.com:3131/am" \

However, when the following command was executed, the error appeared!

$ ./ssoadm list-servers -u amadmin -f .pwd.txt

Logging configuration class "com.sun.identity.log.s1is.LogConfigReader" failed
com.sun.identity.security.AMSecurityPropertiesException: AdminTokenAction:  FATAL ERROR: Cannot obtain Application SSO token.
Check AMConfig.properties for the following properties
        com.sun.identity.agents.app.username
        com.iplanet.am.service.password
Logging configuration class "com.sun.identity.log.s1is.LogConfigReader" failed
com.sun.identity.security.AMSecurityPropertiesException: AdminTokenAction:  FATAL ERROR: Cannot obtain Application SSO token.
Check AMConfig.properties for the following properties
        com.sun.identity.agents.app.username
        com.iplanet.am.service.password
com.sun.identity.security.AMSecurityPropertiesException: AdminTokenAction:  FATAL ERROR: Cannot obtain Application SSO token.
Check AMConfig.properties for the following properties
        com.sun.identity.agents.app.username
        com.iplanet.am.service.password


Very strange indeed. Ah, maybe a restart of OpenAM will help. And yes, indeed!


$ ./ssoadm list-servers -u amadmin -f .pwd.txt

https://f50d.abc.com:3131/am


.


Friday, December 5, 2014

OpenIDM 3.1 released

OpenIDM 3.1 was released on 3rd December 2014. The announcement can be found here.



This is an exciting release as the UI for managing connectors and objects has finally arrived! It doesn't matter a lot to hard-core engineers. But believe me, one of the customers' evaluation criteria is a easy-to-use Admin UI. In fact, it is an item that is high up in the evaluation list.




So, I just finished attending ForgeRock Partner Focus Session. Following is a quick highlight of OpenIDM 3.1.












Some marketing stuff below :)







Roadmap for OpenIDM 4.0 below:




Great stuff! Latest version of OpenIDM can be downloaded from here. 




Thursday, December 4, 2014

Google reCaptcha revamped!

We integrated SimpleCaptcha with OpenAM for one of our customers before. And the #1 complaint was always "How to make the distorted words or numbers more human-readable?"

Google's reCaptcha technology was also based on  distorted words or numbers. But they are now changing ... reCaptcha will be reduced to nothing more than a single checkbox next to the statement “I’m not a robot.” (Source here)


Instead of depending upon the traditional distorted word test, Google’s “reCaptcha” examines cues every user unwittingly provides: IP addresses and cookies provide evidence that the user is the same friendly human Google remembers from elsewhere on the Web. And Shet says even the tiny movements a user’s mouse makes as it hovers and approaches a checkbox can help reveal an automated bot.


This is a good move!

Monday, November 10, 2014

OpenAM . OpenUMA

In the recent IRM Summit held in Ireland, ForgeRock announced OpenUMA, an open source community initiative focused on addressing public concerns around privacy and consent in the digital age.





The initiative marries the increasingly popular technical standard, User-Managed Access (UMA), which provides a blueprint for addressing digital consent and privacy, with ForgeRock’s open source access management project, OpenAM. 

Believe it or not, weeks before the announcement of OpenUMA, I was in a customer's site based in Singapore and the IT Director was discussing with me the roadmap for OpenAM and the features he was looking for.  FYI, we have deployed OpenAM 10.0.1 for his company and are in the midst of upgrading to 10.0.2.

Most of his applications are .Net and his authentication source is Microsoft Active Directory. He is thinking of migrating to Office 365 in the near future. That makes OpenAM 12 a good candidate.


We were wondering what does "Cloud Connector Wizards - Office 365" mean? I presumed it meant OpenAM 12 can better integrate with Office 365. And that's why we were not hurry to upgrade to OpenAM 11.x. Instead, we chose to upgrade to the latest stable release of OpenAM 10.

We moved on and he told me his biggest nightmare now is every application is implementing their own authorization rules. He wanted to isolate authorization from every application and implement at a higher-level in OpenAM. OpenAM is where he saw will be the centralized Authentication & Authorization engine.

The authorization in discussion here is not coarse-grained authorization currently implemented in OpenAM policies & OpenAM Policy Agents. He is looking for an enterprise-wide access management for applications. I searched around and found Access Management 2.0 for the Enterprise to be the correct term.

There is a case study written by Eve Maler - Case Study: Access Management 2.0 for the Enterprise. By the way, I told him Eve Maler has already joined ForgeRock as vice president of innovation and emerging technology. And I even told him there should be something exciting brewing. :)

Coincidentally, weeks later, OpenUMA is announced.

The million dollar question is when will OpenUMA be fully integrated with OpenAM?


.






Saturday, November 8, 2014

OpenAM Security Advisory #201404

3 days ago, ForgeRock announced yet another security advisory #201404 - the 4th this year.

Good trend? Bad trend? To me, I read it as OpenAM deployment base has become larger and more people are using it for real deployments. With more eyes, more bugs will be found. That's a good thing for the community!




#201404 - Denial of Service vulnerability – CVE-2014-7246
In environments where more than one OpenAM server has been configured, it is possible that an authenticated attacker can construct and send a single request that triggers an infinite loop, occupying one or more instances in the deployment until the affected instances are restarted.

Another thing to note:



See that? The patch bundles are now distributed in .zip, instead of .jar. This better reflects what the patch bundles should be used for. To unzip, read the instruction(s) and to deploy the patches, which are usually in .classes. 

My positive feedback comes true! (See my previous blog) :) Well done! 


.

Wednesday, November 5, 2014

Insufficient Access Rights: You do not have sufficient privileges to perform an unindexed search

In my previous post, I mentioned that we are currently migrating OpenAM 9.5.3 to OpenAM 11.0.2 for a customer based in Singapore. At the same time, we are migrating a very old OpenDJ 2.4.3 to OpenDJ 2.6.1.




And of course, we do have customized schema in OpenDJ and customized codes in OpenAM. Which customer will not have customized requirement?

Anyway, when we run an unit test against the new setup, we encountered the error below:

11:24:50.514 [http-apr-7070-exec-1] DEBUG DEBUG - [LdapConnection - getAttributes] Getting attributes for filter (sgloginid=USERA)
11:24:50.532 [http-apr-7070-exec-1] ERROR DEBUG - Check devices command exception: Proxy User ID: USERA  User ID: USERA, Facebook ID: null, M2GW IP: x.x.x.x
org.forgerock.opendj.ldap.ErrorResultIOException: org.forgerock.opendj.ldap.AuthorizationException: Insufficient Access Rights: You do not have sufficient privileges to perform an unindexed search

        at org.forgerock.opendj.ldif.ConnectionEntryReader.hasNext(ConnectionEntryReader.java:235) ~[opendj-ldap-sdk-3.0.0-SNAPSHOT.jar:na]


One of my colleagues googled and directed us to OpenDJ Administration Guide Indexing Attribute Values - Determining What Needs Indexing.

A quick fix is to grant unindexed-search privilege to the account that binds to OpenDJ. But should we?

No, I do not think so.

The article says it all, in order of preference to resolve unindexed search issue:

1. If directory users tell you their client applications are getting this error, then you can work with them either to help them make their search filter specific enough to use existing indexes, or to index attributes they need indexed in order to perform their searches.

2. If you do need to allow some applications to perform unindexed searches, because they need to retrieve very large numbers of entries for example, then you can assign them the unindexed-search privilege.


In our case, we should index the attributes as sgloginid is used very frequently in OpenAM for authentication and in another customized application.

.

Tuesday, November 4, 2014

Unbreakable (backward-compatible) OpenAM Login Page

I am currently migrating OpenAM 9.5.3 to OpenAM 11.0.2 for a customer based in Singapore. In fact, I migrated Sun Access Manager 7.0 to OpenAM 9.5.3 few years back for the same customer. How time flies? Getting older. :)

The migration is pretty smooth so far … with a little surprise and confused me for a while.

We know the UI for OpenAM 11 looks like the one below:



But after I ported customized codes and JSP pages over, I was constantly redirected to the old OpenAM server! How can it be?!! The below was what I saw...


It took me (and my colleague too) quite a while to realize that we are in fact landing at OpenAM 11 Login Page.


See the differences below? ForgeRock logo and footer are different in OpenAM 11.



Ok lah, from backward-compatible point of view, well done man! Good job!


By the way, I ended last month with a 50-km trail race - The North Face Singapore.


Awesome run!

.