ZXID IdP and Discovery

Sampo Kellomäki (sampo@iki.fi)

ZXID.org Identity Management toolkit implements standalone SAML 2.0 and Liberty ID-WSF 2.0 stacks. The IdP provides Single Sign-On capability and the Discovery provides ability to issue credentials to web services as well as to locate suitable services.

1 Introduction

ZXID IdP and Discovery configuration and databases are filesystem based and consists mainly of text files to which lines are appended. After describing the filesystem based configuration, we introduce some IdP administration topics and how to accomplish them.

1.1 Other documents

2 IdP and Discovery

zxididp implements, in a bare-bones way, SAML 2.0 IdP, ID-WSF 2.0 Authentication Service, and ID-WSF 2.0 Discovery Service. It is one of the cornerstones of a federated identity architecture.

2.1 IdP Use of Local UID Directory (idpuid/)

zxididp uses local idpuid/ directory to implement the IdP logins and to store users federations, bootstraps, and attributes.

  /var/zxid/
   |
   +-- idpzxid.conf  Main configuration file
   +-- idppem/       Our certificates
   +-- idpcot/       Metadata of CoT partners (metadata cache)
   +-- idpses/       Sessions
   |    |
   |    +-- SESID/         Each session has its own directory
   |         |
   |         +-- .ses      The session file
   |         `-- SVC,SHA1  (Each bootstrap is kept in its own file)
   |
   +-- idpuid/       Local user ID (local login name) to SHA1 mapping
   |    |
   |    +-- JOE/  Local user has directory whose name is the login uid
   |    |    |
   |    |    +-- .pw       User's local password
   |    |    +-- .yk       User's yubikey shared aes128 secret in hex
   |    |    +-- .ykspent/ Cache of already used One TIme Passwords
   |    |    |    |
   |    |    |    `-- OTP  File name is the spent Yubikey ticket (w/o uid)
   |    |    |    
   |    |    +-- .bs/      Directory of bootstraps to be included
   |    |    |    |
   |    |    |    +-- .at         Attributes to be included in each SSO
   |    |    |    `-- SVC,SHA1    Bootstrap for a service
   |    |    |
   |    |    +-- .di/     Directory of discovery registrations for user
   |    |    |    |
   |    |    |    `-- SVC,SHA1    Discovery asso registration for a service
   |    |    |
   |    |    `-- SP,SHA1/  One directory for each SP user is federated with
   |    |         |
   |    |         +-- .mni        Federated name id to be used with this SP
   |    |         +-- .at         Attributes to be included for this SP
   |    |         `-- SVC,SHA1    Bootstrap to be included for this SP
   |    |
   |    `-- .all/ Template used for all users
   |         |
   |         +-- .bs/      Directory of default bootstraps to be included
   |         |    |
   |         |    +-- .at         Attributes to be included in each SSO
   |         |    `-- SVC,SHA1    Bootstrap for a service
   |         |
   |         +-- .di/      Directory of default discovery registrations for all
   |         |    |
   |         |    `-- SVC,SHA1    Generic Discovery asso registration
   |         |
   |         `-- SP,SHA1/  One directory for each SP
   |              |
   |              +-- .at         Attributes to be included for this SP
   |              `-- SVC,SHA1    Bootstrap to be included for this SP
   |
   +-- idpnid/       Index of federated NameIDs, to map to uid
   |    |
   |    `-- SVC,SHA1    Bootstrap to be included for this SP
   |         |
   |         `-- NID    Content of the file is uid
   |
   +-- idpdimd/         Discovery Metadata registrations
   |    |
   |    `-- SVC,SHA1    Discovery MD registration for a service (an EPR)
   |
   `-- idplog/       Log files, pid files, and the like

zxpasswd(8) is a user provisioning tool that allows creation of new accounts as well as manipulation of .pw and .yk files.

2.1.1 Attaching Attributes to Assertions

When generating a SSO assertion, the attributes are collected as follows:

  1. LDIF at /var/zxid/idpuid/JOE/.bs/.at

  2. LDIF at /var/zxid/idpuid/JOE/SP,SHA/.at

  3. LDIF at /var/zxid/idpuid/.all/.bs/.at

  4. LDIF at /var/zxid/idpuid/.all/SP,SHA/.at

As of version 0.33 (20090904) the attributes are rendered singlevalued. If multiple occurrances of an attribute happen, the first instance is used and others ignored. However, in a future version, we expect to support multivalued attributes.

2.1.2 Attaching Bootstrap Attributes to Assertions

The bootstrap attributes (ID-WSF 2.0 EPRs with credentials) are attached to the SSO assertions to facilitate frontend web sites making backend web services calls.

The bootstraps are generated by scanning /var/zxid/idpuid/JOE/.bs directory and for each corresponding file looking up the service EPR in the /var/zxid/idpdimd directory. If metadata for the service is found there, an access credential for accessing the service is generated (unless disallowed by the configuration). The access credential is based on existing federation, or if that is lacking and auto federation is allowed, on newly generated (IdP unilateral) federation.

Future versions (as of 2009) may allow more granular approach to the bootstraps generated, but the strategic direction is to technically enable communications automatically and then to rely on explicit authorization services (XACML PDP) to make a policy based decision about what is allowed to happen.

After user's .bs directory, the global /var/zxid/idpuid/.all/.bs is scanned. This allows common bootstraps, such as discovery, that occur for all users to be specified only once at the .all level, while additional bootstraps can be added for the individual users.

N.B. As of 0.41 (20091120), the .di directories are unused. In case of discovery, all matching entries in /var/zxid/idpdimd will be considered and federations automatically created, irrespective of user's .di or .all/.di.

2.1.3 Yubikey Authentication Support

Yubikey support works by using the initial part of the ticket (passed in as user field) as uid and the latter as the ticket proper. The uid part is used to locate correct directory. Mapping from yubikey modhex to real UID is done by creating a symlink. The AES128 shared (between yubikey token and IdP) key is kept in the .yk file. As this is not a password has, but rather directly the shared secret, it requires rigorous approach to the filesystem security. The fact that .pw and .yk are separate files caters for the possibility of user authenticating either by yubikey or by password. By default yubikey is one factor authentication (in fairly secure and very convenient form). If two factor authentication is desired, the password component should be prefixed to the UID component, i.e. first user types PIN and then presses yubikey to add UID and ticket.

To program yubikeys with the shared secrets, you need ykpersonalize(8) tool, available from Yubico as open source.

2.1.4 Client Certificate Authetication of the User

TLS Client Certificate authentication of users has not been implemented yet, but in any case would be mainly implemented by configuration of web server to request such certificate and verify it. By the time zxid gets called, the client cert authentication will already have happened. HTTP Basic authentication works in similar way and we make no attempt to cater for it, although it can be used of configured separately (in the traditional way).

2.2 Installing zxididp

First you need to obtain zxididp either by downloading a binary package (and installing it) or by compiling from source. See zxid-install.pd for further details.

2.2.1 Configuring CGI Script in Web Server

zxididp(8) is a CGI script (written in C) that you can install under any web server that supports CGI scripts (e.g. Apache httpd, IIS, or mini_httpd). You must configure your web server to execute zxididp(8) as a CGI script. The specifics vary from web server to web server - consult your server documentation.

For Apache this would mean in httpd.conf a stanza like

  <Location "/zxididp">
  Options All
  SetHandler cgi-script
  </Location>

You would then copy the zxididp binary to the root of your document tree and make sure it is executable. See apache.pd for full scoop.

For mini_httpd this could mean something like

  mini_httpd -p 8443 -c zxididp -S -E zxid.pem

For IIS this could mean something like

2.2.2 Creating Directory Hirearchy

You must choose location for the configuration and logging hierachy of the zxididp(8) and then populate it. See earlier section in this document for details. By default the hierarchy will live in /var/zxid and the directories will have prefix "idp".

  /var/zxid/
   |
   +-- idpzxid.conf  Main configuration file
   +-- idppem/       Our certificates
   +-- idpcot/       Metadata of CoT partners (metadata cache)
   +-- idpses/       Sessions
   +-- idpuid/       Local user ID (local login name) to SHA1 mapping
   +-- idpnid/       Index of federated NameIDs, to map to uid
   +-- idpdimd/      Discovery Metadata registrations
   `-- idplog/       Log files, pid files, and the lik

