Koha/serials
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
..
acqui-search-result.pl Bug5063: C4::Bookseller Changes 2011-03-12 08:42:26 +13:00
acqui-search.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00
checkexpiration.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00
claims.pl Bug5063: C4::Bookseller Changes 2011-03-12 08:42:26 +13:00
lateissues-excel.pl Fix FSF Address in directory serials/ 2010-04-08 20:39:49 +01:00
member-search.pl Bug 5484 - Handling bad borrower categories in serial routing lists more gracefully 2010-12-14 12:59:14 +13:00
reorder_members.pl Bug 6296: allow users to be authenticated by SSL client certs 2012-03-19 17:02:44 +01:00
routing-preview.pl Bug 7557: Change hardcoded routing list note into a system preference 2012-03-14 16:27:07 +01:00
routing.pl Bug 6790: Remove unnecessary variable from getroutinglist return 2012-01-23 17:59:27 +01:00
serial-issues.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00
serials-collection.pl Bug 7523: Improve checks for routing permissions 2012-02-27 18:22:01 +01:00
serials-edit.pl Bug 7521: Templates should use receive_serials permission 2012-02-17 09:51:49 +01:00
serials-home.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00
serials-recieve.pl Fix FSF address in directory serials/ 2010-03-16 20:17:54 -04:00
statecollection.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00
subscription-add.pl Bug 6305: Subscriptions can not be edited 2011-07-06 08:32:04 +12:00
subscription-bib-search.pl Bug 7312: Adds ISSN to serials/subscription-bib-search.pl results 2012-02-17 11:16:38 +01:00
subscription-detail.pl Bug 6296: allow users to be authenticated by SSL client certs 2012-03-19 17:02:44 +01:00
subscription-renew.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00
viewalerts.pl Cherry-picked onto master, fixing conflicts: MT 1816: Granular permissions for the serials module 2010-06-19 07:23:46 -04:00