Koha/acqui
Robin Sheat 4cbeeedbe8 Bug 6296: allow users to be authenticated by SSL client certs
This adds a new syspref: AllowPKIAuth. It can have one of three states:
* None
* Common Name
* emailAddress

If a) this is set to something that's not "None", and b) the webserver
is passing SSL client cert details on to Koha, then the relevant field
in the user's certificate will be matched up against the field in the
database and they will be automatically logged in. This is used as a
secure form of single sign-on in some organisations.

The "Common Name" field is matched up against the userid, while
"emailAddress" is matched against the primary email.

This is an example of what might go in the Apache configuration for the
virtual host:

    #SSLVerifyClient require # only allow PKI authentication
    SSLVerifyClient optional
    SSLVerifyDepth 2
    SSLCACertificateFile /etc/apache2/ssl/test/ca.crt
    SSLOptions +StdEnvVars

The last line ensures that the required details are
passed to Koha.

To test the PKI authentication, use the following curl command:
    curl -k --cert client.crt --key client.key  https://URL/
(look through the output to find the "Welcome," line to indicate that a user
has been authenticated or the "Log in to Your Account" to indicate that a
user has not been authenticated)

To create the certificates needed for the above command, the following series
of commands will work:
    # Create the CA Key and Certificate for signing Client Certs
    openssl genrsa -des3 -out ca.key 4096
    openssl req -new -x509 -days 365 -key ca.key -out ca.crt
    # This is the ca.crt file that the Apache config needs to know about,
    # so put the file at /etc/apache2/ssl/test/ca.crt

    # Create the Server Key, CSR, and Certificate
    openssl genrsa -des3 -out server.key 1024
    openssl req -new -key server.key -out server.csr

    # We're self signing our own server cert here.  This is a no-no in
    # production.
    openssl x509 -req -days 365 -in server.csr -CA ca.crt -CAkey ca.key \
        -set_serial 01 -out server.crt

    # Create the Client Key and CSR
    openssl genrsa -des3 -out client.key 1024
    openssl req -new -key client.key -out client.csr

    # Sign the client certificate with our CA cert. Unlike signing our own
    # server cert, this is what we want to do.
    openssl x509 -req -days 365 -in client.csr -CA ca.crt -CAkey ca.key \
        -set_serial 02 -out client.crt
    openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12
    # In theory we can install this client.p12 file in Firefox or Chrome, but
    # the exact steps for doing so are unclear, and outside the scope of this
    # patch

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Tested with Common Name and E-mail authentication, as well as with PKI
authentication disabled. Regular logins continue to work in all cases when
SSL authentication is set to optional on the server.

Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
QA comment: synchronized updatedatabase.pl version of syspref with sysprefs.sql
version, to avoid divergent databases between new and upgrading users.
2012-03-19 17:02:44 +01:00
..
pdfformat Bug 7476 Remove executable bit from files that probably should not be executed 2012-02-03 14:22:15 +01:00
acqui-home.pl bug 6834 followup removing param_map 2011-09-03 06:39:24 +12:00
addorder.pl Bug 7289: Adds editionstatement field in neworderempty 2012-02-17 11:13:34 +01:00
addorderiso2709.pl signed off Bug 7284: Authority matching improvements 2012-03-07 17:34:11 +01:00
basket.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
basketgroup.pl Bug 7138: Can't print basket group order pdf 2011-11-09 17:07:26 +01:00
basketheader.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
booksellers.pl bug_7001: Issue and Reserve slips are notices. 2012-03-09 10:11:20 +01:00
check_budget_total.pl Bug 5385: POD Cleanups (part 1) 2010-11-12 10:06:55 +13:00
check_duplicate_barcode_ajax.pl Bug 6963: Corrects a problem when a new order is created with a duplicate barcode. 2011-11-04 10:22:28 +01:00
currency.pl Fix FSF address in directory acqui/ 2010-03-16 20:17:51 -04:00
fetch_sort_dropbox.pl bug 7343 - Fix empty values in statistic 1 and 2 dropboxes in neworderempty 2012-01-23 18:15:09 +01:00
finishreceive.pl Bug 6296: allow users to be authenticated by SSL client certs 2012-03-19 17:02:44 +01:00
histsearch.pl Bug 7018 - need all acq permissions to search 2012-02-16 18:44:56 +01:00
lateorders.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
neworderbiblio.pl Bug 6994: Wrong 'no budget defined' alert 2011-11-06 11:43:30 +01:00
neworderempty.pl signed off Bug 7284: Authority matching improvements 2012-03-07 17:34:11 +01:00
newordersuggestion.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
ordered.pl Bug 7602: Spent and ordered pages require full acquisition permissions 2012-03-13 16:00:46 +01:00
orderreceive.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
parcel.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
parcels.pl Bug 7113: Standardize vendor id name in templates and scripts 2012-02-17 19:04:00 +01:00
spent.pl Bug 7602: Spent and ordered pages require full acquisition permissions 2012-03-13 16:00:46 +01:00
supplier.pl Bug 4969: deletion of suppliers 2012-03-13 15:12:26 +01:00
uncertainprice.pl Fix FSF address in directory acqui/ 2010-03-16 20:17:51 -04:00
updatesupplier.pl Bug 7606: Editing a vendor in acq creates a new vendor 2012-02-27 11:14:48 +01:00
z3950_search.pl Fix for Bug 7148 - Add some error handling to Acquisitions' Z39.50 search to match Cataloging's 2012-02-02 14:02:53 +01:00