You can create this hierarchy by running

  make dir ZXID_PATH=/var/zxid/idp

2.3 Adding Service Providers to Circle of Trust (CoT) of zxididp

See zxid-cot.pd for full scoop.

If Auto-CoT is enabled, and SP and IdP can communicate over the internet (n.b. problems with DNS, firewalls, other party not supporting WKL, etc.), the Service Providers can join the CoT automatically upon first use.

Otherwise, metadata exchange may need to be arranged manually using zxcot(8) tool. Typically you would receive sp-metadata.xml by mail from the SP administrator, or by instant messaging file transfer. You could even fetch it yourself using a web browser, saving the metadata page. Metadata is a XML blob.

  zxcot -a /var/zxid/idpcot <sp-metadata.xml
  zxcot -g https://site.com/meta.xml /var/zxid/idpcot  # Assumes connectivity
  zxcot /var/zxid/idpcot     # Lists the SPs in the CoT

When all else fails, you can just manipulate the filesystem manually, creating the necessary files and directories.

2.3.1 Sending zxididp Metadata to SP

If SP and IdP can communicate over the internet (n.b. problems with DNS, firewalls, other party not supporting WKL, etc.), the Service Providers can just request the zxididp metadata on the fly, based on Well Known Location (WKL).

The EntityID and WKL of the zxididp(8) are of the form:

  https://you.com/zxididp?o=B

