Forum Moderators: phranque

Message Too Old, No Replies

htacess query

.htaccess

         

uggers

3:13 pm on Jun 13, 2009 (gmt 0)

10+ Year Member



I have created a .htaccess file so that certain users can access a specific area of a intranet site.

It currently obtains the users 'SSL_CLIENT_S_DN_CN' and they gain access if there name is on then list.

See below:

SSLRequire %{SSL_CLIENT_S_DN_CN} in {"bobsmith", "tomsmith", "paulsmith"}

Now as this list will eventually be a maximum of 20 users, I have decided against using a database approach. What I would like is to instead of having the users contained within the .htaccess file, to have the .htaccess file to read a text file that contains a list of authorised users. So something like:

SSLRequire %{SSL_CLIENT_S_DN_CN} in {Read text file of authorised users}

Is this possible?

Also I would like to obtain the first 5 chars of the SSL_CLIENT_S_DN_CN and compare this against the named user list. So in using the above example:

SSLRequire %{First 5 chars of the SSL_CLIENT_S_DN_CN} in {"bobsm", "tomsm", "pauls"}

Again is this possible?

Thanks in advance

jdMorgan

7:57 pm on Jun 14, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.htaccess is a server config file, not a script. The directives in .htaccess are parsed by the loaded Apache modules one-at-a-time, with each module interpreting and acting on only the directives that it understands.

Therefore, the capability of 'importing' or 'including' an external file would have to be coded in the Apache module itself -- in this case, mod_ssl.

Jim