You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Richard Mixon <rn...@custco.biz> on 2014/01/11 17:41:11 UTC

Implementing strong password hashing with Shiro and Openldap

I was pointed at this article and asked if we could implement SSHA256
password hashing instead of SSHA and also do a large number of iterations
http://www.stormpath.com/blog/strong-password-hashing-apache-shiro
So I started exploring the issues involved with implementing this approach.

First, we are using openldap for our directory and it does not appear to
support SSHA256 without adding a contributed overlay module described here
http://www.openldap.org/faq/data/cache/1467.html
So far I've been unsuccessful in getting this compile, but figure it will
eventually succeed.

Even getting that to work it does look like I will be able to use
openldap's builtin "bind" function. With the right module (as above)
openldap can be configured to use the SSHA256 algorithm, but I do NOT find
anyway to specify more than a single hashing iteration. Maybe I'm missing
something here.

So I'm going to have to use ldap search for authentication rather then
bind. OK.

I am writing my own Shiro realm so I can handle the authentication using
ldap search with no problem. Also I can see that by implementing my own
CredentialsMatcher I can handle the SSHA256 and multiple iteration
requirement. So far, so good.

We also have a PHP Wordpress application. I have a relatively simple LDAP
authentication plugin that will now need to be re-written to handle
password hashing/iteration since ldap bind cannot be used directly.

Does what I've laid out so far sound reasonable?

Or am I going about this the wrong way? Is there is another way to achieve
the objective? We are a small software shop and this is our initial foray
into LDAP and SSO for a outward facing portal. We chose openldap because it
seemed ubiquitous and supported on our CENTOS Linux platform.

Thank you - Richard

-- 
Richard Mixon
Custom Computer Creations, L.L.C.
mobile: (480) 577-6834 office: (480) 614-3442
email: rnmixon@CustCo.biz <ma...@CustCo.biz>
Microsoft Partner ID: 1263725
The messages and documents transmitted with this notice contain
confidential information belonging to the sender. If you are not the
intended recipient of this information, you are hereby notified that any
disclosure, copying, distribution or use of the information is strictly
prohibited. If you have received this transmission in error, please notify
the sender immediately.

Re: Implementing strong password hashing with Shiro and Openldap

Posted by Les Hazlewood <lh...@apache.org>.
Nope, nothing to add.  Nice summary Luke :)
--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282


On Thu, Jan 16, 2014 at 5:31 AM, Luke Biddell <lu...@gmail.com> wrote:
> If you're doing the hashing yourself and storing them somewhere, consider
> using something other than SHA*.
>
> Take a look at these articles.
>
> http://codahale.com/how-to-safely-store-a-password/
> http://www.unlimitednovelty.com/2012/03/dont-use-bcrypt.html
>
> My understanding is that SHA* are designed for speed which ultimately aids
> brute force attacks.
>
> Something like Bcrypt or even better PBKDF2 mitigates this.
>
> I'm not an expert though, Les will probably have a better view.
>
>
>
> On 14 January 2014 02:32, Les Hazlewood <lh...@apache.org> wrote:
>>
>> Hi Richard, yes, if you can't configure the LDAP server to be aware of
>> iterations/complexity, then I think doing the matching at the Realm level
>> (with a PasswordMatcher) would be good.
>>
>> HTH!
>>
>> --
>> Les Hazlewood | @lhazlewood
>> CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282
>>
>>
>> On Mon, Jan 13, 2014 at 5:11 PM, Richard Mixon <rn...@custco.biz> wrote:
>>>
>>> Les, I've actually got the Shiro real working - with either SSHA or
>>> SSHA256. But not looks like either of the ldap server's built-in bind
>>> functions do not allow you to specify how many hash iterations to compute,
>>> only the algorithm to use. So I guess that means I just do an LDAP search
>>> instead of a bind and do the matching in my realm logic.
>>>
>>> Or am I missing something?
>>>
>>> Thanks!
>>>
>>> Sent from my iPhone
>>>
>>> On Jan 13, 2014, at 16:20, Les Hazlewood <lh...@apache.org> wrote:
>>>
>>> Hi Richard,
>>>
>>> If I understand correctly, your challenge is that you want to configure
>>> the LDAP server of choice to compute SSHA256?  And then to have Shiro read
>>> in that record, look at the hashed value and then do the comparison?
>>>
>>> Best,
>>>
>>> Les
>>>
>>> On Mon, Jan 13, 2014 at 8:54 AM, rnmixon <rn...@custco.biz> wrote:
>>>>
>>>> A bit more info ...
>>>>
>>>> We are putting together a small outward facing portal - implementing an
>>>> LDAP
>>>> directory is part of that effort (we use Microsoft AD for internal
>>>> users).
>>>>
>>>> At this point we've written the PHP plugin for our Wordpress site to
>>>> authenticate external partners via the LDAP directory and internal
>>>> users/employees using our Microsoft Active Directory. I'm doing the same
>>>> for
>>>> the two Java applications that need to be integrated.
>>>>
>>>> Currently, I'm trying to meet a new requirement I received last week to
>>>> use
>>>> SSHA256 instead of SSHA and to use a high number of hashing iterations
>>>> as
>>>> Les' article suggested.
>>>>
>>>> In theory Openldap can do this using the sha2 plugin, but it's been slow
>>>> getting it to work - after quite a few years it has not been included in
>>>> the
>>>> base product's plugin set - and there appear to be some philosophical
>>>> wars
>>>> as to whether more advanced hashes can or should be included in the core
>>>> product plugins.
>>>>
>>>> So at this point I've allocated a day (today) to look at the Fedora 389
>>>> Directory Server and see if it offers a smoother path. So far that seems
>>>> to
>>>> be the case, but I'm not all the way there yet.
>>>>
>>>> Any thoughts or suggestions on a better path? This is a first step for
>>>> us -
>>>> I'm sure we'll evaluate and reconsider after it's implemented.
>>>>
>>>> Thank you - Richard
>>>>
>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://shiro-user.582556.n2.nabble.com/Implementing-strong-password-hashing-with-Shiro-and-Openldap-tp7579496p7579498.html
>>>> Sent from the Shiro User mailing list archive at Nabble.com.
>>>
>>>
>>
>