where the "o=B" part is the ZXID general way of triggering metadata response.

If you need to perform the metadata exchange manually, your best bet is to download the metadata with your web browser (see WKL above) and send it to the other party.

2.4 Configuring users into zxididp

User provisioning and administration: Currently all this is manual and commandline or filesystem based. Contribution in form of fancy user self provisioning web GUIs would be appreciated by the zxid.org project.

Generally you should be able to administer the users using zxpasswd(8), but when all else fails, you can just manipulate the filesystem manually, creating the necessary files and directories.

2.4.1 Adding New User

Adding a new user consist of creating a directory corresponding to the user ID under /var/zxid/idpuid hierarchy. Typically this directory will contain the .pw file for password authentication and possibly a .yk file for Yubikey authentication. The directory will also contain .bs/.at file for specifying user's attributes.

Easiest way to create a new user is using -c option:

  zxpasswd -c user /var/zxid/idpuid <passwd

2.4.2 Setting or Changing Password

  zxpasswd user /var/zxid/idpuid <newpasswd

N.B. By default the password is stored as MD5 hash. Use -h X command line option to choose other hashing algorithm.

2.4.3 Adding Yubikey Authentication

Yubikeys are One Time Password (OTP) hardware tokens that connect to the USB port and act as keyboard emulators. They are sold by yubico.com

  zxpasswd -h y -s user yubikeyalias /var/zxid/idpuid <yk_aes128_secret

N.B. To program a Yubikey and agree to a AES 128 bit shared secret, you need ykpersonalize program, available from Yubico.

2.4.4 Adding Attributes to User

There is no command line interface for adding the attributes currently (20091120). You simply have to edit the UID/.bs/.at, UID/SP,SHA1/.at,

 .all/.bs/.at, or .all/SP,SHA1/.at files. The files are in (relaxed) LDIF

format. E.g.

  dn: cn=Koerkki,o=Labra
  permisRole: teacher
  cn: Koerkki
  o: Labra

N.B.: The LDIF format is essentially an attribute name separated from an attribute value by colon and one space, and name-value pairs separated from each other by a newline. This is very similar to mail header format. The "dn:" line is required in LDIF, but can be omitted in zxididp .at files.

If you want to add a complex binary or XML attribute, such as a x509v3 attribute certificate or a SAML assertion, we recommend that you safebase64 [RFC3548] encode the attribute value to prevent it from being mangled by SP SSO processing. To unravel such safebase64 encoding you can use in mod_auth_saml, or other zxid based SP, the INMAP specification with rule as unsb64-inf or unsb64. See zxid-conf.pd, section "INMAP specification", for further information.

The attributes from all the available sources are accumulated.

2.5 Configuring Bootstraps and Discovery

N.B. Before this step you should check that the SAML metadata of the WSP is registered at the IdP, see zxcot -a, etc. Or make sure the auto cot feature is enabled.

The principal step in configuring bootstraps and discovery is to register service's EPR in /var/zxid/idpdimd directory. This can usually be done on command line as follows:

  zxcot -e http://sp.tas3.pt/mysvc?o=S 'My Service' \
     http://sp.tas3.pt/mysvc?o=B urn:x-mysvc \
     | zxcot -b /var/zxid/idpdimd

