Koha/members
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
..
boraccount.pl Bug 6964 - 'Add child' function should be dependant on system preference 'borrowerRelationship' 2012-02-02 11:36:05 +01:00
default_messageprefs.pl Fix FSF address in directory members/ 2010-03-16 20:17:55 -04:00
deletemem.pl Bug 6964 - 'Add child' function should be dependant on system preference 'borrowerRelationship' 2012-02-02 11:36:05 +01:00
guarantor_search.pl bug_6253: Unified member Search() 2011-10-19 16:23:02 +13:00
mancredit.pl Bug 6964 - 'Add child' function should be dependant on system preference 'borrowerRelationship' 2012-02-02 11:36:05 +01:00
maninvoice.pl Bug 6964 - 'Add child' function should be dependant on system preference 'borrowerRelationship' 2012-02-02 11:36:05 +01:00
member-flags.pl Bug 6964 - 'Add child' function should be dependant on system preference 'borrowerRelationship' 2012-02-02 11:36:05 +01:00
member-password.pl Fix for Bug 5280 - Fix password field so that the password is masked as it is entered 2012-02-13 16:39:59 +01:00
member-picupload.pl Fix FSF address in directory members/ 2010-03-16 20:17:55 -04:00
member.pl Bug 7544 - Add ability search borrowers only on email / phone 2012-02-27 18:25:26 +01:00
memberentry.pl Bug 7167: Followup: FIX conflicts with Bug 5347 2012-03-13 12:27:13 +01:00
members-home.pl Bug 2505: Suppress some warnings emitted by members-home.pl 2011-07-11 21:05:37 +12:00
moremember.pl bug_7001: Issue and Reserve slips are notices. 2012-03-09 10:11:20 +01:00
notices.pl Bug 6964 - 'Add child' function should be dependant on system preference 'borrowerRelationship' 2012-02-02 11:36:05 +01:00
patronimage.pl Bug 5385: POD Cleanups (part 1) 2010-11-12 10:06:55 +13:00
pay.pl Bug 6718 No manager_id saved for writeoff fines. 2012-02-16 18:48:14 +01:00
paycollect.pl Merge remote-tracking branch 'origin/new/bug_6964' 2012-02-03 09:19:04 +01:00
printfeercpt.pl Bug 4440: Revised combined patch to print fee receipts and invoices 2010-11-18 14:33:27 +13:00
printinvoice.pl Bug 4440: Revised combined patch to print fee receipts and invoices 2010-11-18 14:33:27 +13:00
printslip.pl bug_7001: Issue and Reserve slips are notices. 2012-03-09 10:11:20 +01:00
readingrec.pl Bug 6751: Adds a link "Export checkin barcodes" in readingrec 2012-03-13 14:49:48 +01:00
setdebar.pl Bug 6328 Fixes for comment 35 2011-11-25 14:00:47 +01:00
setstatus.pl Bug 6296: allow users to be authenticated by SSL client certs 2012-03-19 17:02:44 +01:00
update-child.pl Bug 5673: test guarantorid consistently 2011-02-03 22:10:24 +13:00