Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

There is a problem.

The server contains the certificate (.crt). And there are two different users. One is set in the browser certificate (.p12), which signed the server certificate. The user enters the folder example.com/a

A user who doesn't have a certificate enters example.com/b

How to do it using the settings apache? Redirect?

Sorry for my English :)

share|improve this question

closed as not a real question by Michael Hampton, Magellan, EightBitTony, voretaq7 Oct 19 '12 at 19:12

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
I can't quite figure out what you're asking here. Can you rephrase it, preferably with a table of the URLs, expected results and actual results? –  Ladadadada Oct 15 '12 at 13:57

1 Answer 1

up vote 1 down vote accepted

If I understand you correctly, you could use mod_rewrite for this. I've not tested the config below, but it's a place for you to start from...

In the SSL settings, you use

SSLVerifyClient optional
SSLOptions +StdEnvVars

This means that you will allow clients to use authentication if they are able to, but you'll allow them to connect even if they can't. In order for this to work, you also need to trust the CA that has issued the client certificate; this is done by adding

SSLCACertificateFile path/to/file

to your config and having the certificate for the CA in that file.

Then, you use mod_rewrite to check for an environment variable that gets set by a client with a certificate you approve:

 RewriteEngine on
 RewriteCond   %{SSL_CLIENT_VERIFY} SUCCESS
 RewriteRule   ^/(.*) /a/(.*) [L]

 RewriteCond   %{SSL_CLIENT_VERIFY} FAILED
 RewriteRule   ^/(.*) /b/(.*) [L]
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.