Or if we analyze by parts

  zxcot -e SOAP-Endpoint Description EntityID ServiceType > epr.xml

This invocation is a mere utility for generating an EPR, without credential, that can be used as the registration. This might look like

  <wsa:EndpointReference notOnOrAfter="2037-01-05T23:03:59.001Z"
       wsu:Id="EPRID92lFPo3ZNEt_3rHtJFoU"
       xmlns:wsa="http://www.w3.org/2005/08/addressing"
       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <wsa:Address>http://sp.tas3.pt/mysvc?o=S</wsa:Address>
    <wsa:Metadata>
      <di:Abstract xmlns:di="urn:liberty:disco:2006-08">My Service</di:Abstract>
      <di:ProviderID xmlns:di="urn:liberty:disco:2006-08">http://sp.tas3.pt/mysvc?o=B</di:ProviderID>
      <di:ServiceType xmlns:di="urn:liberty:disco:2006-08">urn:x-mysvc</di:ServiceType>
      <sbf:Framework version="2.0" xmlns:sbf="urn:liberty:sb" />
    </wsa:Metadata>
  </wsa:EndpointReference>

The next step is to provide this as "discovery metadata":

  zxcot -b /var/zxid/idpdimd < epr.xml

which will create an entry in the /var/zxid/idpdimd directory (n.b. specifying the directory explicitly is necessary because the default directory corresponds to the SP directory layout, now we want the IdP directory).

Once the service's EPR (Metadata) exists in the system, any user can discover the service, with federations being created automatically (unless disabled in the configuration, see MD_FETCH and MD_POPULATE_CACHE config options).

If you want the service to be included as a bootstrap, you need to mention it either in global /var/zxid/idpuid/.all/.bs directory or in user's .bs directory. The file in .bs directory has to have the same name as in /var/zxid/idpdimd directory. Contents of the file do not matter. You can either touch(1) the file in existence or supply -bs flag to zxcot(1):

  zxcot -bs /var/zxid/idpdimd < epr.xml

This registers the bootstrap under .all user.

When all else fails, you can just manipulate the filesystem manually, creating the necessary files and directories.

2.5.1 Creating Discovery Bootstrap

By far the most common type of bootstrap is a a discovery bootstrap:

  zxcot -e http://idp.tas3.pt:8081/zxididp?o=S 'Discovery Svc' \
    http://idp.tas3.pt:8081/zxididp?o=B urn:liberty:disco:2006-08 \
    | zxcot -bs /var/zxid/idpdimd

2.5.2 Bootstrap Recursiveness

A problem that arises with the bootstraps is the support for recursive or multilevel web service calls. The called service, which receives the bootstrap credential, may legitimately call other services in turn. If it receives the discovery bootstrap as part of its own credential (which may have been a bootstrap in its own right), then it can go and discover further services. The discovery bootstrap does not have to contain any further bootstraps because the discovery service itself knowns about the other services even without receiving a bootstrap for each of them individually.

Now consider attempting to operate without discovery: service bootstraps for first level services need to contain the bootstraps for second level services, which needs to contain bootstraps for third level services. There is no easy way to know how many levels deep the call structure may be. This effectively leads to infinite recursion in bootstrap generation.

Clearly we need some criteria to cap it. In lack of good and logical criteria, we adopt arbitrary one: all bootstraps, except discovery, will only propagate one level, i.e. they will be supplied in SSO assertion, but only the discovery bootstrap will be supplied in the further token assertions.


Fig-1: Recursive bootstrap generation call graph

2.6 Supported Specifications

As of version 0.47 (20100114) zxididp supports the following specifications

2.6.1 Imminently Planned Specifications (TODO)

2.6.2 Nice to Have Specifications (TBD)

3 License

Copyright (c) 2009-2010 Sampo Kellomäki (sampo@iki.fi), All Rights Reserved. Copyright (c) 2006-2009 Symlabs (symlabs@symlabs.com), All Rights Reserved. Author: Sampo Kellomäki (sampo@iki.fi)

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

References