Re: Implementing strong password hashing with Shiro and Openldap

Posted by Luke Biddell <lu...@gmail.com>.
If you're doing the hashing yourself and storing them somewhere, consider
using something other than SHA*.

Take a look at these articles.

http://codahale.com/how-to-safely-store-a-password/
http://www.unlimitednovelty.com/2012/03/dont-use-bcrypt.html

My understanding is that SHA* are designed for speed which ultimately aids
brute force attacks.

Something like Bcrypt or even better PBKDF2 mitigates this.

I'm not an expert though, Les will probably have a better view.



On 14 January 2014 02:32, Les Hazlewood <lh...@apache.org> wrote:

> Hi Richard, yes, if you can't configure the LDAP server to be aware of
> iterations/complexity, then I think doing the matching at the Realm level
> (with a PasswordMatcher) would be good.
>
> HTH!
>
> --
> Les Hazlewood | @lhazlewood
> CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282
>
>
> On Mon, Jan 13, 2014 at 5:11 PM, Richard Mixon <rn...@custco.biz> wrote:
>
>> Les, I've actually got the Shiro real working - with either SSHA or
>> SSHA256. But not looks like either of the ldap server's built-in bind
>> functions do not allow you to specify how many hash iterations to compute,
>> only the algorithm to use. So I guess that means I just do an LDAP search
>> instead of a bind and do the matching in my realm logic.
>>
>> Or am I missing something?
>>
>> Thanks!
>>
>> Sent from my iPhone
>>
>> On Jan 13, 2014, at 16:20, Les Hazlewood <lh...@apache.org> wrote:
>>
>> Hi Richard,
>>
>> If I understand correctly, your challenge is that you want to configure
>> the LDAP server of choice to compute SSHA256?  And then to have Shiro read
>> in that record, look at the hashed value and then do the comparison?
>>
>> Best,
>>
>> Les
>>
>> On Mon, Jan 13, 2014 at 8:54 AM, rnmixon <rn...@custco.biz> wrote:
>>
>>> A bit more info ...
>>>
>>> We are putting together a small outward facing portal - implementing an
>>> LDAP
>>> directory is part of that effort (we use Microsoft AD for internal
>>> users).
>>>
>>> At this point we've written the PHP plugin for our Wordpress site to
>>> authenticate external partners via the LDAP directory and internal
>>> users/employees using our Microsoft Active Directory. I'm doing the same
>>> for
>>> the two Java applications that need to be integrated.
>>>
>>> Currently, I'm trying to meet a new requirement I received last week to
>>> use
>>> SSHA256 instead of SSHA and to use a high number of hashing iterations as
>>> Les' article suggested.
>>>
>>> In theory Openldap can do this using the sha2 plugin, but it's been slow
>>> getting it to work - after quite a few years it has not been included in
>>> the
>>> base product's plugin set - and there appear to be some philosophical
>>> wars
>>> as to whether more advanced hashes can or should be included in the core
>>> product plugins.
>>>
>>> So at this point I've allocated a day (today) to look at the Fedora 389
>>> Directory Server and see if it offers a smoother path. So far that seems
>>> to
>>> be the case, but I'm not all the way there yet.
>>>
>>> Any thoughts or suggestions on a better path? This is a first step for
>>> us -
>>> I'm sure we'll evaluate and reconsider after it's implemented.
>>>
>>> Thank you - Richard
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://shiro-user.582556.n2.nabble.com/Implementing-strong-password-hashing-with-Shiro-and-Openldap-tp7579496p7579498.html
>>> Sent from the Shiro User mailing list archive at Nabble.com.
>>>
>>
>>
>

