SSL + Basic Auth

SSL + Basic Auth

am 03.09.2007 00:18:11 von Aaron Dalton

This is a cryptographically signed message in MIME format.

--------------ms030309060906060501050007
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

I am trying to setup a RESTful web service where GET is open to all but
POST, PUT, and DELETE are restricted to authorized users. I have a
database of users that is checked using Basic Auth. So far, so good. I
*also* want to make it possible to issue certificates (from a
home-rolled CA) to users if they wish, so they can bypass the
username/password dialogues. Try as I might, I simply cannot get an
either/or setup working where certs are checked and basic auth is
skipped if a valid cert is found. No matter what, the Basic Auth dialog
always appears. It also appears that the directive does not
work with RequireSSL directives? Is there a way to limit only certain
methods using SSL? I've tried +FakeBasicAuth but then the database
lookup code rejects the username (of course). Here's what my config
looks like right now. I would really appreciate any pointers or
suggestions. Thanks so much for your time.

--BEGIN CONFIG--

SSLOptions +StdEnvVars
AllowOverride all
Order deny,allow
Allow from all
Satisfy any

SSLRequireSSL
SSLRequire %{SSL_CIPHER_USEKEYSIZE} >= 128
SSLRequire ( \
%{SSL_CLIENT_S_DN_O} eq "Super Duper Games" \
and %{SSL_CLIENT_S_DN_OU} eq "REST Server" \
)


AuthType Basic
AuthBasicProvider dbd
AuthDBDUserPWQuery "SELECT encrypt(password) FROM users WHERE username=%s"
AuthName "Super Duper Games"


Require valid-user


--END CONFIG--

--
Aaron Dalton | Super Duper Games
aaron@daltons.ca | http://superdupergames.org

--------------ms030309060906060501050007
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEH AQAAoIISOjCC
BggwggPwoAMCAQICAQEwDQYJKoZIhvcNAQEEBQAweTEQMA4GA1UEChMHUm9v dCBDQTEeMBwG
A1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ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EJAzEL BgkqhkiG9w0B
BwEwHAYJKoZIhvcNAQkFMQ8XDTA3MDkwMjIyMTgxMVowIwYJKoZIhvcNAQkE MRYEFFYDT78n
KsCmVFGFGAgkqGSD3L5NMFIGCSqGSIb3DQEJDzFFMEMwCgYIKoZIhvcNAwcw DgYIKoZIhvcN
AwICAgCAMA0GCCqGSIb3DQMCAgFAMAcGBSsOAwIHMA0GCCqGSIb3DQMCAgEo MGkGCSsGAQQB
gjcQBDFcMFowVDEUMBIGA1UEChMLQ0FjZXJ0IEluYy4xHjAcBgNVBAsTFWh0 dHA6Ly93d3cu
Q0FjZXJ0Lm9yZzEcMBoGA1UEAxMTQ0FjZXJ0IENsYXNzIDMgUm9vdAICLp0w awYLKoZIhvcN
AQkQAgsxXKBaMFQxFDASBgNVBAoTC0NBY2VydCBJbmMuMR4wHAYDVQQLExVo dHRwOi8vd3d3
LkNBY2VydC5vcmcxHDAaBgNVBAMTE0NBY2VydCBDbGFzcyAzIFJvb3QCAi6d MA0GCSqGSIb3
DQEBAQUABIIBAFaop4Z+iHT/xhNrXHtX2nTcBTyMNN9Wl8KxvgcNf3qb+mos SiEFMxej91q/
LmpIUCg9NhLPL8MeDWOucgCVMcRH3BNyjvKUI7lf6IuymmJ/aadQBy3mY5wd FqHQOM0sEfxs
3tit64K6UMIVfH+S+FNxzGrceEgHTuRIyxQk0K/ArwjFuPGSuduaB4kLRHDK 03yR40GTLXOC
1gjdNsdYatWNyJEsi2qRJja3OVKuqC033WxmRxtNYd8vqH5evBw2wpUhpoeR WiKqh5QuzrKp
ii7PoluUipY4+MMfCHR5bCgc77b0PkATcOapcpWkKfj8uHq/jWifqpxqwaGn Rp9D6VAAAAAA
AAA=
--------------ms030309060906060501050007--
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users@modssl.org
Automated List Manager majordomo@modssl.org