[SAML11core]
SAML 1.1 Core, OASIS, 2003
[SAML11bind]
"Bindings and Profiles for the OASIS Security Assertion Markup Language (SAML) V1.1", Oasis Standard, 2.9.2003, oasis-sstc-saml-bindings-1.1
[IDFF12]
http://www.projectliberty.org/resources/specifications.php
[IDFF12meta]
Peted Davis, Ed., "Liberty Metadata Description and Discovery Specification", version 1.1, Liberty Alliance Project, 2004. (liberty-metadata-v1.1.pdf)
[SAML2core]
"Assertions and Protocols for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-core-2.0-os
[SAML2prof]
"Profiles for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-profiles-2.0-os
[SAML2bind]
"Bindings for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-bindings-2.0-os
[SAML2context]
"Authentication Context for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-authn-context-2.0-os
[SAML2meta]
Cantor, Moreh, Phipott, Maler, eds., "Metadata for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-metadata-2.0-os
[SAML2security]
"Security and Privacy Considerations for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-sec-consider-2.0-os
[SAML2conf]
"Conformance Requirements for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-conformance-2.0-os
[SAML2glossary]
"Glossary for the OASIS Security Assertion Markup Language (SAML) V2.0", Oasis Standard, 15.3.2005, saml-glossary-2.0-os
[XML-C14N]
XML Canonicalization (non-exclusive), http://www.w3.org/TR/2001/REC-xml-c14n-20010315; J. Boyer: "Canonical XML Version 1.0", W3C Recommendation, 15.3.2001, http://www.w3.org/TR/xml-c14n, RFC3076
[XML-EXC-C14N]
Exclusive XML Canonicalization, http://www.w3.org/TR/xml-exc-c14n/
[Shibboleth]
http://shibboleth.internet2.edu/shibboleth-documents.html
[Hardt09]
Dick Hardt and Yaron Goland: "Simple Web Token (SWT)", Version 0.9.5.1, Microsoft, Nov. 4, 2009 (SWT-v0.9.5.1.pdf)
[Tom09]
Allen Tom, et al.: "OAuth Web Resource Authorization Profiles (OAuth WRAP)", Version 0.9.7.2, Google, Microsoft, and Yahoo, Nov. 5, 2009 (WRAP-v0.9.7.2.pdf)
[XMLENC]
"XML Encryption Syntax and Processing", W3C Recommendation, 10.12.2002, http://www.w3.org/TR/xmlenc-core
[XMLDSIG]
"XML-Signature Syntax and Processing", W3C Recommendation, 12.2.2002, http://www.w3.org/TR/xmldsig-core, RFC3275
[Disco2]
Liberty ID-WSF Discovery service 2.0
[Disco12]
Liberty ID-WSF Discovery service 1.1 (liberty-idwsf-disco-svc-v1.2.pdf)
[SecMech2]
Liberty ID-WSF 2.0 Security Mechanisms
[SOAPAuthn2]
Liberty ID-WSF 2.0 Authentication Service
[SOAPBinding2]
Liberty ID-WSF 2.0 framework document that pulls together all aspects
[DST21]
Liberty Data Services Template 2.1
[DST20]
Liberty DST v2.0
[DST11]
Liberty DST v1.1
[IDDAP]
Liberty Identity based Directory Access Protocol
[IDPP]
Liberty Personal Profile specification.
[Interact11]
Liberty ID-WSF Interaction Service protocol 1.1
[FF12]
Liberty ID Federation Framework 1.2, Protocols and Schemas
[SUBS2]
Liberty Subscriptions and Notifications specification
[Schema1-2]
Henry S. Thompson et al. (eds): XML Schema Part 1: Structures, 2nd Ed., WSC Recommendation, 28. Oct. 2004, http://www.w3.org/2002/XMLSchema
[XML]
http://www.w3.org/TR/REC-xml
[RFC1950]
P. Deutcsh, J-L. Gailly: "ZLIB Compressed Data Format Specification version 3.3", Aladdin Enterprises, Info-ZIP, May 1996
[RFC1951]
P. Deutcsh: "DEFLATE Compressed Data Format Specification version 1.3", Aladdin Enterprises, May 1996
[RFC1952]
P. Deutcsh: "GZIP file format specification version 4.3", Aladdin Enterprises, May 1996
[RFC2246]
TLSv1
[RFC2251]
LDAP
[RFC3548]
S. Josefsson, ed.: "The Base16, Base32, and Base64 Data Encodings", July 2003. (Section 4 describes Safebase64)
[MS-MWBF]
Microsoft Web Browser Federated Sign-On Protocol Specification, 20080207, http://msdn2.microsoft.com/en-us/library/cc236471.aspx