You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tilman Baumann <ti...@pyramid.de> on 2005/06/09 14:18:11 UTC

[users@httpd] how to alter and use environmanet vaaiables with mod_rewrite

Hi,

i have a problem which is seem to be swamped with.
I want to make a substitute on a variable for later use in mod_rewrite.

I have users which are Authorizing themselves via ssl cleint auth  
(mod_ssl and +FakeBasicAuth)
These users access all the same url (they are relatively dump  
scripts) and each has to get a file which is specialy stored for him.

My plan was to make each user a directory which is constructet out of  
the DN of his certificate. It would be easy to map a request from / 
licenses/ to /licenses/%{ENV:SSL_CLIENT_S_DN}/

But unfortunately a DN contains slashes like this:
/C=DE/L=Freiburg/O=Pyramid Computer GmbH/OU=Solutions Update Service/ 
CN=6281
Well, so i have to change the slashes in %{ENV:SSL_CLIENT_S_DN} to  
something different.
Maybe underlines.

I have no idea to change the slashes in this variable (or better a  
copy of it) and then use it in mod_rewrite.
Any ideas how to make this?


I also tried a rewrite_program, but all happens is that apache does  
not accept any connection after that. :)
But i am verry unhappy with the idea to call a programm each request.  
So i like to do it in another way.

Here my buggy script:
#!/usr/bin/perl
#   disable buffered I/O which would lead
#   to deadloops for the Apache server
$| = 1;
#   read URLs one per line from stdin and
#   generate substitution URL on stdout

while (<>) {
                 my $dn = $ENV{'SSL_CLIENT_S_DN'};
                 $dn =~ s|/|\\|;
                 s|(.*)|$1/$dn|;
print $_;
}


Thanks for any help.
--
Tilman Baumann
Pyramid Computer
Tel: +49 (7 61) 46 14-837


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org