Re: Implementing strong password hashing with Shiro and Openldap

Posted by Les Hazlewood <lh...@apache.org>.
Hi Richard, yes, if you can't configure the LDAP server to be aware of
iterations/complexity, then I think doing the matching at the Realm level
(with a PasswordMatcher) would be good.

HTH!

--
Les Hazlewood | @lhazlewood
CTO, Stormpath | http://stormpath.com | @goStormpath | 888.391.5282


On Mon, Jan 13, 2014 at 5:11 PM, Richard Mixon <rn...@custco.biz> wrote:

> Les, I've actually got the Shiro real working - with either SSHA or
> SSHA256. But not looks like either of the ldap server's built-in bind
> functions do not allow you to specify how many hash iterations to compute,
> only the algorithm to use. So I guess that means I just do an LDAP search
> instead of a bind and do the matching in my realm logic.
>
> Or am I missing something?
>
> Thanks!
>
> Sent from my iPhone
>
> On Jan 13, 2014, at 16:20, Les Hazlewood <lh...@apache.org> wrote:
>
> Hi Richard,
>
> If I understand correctly, your challenge is that you want to configure
> the LDAP server of choice to compute SSHA256?  And then to have Shiro read
> in that record, look at the hashed value and then do the comparison?
>
> Best,
>
> Les
>
> On Mon, Jan 13, 2014 at 8:54 AM, rnmixon <rn...@custco.biz> wrote:
>
>> A bit more info ...
>>
>> We are putting together a small outward facing portal - implementing an
>> LDAP
>> directory is part of that effort (we use Microsoft AD for internal users).
>>
>> At this point we've written the PHP plugin for our Wordpress site to
>> authenticate external partners via the LDAP directory and internal
>> users/employees using our Microsoft Active Directory. I'm doing the same
>> for
>> the two Java applications that need to be integrated.
>>
>> Currently, I'm trying to meet a new requirement I received last week to
>> use
>> SSHA256 instead of SSHA and to use a high number of hashing iterations as
>> Les' article suggested.
>>
>> In theory Openldap can do this using the sha2 plugin, but it's been slow
>> getting it to work - after quite a few years it has not been included in
>> the
>> base product's plugin set - and there appear to be some philosophical wars
>> as to whether more advanced hashes can or should be included in the core
>> product plugins.
>>
>> So at this point I've allocated a day (today) to look at the Fedora 389
>> Directory Server and see if it offers a smoother path. So far that seems
>> to
>> be the case, but I'm not all the way there yet.
>>
>> Any thoughts or suggestions on a better path? This is a first step for us
>> -
>> I'm sure we'll evaluate and reconsider after it's implemented.
>>
>> Thank you - Richard
>>
>>
>>
>> --
>> View this message in context:
>> http://shiro-user.582556.n2.nabble.com/Implementing-strong-password-hashing-with-Shiro-and-Openldap-tp7579496p7579498.html
>> Sent from the Shiro User mailing list archive at Nabble.com.
>>
>
>

Re: Implementing strong password hashing with Shiro and Openldap

Posted by Richard Mixon <rn...@custco.biz>.
Les, I've actually got the Shiro real working - with either SSHA or SSHA256. But not looks like either of the ldap server's built-in bind functions do not allow you to specify how many hash iterations to compute, only the algorithm to use. So I guess that means I just do an LDAP search instead of a bind and do the matching in my realm logic.

Or am I missing something?

Thanks!

Sent from my iPhone

