You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by DIGLLOYD <di...@me.com.INVALID> on 2024/12/13 00:39:05 UTC
DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
ISSUE: users cannot login to my site.
CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
Details:
- Tomcat 9.0.98
- DIGEST auth using MD5
- has been working for 15+ years just fine.
- have read all available Tomcat docs, searched web for answers, etc.
Debugging so far:
Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
By instrumenting this realm, I have determined the following:
- Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
- Safari is sending MD5, which works fine
- Realm uses standard
Thoughts:
I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
Possibilities:
1. Tomcat is not properly advising the client that MD5 is required.
2. The spec is somehow deficient so that client and server do not know what is required.
3. The clients (Firefox and Chrome) are doing it wrong.
4. Something needs to be configured that I have not configured.
Lloyd Chambers
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by Sebastian Trost <ma...@sebastiantrost.de.INVALID>.
Lloyd,
On 13.12.2024 01:39, DIGLLOYD wrote:
> ISSUE: users cannot login to my site.
> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>
> Details:
> - Tomcat 9.0.98
> - DIGEST auth using MD5
> - has been working for 15+ years just fine.
What exactly did you do? Did you update Tomcat? From which version to
which version? Does it still work with the old version?
> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>
> By instrumenting this realm, I have determined the following:
Did you change your realm configuration at all during your update? If
so, what did you change? Can you post the whole Realm (without password,
of course)?
Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Lloyd,
On 12/13/24 2:41 PM, DIGLLOYD wrote:
> Agreed, it is probably pointless to support SHA-256, given the hard
> requirement of supporting MD5 in older browsers for many years to
> come.
>
> OTOH, running any kind of DIGEST over TLS and storing zero sensitive
> info on server is completely acceptable for my own use case.
You can use HTTP Basic Authentication over TLS and store zero sensitive
information on the server as well.
I have never seen any benefit to using HTTP Digest over HTTP Basic when
TLS in in place.
-chris
>> On Dec 13, 2024, at 11:37:27, Christopher Schultz <ch...@christopherschultz.net> wrote:
>>
>> Lloyd,
>>
>> On 12/13/24 2:32 PM, DIGLLOYD wrote:
>>> Yes, it is returning the digest without modification. That’s not the issue.
>>>
>>> There are three options:
>>> (1) require MD5 only
>>> (2) require SHA-256 only
>>> (3) allow either MD5 or SHA-256
>>>
>>> #2 is not an option since some browsers (eg Safari) do not yet support SHA-256.
>>> And SHA-256 will never be supported on millions of computers because they will never get upgraded to the latest OS/browser.
>>>
>>> issue: getPassword(username) has no parameter specifying algorithm MD5 or SHA-256. Therefore, it cannot be used.
>>>
>>> My solution is to override getDigest(String username, String realmName, String algorithm), and return the digest for the actual algorithm.
>>>
>>> If I am missing something, I’d like to hear it but I don’t see an alternative.
>>>> <Valve
>> className="org.apache.catalina.authenticator.DigestAuthenticator" ...
>> algorithms="SHA-256,MD5" />
>>
>> It's almost as if HTTP DIGEST authentication cannot be made both secure
>> and backward-compatible.
>>
>> -chris
>>
>>>> On Dec 13, 2024, at 11:16:50, Christopher Schultz <ch...@christopherschultz.net> wrote:
>>>>
>>>> Lloyd,
>>>>
>>>> On 12/13/24 11:47 AM, DIGLLOYD wrote:
>>>>> BTW, I was able to support *both* MD5 and SHA-256 in my subclass of org.apache.catalina.realm.RealmBase
>>>>> ISSUE: org.apache.catalina.realm.RealmBas.getPassword(final String username) affords no means to know *which* algorithm ie which digest to return.
>>>>> I dealt with this by subclassing org.apache.catalina.realm.RealmBase:
>>>>> 1. Overriding getDigest(String username, String realmName, String algorithm) for the algorithm, returning the appropriate digest based on the actual algorithm.
>>>>> 2. getPassword(String username) never gets used because of #1.
>>>>> 3. Storing both MD5 and SHA-256 digests
>>>>> In this way, I can support both MD5 and SHA-256. I don’t know if this was a good idea or not, but it is working as desired.
>>>>> Should org.apache.catalina.realm.RealmBase should be improved to be getPassword(String username, String algorithm) instead of getPassword(String username)?
>>>>
>>>> No, getPassword should be returning the stored credential without modification. It's odd that you have multiple credentials stored.
>>>>
>>>> -chris
>>>>
>>>>>> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>>>>>>
>>>>>> On 13/12/2024 00:39, DIGLLOYD wrote:
>>>>>>> ISSUE: users cannot login to my site.
>>>>>>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>>>>>>
>>>>>>> Details:
>>>>>>> - Tomcat 9.0.98
>>>>>>> - DIGEST auth using MD5
>>>>>>> - has been working for 15+ years just fine.
>>>>>>> - have read all available Tomcat docs, searched web for answers, etc.
>>>>>>>
>>>>>>> Debugging so far:
>>>>>>>
>>>>>>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>>>>>>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>>>>>>
>>>>>> So you have DIGEST authentication with digested credentials.
>>>>>>
>>>>>> That will work as long as DIGEST authentication uses the same digest as
>>>>>> the credentials. In this case: MD5.
>>>>>>
>>>>>> By default, Tomcat advertises support for both SHA-256 and MD5 with
>>>>>> DIGEST authentication. Browsers should choose SHA-256 given those
>>>>>> options. To change that, you need to set the algorithms attribute for
>>>>>> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>>>>>>
>>>>>> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>>>>>>
>>>>>> Note the comment in the introduction to that section.
>>>>>>
>>>>>> Mark
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> By instrumenting this realm, I have determined the following:
>>>>>>>
>>>>>>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>>>>>>> - Safari is sending MD5, which works fine
>>>>>>> - Realm uses standard
>>>>>>>
>>>>>>> Thoughts:
>>>>>>>
>>>>>>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>>>>>>
>>>>>>> Possibilities:
>>>>>>> 1. Tomcat is not properly advising the client that MD5 is required.
>>>>>>> 2. The spec is somehow deficient so that client and server do not know what is required.
>>>>>>> 3. The clients (Firefox and Chrome) are doing it wrong.
>>>>>>> 4. Something needs to be configured that I have not configured.
>>>>>>>
>>>>>>> Lloyd Chambers
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by DIGLLOYD <di...@me.com.INVALID>.
Agreed, it is probably pointless to support SHA-256, given the hard requirement of supporting MD5 in older browsers for many years to come.
OTOH, running any kind of DIGEST over TLS and storing zero sensitive info on server is completely acceptable for my own use case.
> On Dec 13, 2024, at 11:37:27, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
> Lloyd,
>
> On 12/13/24 2:32 PM, DIGLLOYD wrote:
>> Yes, it is returning the digest without modification. That’s not the issue.
>>
>> There are three options:
>> (1) require MD5 only
>> (2) require SHA-256 only
>> (3) allow either MD5 or SHA-256
>>
>> #2 is not an option since some browsers (eg Safari) do not yet support SHA-256.
>> And SHA-256 will never be supported on millions of computers because they will never get upgraded to the latest OS/browser.
>>
>> issue: getPassword(username) has no parameter specifying algorithm MD5 or SHA-256. Therefore, it cannot be used.
>>
>> My solution is to override getDigest(String username, String realmName, String algorithm), and return the digest for the actual algorithm.
>>
>> If I am missing something, I’d like to hear it but I don’t see an alternative.
>>> <Valve
> className="org.apache.catalina.authenticator.DigestAuthenticator" ...
> algorithms="SHA-256,MD5" />
>
> It's almost as if HTTP DIGEST authentication cannot be made both secure
> and backward-compatible.
>
> -chris
>
>>> On Dec 13, 2024, at 11:16:50, Christopher Schultz <ch...@christopherschultz.net> wrote:
>>>
>>> Lloyd,
>>>
>>> On 12/13/24 11:47 AM, DIGLLOYD wrote:
>>>> BTW, I was able to support *both* MD5 and SHA-256 in my subclass of org.apache.catalina.realm.RealmBase
>>>> ISSUE: org.apache.catalina.realm.RealmBas.getPassword(final String username) affords no means to know *which* algorithm ie which digest to return.
>>>> I dealt with this by subclassing org.apache.catalina.realm.RealmBase:
>>>> 1. Overriding getDigest(String username, String realmName, String algorithm) for the algorithm, returning the appropriate digest based on the actual algorithm.
>>>> 2. getPassword(String username) never gets used because of #1.
>>>> 3. Storing both MD5 and SHA-256 digests
>>>> In this way, I can support both MD5 and SHA-256. I don’t know if this was a good idea or not, but it is working as desired.
>>>> Should org.apache.catalina.realm.RealmBase should be improved to be getPassword(String username, String algorithm) instead of getPassword(String username)?
>>>
>>> No, getPassword should be returning the stored credential without modification. It's odd that you have multiple credentials stored.
>>>
>>> -chris
>>>
>>>>> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>>>>>
>>>>> On 13/12/2024 00:39, DIGLLOYD wrote:
>>>>>> ISSUE: users cannot login to my site.
>>>>>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>>>>>
>>>>>> Details:
>>>>>> - Tomcat 9.0.98
>>>>>> - DIGEST auth using MD5
>>>>>> - has been working for 15+ years just fine.
>>>>>> - have read all available Tomcat docs, searched web for answers, etc.
>>>>>>
>>>>>> Debugging so far:
>>>>>>
>>>>>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>>>>>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>>>>>
>>>>> So you have DIGEST authentication with digested credentials.
>>>>>
>>>>> That will work as long as DIGEST authentication uses the same digest as
>>>>> the credentials. In this case: MD5.
>>>>>
>>>>> By default, Tomcat advertises support for both SHA-256 and MD5 with
>>>>> DIGEST authentication. Browsers should choose SHA-256 given those
>>>>> options. To change that, you need to set the algorithms attribute for
>>>>> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>>>>>
>>>>> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>>>>>
>>>>> Note the comment in the introduction to that section.
>>>>>
>>>>> Mark
>>>>>
>>>>>
>>>>>>
>>>>>> By instrumenting this realm, I have determined the following:
>>>>>>
>>>>>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>>>>>> - Safari is sending MD5, which works fine
>>>>>> - Realm uses standard
>>>>>>
>>>>>> Thoughts:
>>>>>>
>>>>>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>>>>>
>>>>>> Possibilities:
>>>>>> 1. Tomcat is not properly advising the client that MD5 is required.
>>>>>> 2. The spec is somehow deficient so that client and server do not know what is required.
>>>>>> 3. The clients (Firefox and Chrome) are doing it wrong.
>>>>>> 4. Something needs to be configured that I have not configured.
>>>>>>
>>>>>> Lloyd Chambers
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Lloyd,
On 12/13/24 2:32 PM, DIGLLOYD wrote:
> Yes, it is returning the digest without modification. That’s not the issue.
>
> There are three options:
> (1) require MD5 only
> (2) require SHA-256 only
> (3) allow either MD5 or SHA-256
>
> #2 is not an option since some browsers (eg Safari) do not yet support SHA-256.
> And SHA-256 will never be supported on millions of computers because they will never get upgraded to the latest OS/browser.
>
> issue: getPassword(username) has no parameter specifying algorithm MD5 or SHA-256. Therefore, it cannot be used.
>
> My solution is to override getDigest(String username, String realmName, String algorithm), and return the digest for the actual algorithm.
>
> If I am missing something, I’d like to hear it but I don’t see an alternative.
> > <Valve
className="org.apache.catalina.authenticator.DigestAuthenticator" ...
algorithms="SHA-256,MD5" />
It's almost as if HTTP DIGEST authentication cannot be made both secure
and backward-compatible.
-chris
>> On Dec 13, 2024, at 11:16:50, Christopher Schultz <ch...@christopherschultz.net> wrote:
>>
>> Lloyd,
>>
>> On 12/13/24 11:47 AM, DIGLLOYD wrote:
>>> BTW, I was able to support *both* MD5 and SHA-256 in my subclass of org.apache.catalina.realm.RealmBase
>>> ISSUE: org.apache.catalina.realm.RealmBas.getPassword(final String username) affords no means to know *which* algorithm ie which digest to return.
>>> I dealt with this by subclassing org.apache.catalina.realm.RealmBase:
>>> 1. Overriding getDigest(String username, String realmName, String algorithm) for the algorithm, returning the appropriate digest based on the actual algorithm.
>>> 2. getPassword(String username) never gets used because of #1.
>>> 3. Storing both MD5 and SHA-256 digests
>>> In this way, I can support both MD5 and SHA-256. I don’t know if this was a good idea or not, but it is working as desired.
>>> Should org.apache.catalina.realm.RealmBase should be improved to be getPassword(String username, String algorithm) instead of getPassword(String username)?
>>
>> No, getPassword should be returning the stored credential without modification. It's odd that you have multiple credentials stored.
>>
>> -chris
>>
>>>> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>>>>
>>>> On 13/12/2024 00:39, DIGLLOYD wrote:
>>>>> ISSUE: users cannot login to my site.
>>>>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>>>>
>>>>> Details:
>>>>> - Tomcat 9.0.98
>>>>> - DIGEST auth using MD5
>>>>> - has been working for 15+ years just fine.
>>>>> - have read all available Tomcat docs, searched web for answers, etc.
>>>>>
>>>>> Debugging so far:
>>>>>
>>>>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>>>>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>>>>
>>>> So you have DIGEST authentication with digested credentials.
>>>>
>>>> That will work as long as DIGEST authentication uses the same digest as
>>>> the credentials. In this case: MD5.
>>>>
>>>> By default, Tomcat advertises support for both SHA-256 and MD5 with
>>>> DIGEST authentication. Browsers should choose SHA-256 given those
>>>> options. To change that, you need to set the algorithms attribute for
>>>> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>>>>
>>>> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>>>>
>>>> Note the comment in the introduction to that section.
>>>>
>>>> Mark
>>>>
>>>>
>>>>>
>>>>> By instrumenting this realm, I have determined the following:
>>>>>
>>>>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>>>>> - Safari is sending MD5, which works fine
>>>>> - Realm uses standard
>>>>>
>>>>> Thoughts:
>>>>>
>>>>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>>>>
>>>>> Possibilities:
>>>>> 1. Tomcat is not properly advising the client that MD5 is required.
>>>>> 2. The spec is somehow deficient so that client and server do not know what is required.
>>>>> 3. The clients (Firefox and Chrome) are doing it wrong.
>>>>> 4. Something needs to be configured that I have not configured.
>>>>>
>>>>> Lloyd Chambers
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by DIGLLOYD <di...@me.com.INVALID>.
Yes, it is returning the digest without modification. That’s not the issue.
There are three options:
(1) require MD5 only
(2) require SHA-256 only
(3) allow either MD5 or SHA-256
#2 is not an option since some browsers (eg Safari) do not yet support SHA-256.
And SHA-256 will never be supported on millions of computers because they will never get upgraded to the latest OS/browser.
issue: getPassword(username) has no parameter specifying algorithm MD5 or SHA-256. Therefore, it cannot be used.
My solution is to override getDigest(String username, String realmName, String algorithm), and return the digest for the actual algorithm.
If I am missing something, I’d like to hear it but I don’t see an alternative.
<Valve className="org.apache.catalina.authenticator.DigestAuthenticator" ... algorithms="SHA-256,MD5" />
> On Dec 13, 2024, at 11:16:50, Christopher Schultz <ch...@christopherschultz.net> wrote:
>
> Lloyd,
>
> On 12/13/24 11:47 AM, DIGLLOYD wrote:
>> BTW, I was able to support *both* MD5 and SHA-256 in my subclass of org.apache.catalina.realm.RealmBase
>> ISSUE: org.apache.catalina.realm.RealmBas.getPassword(final String username) affords no means to know *which* algorithm ie which digest to return.
>> I dealt with this by subclassing org.apache.catalina.realm.RealmBase:
>> 1. Overriding getDigest(String username, String realmName, String algorithm) for the algorithm, returning the appropriate digest based on the actual algorithm.
>> 2. getPassword(String username) never gets used because of #1.
>> 3. Storing both MD5 and SHA-256 digests
>> In this way, I can support both MD5 and SHA-256. I don’t know if this was a good idea or not, but it is working as desired.
>> Should org.apache.catalina.realm.RealmBase should be improved to be getPassword(String username, String algorithm) instead of getPassword(String username)?
>
> No, getPassword should be returning the stored credential without modification. It's odd that you have multiple credentials stored.
>
> -chris
>
>>> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>>>
>>> On 13/12/2024 00:39, DIGLLOYD wrote:
>>>> ISSUE: users cannot login to my site.
>>>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>>>
>>>> Details:
>>>> - Tomcat 9.0.98
>>>> - DIGEST auth using MD5
>>>> - has been working for 15+ years just fine.
>>>> - have read all available Tomcat docs, searched web for answers, etc.
>>>>
>>>> Debugging so far:
>>>>
>>>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>>>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>>>
>>> So you have DIGEST authentication with digested credentials.
>>>
>>> That will work as long as DIGEST authentication uses the same digest as
>>> the credentials. In this case: MD5.
>>>
>>> By default, Tomcat advertises support for both SHA-256 and MD5 with
>>> DIGEST authentication. Browsers should choose SHA-256 given those
>>> options. To change that, you need to set the algorithms attribute for
>>> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>>>
>>> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>>>
>>> Note the comment in the introduction to that section.
>>>
>>> Mark
>>>
>>>
>>>>
>>>> By instrumenting this realm, I have determined the following:
>>>>
>>>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>>>> - Safari is sending MD5, which works fine
>>>> - Realm uses standard
>>>>
>>>> Thoughts:
>>>>
>>>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>>>
>>>> Possibilities:
>>>> 1. Tomcat is not properly advising the client that MD5 is required.
>>>> 2. The spec is somehow deficient so that client and server do not know what is required.
>>>> 3. The clients (Firefox and Chrome) are doing it wrong.
>>>> 4. Something needs to be configured that I have not configured.
>>>>
>>>> Lloyd Chambers
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
Lloyd,
On 12/13/24 11:47 AM, DIGLLOYD wrote:
> BTW, I was able to support *both* MD5 and SHA-256 in my subclass of org.apache.catalina.realm.RealmBase
>
> ISSUE: org.apache.catalina.realm.RealmBas.getPassword(final String username) affords no means to know *which* algorithm ie which digest to return.
>
> I dealt with this by subclassing org.apache.catalina.realm.RealmBase:
> 1. Overriding getDigest(String username, String realmName, String algorithm) for the algorithm, returning the appropriate digest based on the actual algorithm.
> 2. getPassword(String username) never gets used because of #1.
> 3. Storing both MD5 and SHA-256 digests
>
> In this way, I can support both MD5 and SHA-256. I don’t know if this was a good idea or not, but it is working as desired.
>
> Should org.apache.catalina.realm.RealmBase should be improved to be getPassword(String username, String algorithm) instead of getPassword(String username)?
No, getPassword should be returning the stored credential without
modification. It's odd that you have multiple credentials stored.
-chris
>> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>>
>> On 13/12/2024 00:39, DIGLLOYD wrote:
>>> ISSUE: users cannot login to my site.
>>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>>
>>> Details:
>>> - Tomcat 9.0.98
>>> - DIGEST auth using MD5
>>> - has been working for 15+ years just fine.
>>> - have read all available Tomcat docs, searched web for answers, etc.
>>>
>>> Debugging so far:
>>>
>>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>>
>> So you have DIGEST authentication with digested credentials.
>>
>> That will work as long as DIGEST authentication uses the same digest as
>> the credentials. In this case: MD5.
>>
>> By default, Tomcat advertises support for both SHA-256 and MD5 with
>> DIGEST authentication. Browsers should choose SHA-256 given those
>> options. To change that, you need to set the algorithms attribute for
>> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>>
>> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>>
>> Note the comment in the introduction to that section.
>>
>> Mark
>>
>>
>>>
>>> By instrumenting this realm, I have determined the following:
>>>
>>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>>> - Safari is sending MD5, which works fine
>>> - Realm uses standard
>>>
>>> Thoughts:
>>>
>>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>>
>>> Possibilities:
>>> 1. Tomcat is not properly advising the client that MD5 is required.
>>> 2. The spec is somehow deficient so that client and server do not know what is required.
>>> 3. The clients (Firefox and Chrome) are doing it wrong.
>>> 4. Something needs to be configured that I have not configured.
>>>
>>> Lloyd Chambers
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by DIGLLOYD <di...@me.com.INVALID>.
BTW, I was able to support *both* MD5 and SHA-256 in my subclass of org.apache.catalina.realm.RealmBase
ISSUE: org.apache.catalina.realm.RealmBas.getPassword(final String username) affords no means to know *which* algorithm ie which digest to return.
I dealt with this by subclassing org.apache.catalina.realm.RealmBase:
1. Overriding getDigest(String username, String realmName, String algorithm) for the algorithm, returning the appropriate digest based on the actual algorithm.
2. getPassword(String username) never gets used because of #1.
3. Storing both MD5 and SHA-256 digests
In this way, I can support both MD5 and SHA-256. I don’t know if this was a good idea or not, but it is working as desired.
Should org.apache.catalina.realm.RealmBase should be improved to be getPassword(String username, String algorithm) instead of getPassword(String username)?
Lloyd
> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>
> On 13/12/2024 00:39, DIGLLOYD wrote:
>> ISSUE: users cannot login to my site.
>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>
>> Details:
>> - Tomcat 9.0.98
>> - DIGEST auth using MD5
>> - has been working for 15+ years just fine.
>> - have read all available Tomcat docs, searched web for answers, etc.
>>
>> Debugging so far:
>>
>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>
> So you have DIGEST authentication with digested credentials.
>
> That will work as long as DIGEST authentication uses the same digest as
> the credentials. In this case: MD5.
>
> By default, Tomcat advertises support for both SHA-256 and MD5 with
> DIGEST authentication. Browsers should choose SHA-256 given those
> options. To change that, you need to set the algorithms attribute for
> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>
> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>
> Note the comment in the introduction to that section.
>
> Mark
>
>
>>
>> By instrumenting this realm, I have determined the following:
>>
>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>> - Safari is sending MD5, which works fine
>> - Realm uses standard
>>
>> Thoughts:
>>
>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>
>> Possibilities:
>> 1. Tomcat is not properly advising the client that MD5 is required.
>> 2. The spec is somehow deficient so that client and server do not know what is required.
>> 3. The clients (Firefox and Chrome) are doing it wrong.
>> 4. Something needs to be configured that I have not configured.
>>
>> Lloyd Chambers
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by DIGLLOYD <di...@me.com.INVALID>.
Thank you Mark.
DIGEST, and in Tomcat 9 (not 11). Not sure if 9 vs 11 matters.
Sure enough, I missed “algorithms” attribute in <valve>. Having that config for ~15 years and then having things start to fail led me down the wrong path it seem.
I did 3 things wrong:
- just did not see “algorithms” in the <valve> docs
- “algorithm” vs “algorithms” in the <valve>
- algorithm=“MD5” in MessageDigestCredentialHandler. Whose code looks to be incapable of handling both algorithms eg getPassword() omits the algorithm so there is no way to know except in getDigest()
Lloyd
> On Dec 13, 2024, at 02:23:38, Mark Thomas <ma...@apache.org> wrote:
>
> On 13/12/2024 00:39, DIGLLOYD wrote:
>> ISSUE: users cannot login to my site.
>> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>>
>> Details:
>> - Tomcat 9.0.98
>> - DIGEST auth using MD5
>> - has been working for 15+ years just fine.
>> - have read all available Tomcat docs, searched web for answers, etc.
>>
>> Debugging so far:
>>
>> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
>> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
>
> So you have DIGEST authentication with digested credentials.
>
> That will work as long as DIGEST authentication uses the same digest as
> the credentials. In this case: MD5.
>
> By default, Tomcat advertises support for both SHA-256 and MD5 with
> DIGEST authentication. Browsers should choose SHA-256 given those
> options. To change that, you need to set the algorithms attribute for
> the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
>
> https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
>
> Note the comment in the introduction to that section.
>
> Mark
>
>
>>
>> By instrumenting this realm, I have determined the following:
>>
>> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
>> - Safari is sending MD5, which works fine
>> - Realm uses standard
>>
>> Thoughts:
>>
>> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>>
>> Possibilities:
>> 1. Tomcat is not properly advising the client that MD5 is required.
>> 2. The spec is somehow deficient so that client and server do not know what is required.
>> 3. The clients (Firefox and Chrome) are doing it wrong.
>> 4. Something needs to be configured that I have not configured.
>>
>> Lloyd Chambers
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: DIGEST auth in Tomcat 9 — browsers sending SHA-256 to MD5 server, how to adapt?
Posted by Mark Thomas <ma...@apache.org>.
On 13/12/2024 00:39, DIGLLOYD wrote:
> ISSUE: users cannot login to my site.
> CAUSE: Firefox and Chrome are sending SHA-256 DIGEST auth, which is MD5 (Safari uses MD5 which is working fine)
>
> Details:
> - Tomcat 9.0.98
> - DIGEST auth using MD5
> - has been working for 15+ years just fine.
> - have read all available Tomcat docs, searched web for answers, etc.
>
> Debugging so far:
>
> Custom Realm in use purpose of managing auth info, but it otherwise defers to org.apache.catalina.realm.RealmBase.
> CredentialHandler: eg <CredentialHandler className="org.apache.catalina.realm.MessageDigestCredentialHandler" algorithm="MD5" />
So you have DIGEST authentication with digested credentials.
That will work as long as DIGEST authentication uses the same digest as
the credentials. In this case: MD5.
By default, Tomcat advertises support for both SHA-256 and MD5 with
DIGEST authentication. Browsers should choose SHA-256 given those
options. To change that, you need to set the algorithms attribute for
the DIGEST authentication Valve to "MD5" so the Valve only advertises MD5.
https://tomcat.apache.org/tomcat-11.0-doc/config/valve.html#Digest_Authenticator_Valve
Note the comment in the introduction to that section.
Mark
>
> By instrumenting this realm, I have determined the following:
>
> - Firefox and Chrome are sending SHA-256 DIGEST to my server, which is using MD5. Guaranteed failure since wrong digest.
> - Safari is sending MD5, which works fine
> - Realm uses standard
>
> Thoughts:
>
> I would have thought that Tomcat would be replying to a client by advertising the correct algorithm.
>
> Possibilities:
> 1. Tomcat is not properly advising the client that MD5 is required.
> 2. The spec is somehow deficient so that client and server do not know what is required.
> 3. The clients (Firefox and Chrome) are doing it wrong.
> 4. Something needs to be configured that I have not configured.
>
> Lloyd Chambers
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org