views:

1617

answers:

1

Instead of using basic or digest authentication for an upload, could it be possible for a service to generate a certificate for the client to download for authenticated uploads? Keygen could be used for example, though it might be more straightforward to "Save the certificate" somewhere.

Once the user has the certificate, the user is able to then upload "foobar.png" via cURL. Perhaps like so:

curl -E mycert.pem -F "[email protected]" http://example.com/secure-upload.php

Has anyone setup a similar scheme? I'm not sure it's possible as the -E switch in the manpage does not mention POST. Also I am unsure how to setup the httpd service to authenticate the certificate. Hopefully just an Apache SSL directive.

+2  A: 

Yes its possible. -E works with any HTTP method. You'd of course need to use a HTTPS:// url.

You also need to provide a passphrase, and you need to learn that -E takes a private key and the private certificate concatenated (usually, as indicated in the man page).

The server-side with Apache is just following the docs as well, yes.

Daniel Stenberg