Restricting access by arbitrary certificate extension

This is a multi-part message in MIME format.
--------------000808010101020202040508
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable

mod_ssl can perform client authentication on certificate in
Apache and client authorization on certain certificate extensions. We
are setting up CA here and we want to restrict access to certain website
by checking the presence of certain certificate extension using its OID.
The syntax which mod_ssl is forcing us to use is the following:

<Location />
SSLRequire =E2=80=9Csome string=E2=80=9D in OID(=E2=80=9C1.2.=
3.4=E2=80=A6..=E2=80=9D)
</Location>

As you can see, we need to match this string exactly in extension=E2=80=99=
s
value. We can encounter problem with this, because this extension may
not be listed in openssl list of valid extensions
(crypto/objects/objects.h). As I learned the mod_ssl and openssl code,
mod_ssl would not be able to match the string because the object of this
OID does not have valid NID in openssl. OpenSSL seems incapable of
determining the type of arbitrary extension we want to use as
restricting factor. Hence, mod_ssl can not even extract its value from
certificate.
Well, I poked around the problem for some time and found no
other way than to patch mod_ssl by adding one new function in
ssl_expr_eval.c which does almost the same thing as ssl_extlist_by_oid()
and ssl_expr_eval_oid() but does not intend to extract the value of
certificate extension. I also added some change to ssl_expr_eval_comp(),
so if you supply the zero-length word in SSLRequire, it uses my new
function instead of ssl_expr_eval_oid(). So, the new syntax is like this:

<Location />
SSLRequire =E2=80=9C=E2=80=9D in OID(=E2=80=9C1.2.3.4=E2=80=A6=
...=E2=80=9D)
</Location>

If you are aware of more attractive and =E2=80=9Cright=E2=80=9D=
way to make
it, please acknowledge. My patch for apache-2.2.11 is attached.

--
Zhumabekov Yerden

--------------000808010101020202040508
Content-Type: application/gzip;
name="apache_oid_presence.patch.gz"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="apache_oid_presence.patch.gz"

H4sICEofAEoAA2FwYWNoZV9vaWRfcHJlc2VuY2UucGF0Y2gArVXbbtpAEH0u XzF9M9gG2wmp
kpY0vVCpFQIppFLfLMceh03MLl0vgSjNv3fGNnc3bdVaGMzsXM6cObtORJqC O4zmGtrtzsSY
WeIG7aDt+22VJZ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ofCrQUfAT CWkNIj0JAAA=
--------------000808010101020202040508--
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users [at] modssl.org
Automated List Manager majordomo [at] modssl.org
Zhumabekov Yerden [ Mi, 06 Mai 2009 06:49 ] [ ID #2000361 ]

Re: Restricting access by arbitrary certificate extension

Zhumabekov - discussion of mod_ssl for httpd 2.x takes place on the
deveopment list for Apache httpd, CC'ed. (I'm quoting the full mail
inline for reference of dev [at] readers)

On Wed, May 06, 2009 at 10:49:46AM +0600, Zhumabekov Yerden wrote:
> mod_ssl can perform client authentication on certificate in =

> Apache and client authorization on certain certificate extensions. We
> are setting up CA here and we want to restrict access to certain websit=
e
> by checking the presence of certain certificate extension using its OID=
..
> The syntax which mod_ssl is forcing us to use is the following:
>
> <Location />
> SSLRequire =E2=80=9Csome string=E2=80=9D in OID(=E2=80=9C1.2=
..3.4=E2=80=A6..=E2=80=9D)
> </Location>
>
> As you can see, we need to match this string exactly in extension=E2=80=
=99s
> value. We can encounter problem with this, because this extension may
> not be listed in openssl list of valid extensions
> (crypto/objects/objects.h). As I learned the mod_ssl and openssl code, =

> mod_ssl would not be able to match the string because the object of thi=
s
> OID does not have valid NID in openssl. OpenSSL seems incapable of
> determining the type of arbitrary extension we want to use as
> restricting factor. Hence, mod_ssl can not even extract its value from =

> certificate.
> Well, I poked around the problem for some time and found no =

> other way than to patch mod_ssl by adding one new function in
> ssl_expr_eval.c which does almost the same thing as ssl_extlist_by_oid(=
)
> and ssl_expr_eval_oid() but does not intend to extract the value of
> certificate extension. I also added some change to ssl_expr_eval_comp()=
,
> so if you supply the zero-length word in SSLRequire, it uses my new
> function instead of ssl_expr_eval_oid(). So, the new syntax is like thi=
s:
>
> <Location />
> SSLRequire =E2=80=9C=E2=80=9D in OID(=E2=80=9C1.2.3.4=E2=80=A6=
...=E2=80=9D)
> </Location>
>
> If you are aware of more attractive and =E2=80=9Cright=E2=80=
=9D way to make
> it, please acknowledge. My patch for apache-2.2.11 is attached.

I'd rather see a different syntax used for the new semantics, such as:

SSLRequire has_oid("1.2.3.4")

though I'm not sure whether the SSLRequire parser can cope with that.

Regards, Joe
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users [at] modssl.org
Automated List Manager majordomo [at] modssl.org
Joe Orton [ Do, 28 Mai 2009 17:42 ] [ ID #2003165 ]
Webserver » gmane.comp.apache.mod-ssl.user » Restricting access by arbitrary certificate extension

Vorheriges Thema: ssl_error_handshake_unexpected_alert
Nächstes Thema: Client SSL Proxy Configuration