> On Jan 13, 2014, at 16:20, Les Hazlewood <lh...@apache.org> wrote:
> 
> Hi Richard,
> 
> If I understand correctly, your challenge is that you want to configure the LDAP server of choice to compute SSHA256?  And then to have Shiro read in that record, look at the hashed value and then do the comparison?
> 
> Best,
> 
> Les
> 
>> On Mon, Jan 13, 2014 at 8:54 AM, rnmixon <rn...@custco.biz> wrote:
>> A bit more info ...
>> 
>> We are putting together a small outward facing portal - implementing an LDAP
>> directory is part of that effort (we use Microsoft AD for internal users).
>> 
>> At this point we've written the PHP plugin for our Wordpress site to
>> authenticate external partners via the LDAP directory and internal
>> users/employees using our Microsoft Active Directory. I'm doing the same for
>> the two Java applications that need to be integrated.
>> 
>> Currently, I'm trying to meet a new requirement I received last week to use
>> SSHA256 instead of SSHA and to use a high number of hashing iterations as
>> Les' article suggested.
>> 
>> In theory Openldap can do this using the sha2 plugin, but it's been slow
>> getting it to work - after quite a few years it has not been included in the
>> base product's plugin set - and there appear to be some philosophical wars
>> as to whether more advanced hashes can or should be included in the core
>> product plugins.
>> 
>> So at this point I've allocated a day (today) to look at the Fedora 389
>> Directory Server and see if it offers a smoother path. So far that seems to
>> be the case, but I'm not all the way there yet.
>> 
>> Any thoughts or suggestions on a better path? This is a first step for us -
>> I'm sure we'll evaluate and reconsider after it's implemented.
>> 
>> Thank you - Richard
>> 
>> 
>> 
>> --
>> View this message in context: http://shiro-user.582556.n2.nabble.com/Implementing-strong-password-hashing-with-Shiro-and-Openldap-tp7579496p7579498.html
>> Sent from the Shiro User mailing list archive at Nabble.com.
> 

Re: Implementing strong password hashing with Shiro and Openldap

Posted by Les Hazlewood <lh...@apache.org>.
Hi Richard,

If I understand correctly, your challenge is that you want to configure the
LDAP server of choice to compute SSHA256?  And then to have Shiro read in
that record, look at the hashed value and then do the comparison?

Best,

Les

On Mon, Jan 13, 2014 at 8:54 AM, rnmixon <rn...@custco.biz> wrote:

> A bit more info ...
>
> We are putting together a small outward facing portal - implementing an
> LDAP
> directory is part of that effort (we use Microsoft AD for internal users).
>
> At this point we've written the PHP plugin for our Wordpress site to
> authenticate external partners via the LDAP directory and internal
> users/employees using our Microsoft Active Directory. I'm doing the same
> for
> the two Java applications that need to be integrated.
>
> Currently, I'm trying to meet a new requirement I received last week to use
> SSHA256 instead of SSHA and to use a high number of hashing iterations as
> Les' article suggested.
>
> In theory Openldap can do this using the sha2 plugin, but it's been slow
> getting it to work - after quite a few years it has not been included in
> the
> base product's plugin set - and there appear to be some philosophical wars
> as to whether more advanced hashes can or should be included in the core
> product plugins.
>
> So at this point I've allocated a day (today) to look at the Fedora 389
> Directory Server and see if it offers a smoother path. So far that seems to
> be the case, but I'm not all the way there yet.
>
> Any thoughts or suggestions on a better path? This is a first step for us -
> I'm sure we'll evaluate and reconsider after it's implemented.
>
> Thank you - Richard
>
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Implementing-strong-password-hashing-with-Shiro-and-Openldap-tp7579496p7579498.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>

Re: Implementing strong password hashing with Shiro and Openldap

Posted by rnmixon <rn...@custco.biz>.
A bit more info ...

We are putting together a small outward facing portal - implementing an LDAP
directory is part of that effort (we use Microsoft AD for internal users).

At this point we've written the PHP plugin for our Wordpress site to
authenticate external partners via the LDAP directory and internal
users/employees using our Microsoft Active Directory. I'm doing the same for
the two Java applications that need to be integrated. 

Currently, I'm trying to meet a new requirement I received last week to use
SSHA256 instead of SSHA and to use a high number of hashing iterations as
Les' article suggested.

In theory Openldap can do this using the sha2 plugin, but it's been slow
getting it to work - after quite a few years it has not been included in the
base product's plugin set - and there appear to be some philosophical wars
as to whether more advanced hashes can or should be included in the core
product plugins.

So at this point I've allocated a day (today) to look at the Fedora 389
Directory Server and see if it offers a smoother path. So far that seems to
be the case, but I'm not all the way there yet.

Any thoughts or suggestions on a better path? This is a first step for us -
I'm sure we'll evaluate and reconsider after it's implemented.

Thank you - Richard



--
View this message in context: http://shiro-user.582556.n2.nabble.com/Implementing-strong-password-hashing-with-Shiro-and-Openldap-tp7579496p7579498.html
Sent from the Shiro User mailing list archive at Nabble.com.