Extracting SSL_CLIENT_S_DN_UID does not work

View: New views
11 Messages — Rating Filter:   Alert me  

Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

HI!

(Re-sent since my message through gmane didn't come through.)

Maybe I'm overlooking the obvious but it seems that env var
SSL_CLIENT_S_DN_UID is not set when using a client cert for authentication.

The following env vars displayed in my SSI HTML text are relevant here
(obfuscated to protect privacy):

SSL_CLIENT_S_DN: /O=Company Name/OU=Authc/UID=userid/CN=Full name
SSL_CLIENT_S_DN_UID: (none)

Is it caused by UID not being the leaf RDN?

Ciao, Michael.

______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Joe Orton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, May 19, 2008 at 10:13:45AM +0200, Michael Ströder wrote:

> HI!
>
> (Re-sent since my message through gmane didn't come through.)
>
> Maybe I'm overlooking the obvious but it seems that env var
> SSL_CLIENT_S_DN_UID is not set when using a client cert for authentication.
>
> The following env vars displayed in my SSI HTML text are relevant here
> (obfuscated to protect privacy):
>
> SSL_CLIENT_S_DN: /O=Company Name/OU=Authc/UID=userid/CN=Full name
> SSL_CLIENT_S_DN_UID: (none)
>
> Is it caused by UID not being the leaf RDN?

That shouldn't make any difference.  What versions of OpenSSL and
httpd/mod_ssl are you using?  The "UID" DN tag is ambiguous and probably
maps to something other than what your subject DN uses.

In the current 2.x mod_ssl sources, UID maps to:

#ifdef NID_x500UniqueIdentifier /* new name as of Openssl 0.9.7 */
    { "UID",   NID_x500UniqueIdentifier   },
#else /* old name, OpenSSL < 0.9.7 */
    { "UID",   NID_uniqueIdentifier       },
#endif

joe
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe,

many thanks for your response.

Joe Orton wrote:

> On Mon, May 19, 2008 at 10:13:45AM +0200, Michael Ströder wrote:
>>
>> Maybe I'm overlooking the obvious but it seems that env var
>> SSL_CLIENT_S_DN_UID is not set when using a client cert for authentication.
>>
>> The following env vars displayed in my SSI HTML text are relevant here
>> (obfuscated to protect privacy):
>>
>> SSL_CLIENT_S_DN: /O=Company Name/OU=Authc/UID=userid/CN=Full name
>> SSL_CLIENT_S_DN_UID: (none)
>>
>> Is it caused by UID not being the leaf RDN?
>
> That shouldn't make any difference.

Ok, fine.

> What versions of OpenSSL and httpd/mod_ssl are you using?

Actually pre-built RPMs shipped with openSUSE 10.3:

# rpm -q openssl apache2
openssl-0.9.8e-45.5
apache2-2.2.4-70.4

Not sure whether these RPMs are based on sources patched by openSUSE.

>  The "UID" DN tag is ambiguous and probably
> maps to something other than what your subject DN uses.
>
> In the current 2.x mod_ssl sources, UID maps to:
>
> #ifdef NID_x500UniqueIdentifier /* new name as of Openssl 0.9.7 */
>     { "UID",   NID_x500UniqueIdentifier   },
> #else /* old name, OpenSSL < 0.9.7 */
>     { "UID",   NID_uniqueIdentifier       },
> #endif

Hmm, the user ID is already stored by mod_ssl with attribute name "UID"
in env var SSL_CLIENT_S_DN. Given that it's OpenSSL 0.9.8 and that the
attribute type seems to be interpreted as UID is it safe to assume that
the cert contains the right OID?

If NID_x500UniqueIdentifier maps to OID 2.5.4.45 it's plain wrong anyway...

Ciao, Michael.
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Joe Orton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, May 23, 2008 at 04:46:48PM +0200, Michael Ströder wrote:

>> In the current 2.x mod_ssl sources, UID maps to:
>>
>> #ifdef NID_x500UniqueIdentifier /* new name as of Openssl 0.9.7 */
>>     { "UID",   NID_x500UniqueIdentifier   },
>> #else /* old name, OpenSSL < 0.9.7 */
>>     { "UID",   NID_uniqueIdentifier       },
>> #endif
>
> Hmm, the user ID is already stored by mod_ssl with attribute name "UID" in
> env var SSL_CLIENT_S_DN. Given that it's OpenSSL 0.9.8 and that the
> attribute type seems to be interpreted as UID is it safe to assume that the
> cert contains the right OID?

No, unfortunately there is disparity between mod_ssl and OpenSSL here.  
(I don't know why; I think historically the short name mappings were not
unique in OpenSSL possibly, something like that)

OpenSSL uses "UID" for NID_userId (OID mapping an exercise for the
reader, see obj_mac.h in OpenSSL ;).  So in fact that's the tag used for
that RDN.

> If NID_x500UniqueIdentifier maps to OID 2.5.4.45 it's plain wrong anyway...

It does indeed map to that OID... wrong in what sense?

joe
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe Orton wrote:
> On Fri, May 23, 2008 at 04:46:48PM +0200, Michael Ströder wrote:
>> Hmm, the user ID is already stored by mod_ssl with attribute name "UID" in
>> env var SSL_CLIENT_S_DN. Given that it's OpenSSL 0.9.8 and that the
>> attribute type seems to be interpreted as UID is it safe to assume that the
>> cert contains the right OID?
>
> No, unfortunately there is disparity between mod_ssl and OpenSSL here.  
> (I don't know why; I think historically the short name mappings were not
> unique in OpenSSL possibly, something like that)

Hmmpf! So the string representation of SSL_CLIENT_S_DN is completely
generated by OpenSSL whereas the single attribute types are generated by
mod_ssl by looking at the cert's OID?

>> If NID_x500UniqueIdentifier maps to OID 2.5.4.45 it's plain wrong anyway...
>
> It does indeed map to that OID... wrong in what sense?

Because the syntax assigned to attribute type 'x500UniqueIdentifier'
(OID 2.5.4.45) is 'Bit String' (OID 1.3.6.1.4.1.1466.115.121.1.6) which
cannot be used to store a user ID with characters like 'ABCDEF'.

http://www.alvestrand.no/objectid/2.5.4.45.html

Ciao, Michael.
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe Orton wrote:

> On Fri, May 23, 2008 at 04:46:48PM +0200, Michael Ströder wrote:
>>> In the current 2.x mod_ssl sources, UID maps to:
>>>
>>> #ifdef NID_x500UniqueIdentifier /* new name as of Openssl 0.9.7 */
>>>     { "UID",   NID_x500UniqueIdentifier   },
>>> #else /* old name, OpenSSL < 0.9.7 */
>>>     { "UID",   NID_uniqueIdentifier       },
>>> #endif
>> Hmm, the user ID is already stored by mod_ssl with attribute name "UID" in
>> env var SSL_CLIENT_S_DN. Given that it's OpenSSL 0.9.8 and that the
>> attribute type seems to be interpreted as UID is it safe to assume that the
>> cert contains the right OID?
>
> No, unfortunately there is disparity between mod_ssl and OpenSSL here.  
> (I don't know why; I think historically the short name mappings were not
> unique in OpenSSL possibly, something like that)
>
> OpenSSL uses "UID" for NID_userId (OID mapping an exercise for the
> reader, see obj_mac.h in OpenSSL ;).  So in fact that's the tag used for
> that RDN.

Ok, then the OID in my cert is 0.9.2342.19200300.100.1.1 (attribute type
'uid' specified for pilotPerson). That seems right to me since it's
compliant with RFC 4514 which contains a table of short and long
attribute type names and their OIDs (end of chapter 3).

But now I don't understand the #ifdef-statement mentioned above. From my
understanding it MUST NOT reference NID_x500UniqueIdentifier. It MUST
reference NID_userId. To me that looks clearly like a bug in mod_ssl.

Ciao, Michael.

______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Joe Orton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, May 23, 2008 at 05:23:34PM +0200, Michael Ströder wrote:
> Ok, then the OID in my cert is 0.9.2342.19200300.100.1.1 (attribute type
> 'uid' specified for pilotPerson). That seems right to me since it's
> compliant with RFC 4514 which contains a table of short and long attribute
> type names and their OIDs (end of chapter 3).
>
> But now I don't understand the #ifdef-statement mentioned above. From my
> understanding it MUST NOT reference NID_x500UniqueIdentifier. It MUST
> reference NID_userId. To me that looks clearly like a bug in mod_ssl.

Changing it would break backwards-compat which is why the #ifdef is
there (so that the _UID variable refers to the same OID regardless of
what OpenSSL version si use).

But I don't disagree that it was wrong in the first place.  I vaguely
recall discussing this somewhere before and deciding we needed an extra
_UserID-like variable so people can get the (commoner) pilotPerson-type
uid attribute out of the DN too.

joe
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Joe Orton wrote:

> On Fri, May 23, 2008 at 05:23:34PM +0200, Michael Ströder wrote:
>> Ok, then the OID in my cert is 0.9.2342.19200300.100.1.1 (attribute type
>> 'uid' specified for pilotPerson). That seems right to me since it's
>> compliant with RFC 4514 which contains a table of short and long attribute
>> type names and their OIDs (end of chapter 3).
>>
>> But now I don't understand the #ifdef-statement mentioned above. From my
>> understanding it MUST NOT reference NID_x500UniqueIdentifier. It MUST
>> reference NID_userId. To me that looks clearly like a bug in mod_ssl.
>
> Changing it would break backwards-compat which is why the #ifdef is
> there (so that the _UID variable refers to the same OID regardless of
> what OpenSSL version si use).

1. I seriously doubt that there are any certs out there which use
x500UniqueIdentifier in the subject-DN. If yes, then these certs are
also seriously broken.

2. It's simply broken that attribute type UID in mod_ssl differs from
OpenSSL here.

Ciao, Michael.
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Ströder wrote:

> Joe Orton wrote:
>> On Fri, May 23, 2008 at 05:23:34PM +0200, Michael Ströder wrote:
>>> Ok, then the OID in my cert is 0.9.2342.19200300.100.1.1 (attribute
>>> type 'uid' specified for pilotPerson). That seems right to me since
>>> it's compliant with RFC 4514 which contains a table of short and long
>>> attribute type names and their OIDs (end of chapter 3).
>>>
>>> But now I don't understand the #ifdef-statement mentioned above. From
>>> my understanding it MUST NOT reference NID_x500UniqueIdentifier. It
>>> MUST reference NID_userId. To me that looks clearly like a bug in
>>> mod_ssl.
>>
>> Changing it would break backwards-compat which is why the #ifdef is
>> there (so that the _UID variable refers to the same OID regardless of
>> what OpenSSL version si use).

To come around this: How about letting the deployer specify the OIDs in
httpd.conf? Backwards-compability could be achieved with this.

Ciao, Michael.
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by erika20 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

DONT SEND ME THIS CRAP THANK'S
-------------- Original message from Michael Ströder <michael@...>: --------------


> Joe,
>
> many thanks for your response.
>
> Joe Orton wrote:
> > On Mon, May 19, 2008 at 10:13:45AM +0200, Michael Ströder wrote:
> >>
> >> Maybe I'm overlooking the obvious but it seems that env var
> >> SSL_CLIENT_S_DN_UID is not set when using a client cert for authentication.
> >>
> >> The following env vars displayed in my SSI HTML text are relevant here
> >> (obfuscated to protect privacy):
> >>
> >> SSL_CLIENT_S_DN: /O=Company Name/OU=Authc/UID=userid/CN=Full name
> >> SSL_CLIENT_S_DN_UID: (none)
> >>
> >> Is it caused by UID not being the leaf RDN?
> >
> > That shouldn' t make any difference.
>
> Ok, fine.
>
> > What versions of OpenSSL and httpd/mod_ssl are you using?
>
> Actually pre-built RPMs shipped with openSUSE 10.3:
>
> # rpm -q openssl apache2
> openssl-0.9.8e-45.5
> apache2-2.2.4-70.4
>
> Not sure whether these RPMs are based on sources patched by openSUSE.
>
> > The "UID" DN tag is ambiguous and probably
> > maps to something other than what your subject DN uses.
> >
> > In the current 2.x mod_ssl sources, UID maps to:
> >
> > #ifdef NID_x500UniqueIdentifier /* new name as of Openssl 0.9.7 */
> > { "UID", NID_x500UniqueIdentifier },
> > #else /* old name, OpenSSL < 0.9.7 */
> > { "UID", NID_uniqueIdentifier },
> > #endif
>
> Hmm, the user ID is already stored by mod_ssl with attribute name "UID"
> in env var SSL_CLIENT_S_D N. Giv en that it's OpenSSL 0.9.8 and that the
> attribute type seems to be interpreted as UID is it safe to assume that
> the cert contains the right OID?
>
> If NID_x500UniqueIdentifier maps to OID 2.5.4.45 it's plain wrong anyway...
>
> Ciao, Michael.
> ______________________________________________________________________
> Apache Interface to OpenSSL (mod_ssl) www.modssl.org
> User Support Mailing List modssl-users@...
> Automated List Manager majordomo@...

Re: Extracting SSL_CLIENT_S_DN_UID does not work

by Michael Ströder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Ströder wrote:

> Joe Orton wrote:
>> On Fri, May 23, 2008 at 05:23:34PM +0200, Michael Ströder wrote:
>>> Ok, then the OID in my cert is 0.9.2342.19200300.100.1.1 (attribute
>>> type 'uid' specified for pilotPerson). That seems right to me since
>>> it's compliant with RFC 4514 which contains a table of short and long
>>> attribute type names and their OIDs (end of chapter 3).
>>>
>>> But now I don't understand the #ifdef-statement mentioned above. From
>>> my understanding it MUST NOT reference NID_x500UniqueIdentifier. It
>>> MUST reference NID_userId. To me that looks clearly like a bug in
>>> mod_ssl.
>>
>> Changing it would break backwards-compat which is why the #ifdef is
>> there (so that the _UID variable refers to the same OID regardless of
>> what OpenSSL version si use).
>
> 1. I seriously doubt that there are any certs out there which use
> x500UniqueIdentifier in the subject-DN. If yes, then these certs are
> also seriously broken.
>
> 2. It's simply broken that attribute type UID in mod_ssl differs from
> OpenSSL here.

Please take note of this Apache issue and consider the patch attached:

https://issues.apache.org/bugzilla/show_bug.cgi?id=45107

Ciao, Michael.
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl)                   www.modssl.org
User Support Mailing List                      modssl-users@...
Automated List Manager                            majordomo@...
LightInTheBox - Buy quality products at wholesale price