If you are using TiqrShib version 2.0, we strongly recommend you update it to 2.1 or later.
Following document instructs how to install Shibbolized Tiqr (or "tiqrshib") in the IdP environment. Please feel free to contact us (tiqr at meatmail.jp) if you have any difficulty during installation.
This instruction is for Shibbolized Tiqr 2.2. Shibbolized Tiqr is tested under the following environment.
- CentOS 7.5
- httpd 2.4
- PHP 5.4
- Oracle JDK 1.8
- Apache Maven 3.2
- Tomcat 9.0
- Shibboleth IdP 3.4.0
- Shibboleth SP 3.0
This document assumes Shibboleth IdP and SP are configured and ready for SAML SSO; IdP should be able to authenticate users per SP's authn request, and supply users' attributes back to SP appropriately. Some attributes must be supplied to SP because Shibbolized Tiqr implicitly requires them:
- ePPN (eduPersonPrincipalName)
This document assumes they are installed based on the following document provided by GakuNin. If you installed them in a different way, modify the procedure below as your system requires.
Install Dependent Yum Packages
To install depending packages, run the following command:
Here, sqlite is installed as our sample configuration requires it. If you want to use MySQL for the backend DB, consider installing "mysql-connector-odbc" and "php-mysql" instead.
Checkout Source Code for Shibbolized Tiqr
Checkout the source code from the repository.
It should contain two projects, "tiqrzend" and the Shibboleth IdP extension.
Deploy "tiqrzend" server
Here we setup "tiqrzend" first.
- Extract all the content in "tiqrzend" package under /opt/tiqrzend/.
- Download phpqrcode 1.1.4 and unarchive under /opt/tiqrzend/library/phpqrcode/: http://phpqrcode.sourceforge.net/
- Make /opt/tiqrzend/application/logs writable from your httpd.
After the procedure above, you can check the result with tree command:
Copy /opt/tiqrzend/application/configs/application.example.ini to /opt/tiqrzend/application/configs/application.ini.
The sample configuration file should contain detailed instructions for each setting. It is recommended to read it through and modify the setting as your organization requires.
At the very least, you probably need to configure two settings show below:
- resources.tiqrshib.eppnScope must be exactly same as idp.scope setting in Shibboleth IdP's idp.properties (/opt/shibboleth-idp/conf/idp.properties)
- resources.tiqr.identifier should contain your organization identifier
Prepare DB for tiqrshib's "SecretStorage". For evaluation purpose, run the following commands:
Modify /etc/httpd/conf.d/ssl.conf (or whatever httpd config file you prefer) so httpd contain the following settings:
Confirm "tiqrzend" is Working
With the modifications above, tiqr authentication flow should be ready for evaluation.
Now try the following "enrollment" and "login" flow.
- Enrollment flow
- Visit https://(your host name)/tiqr/shib/enroll
- Check if a QR code is shown to the screen
- Scan the QR code using Tiqr mobile application, and enter a 4-digit PIN code
- You should be able to register the service via the mobile app.
- Login flow
- After the enrollment, visit https://(your host name)/tiqr/shib/login
- You will see another QR code
- Scan the QR code with the Tiqr mobile app
- You are asked to enter the 4-digit PIN code that you entered in the enrollment flow
- If you enter the correct PIN, Tiqr mobile app ask you if you are ok with the login.
- After you approve the login, the message "Login is successful" will be shown to the mobile app.
- You will see HTTP 404 or similar error messages that happens because IdP is not ready yet.
- At this step you can at least check enrollment and login in tiqr side is successful.
Note that web interface will show some error message at the last step. At this point it is expected. The tiqrzend's login interface is intended for IdP integration, and without IdP, it cannot correctly redirect back to the IdP.
What you should check here is if the redirect happens at this point. If the redirect does not happen and some other problem happens, you will need to trouble-shoot it here.
Checking "tiqrzend" Log
There are multiple logs to be checked when there are some errors.
- httpd's logs in /var/log/httpd
- PHP's logs in syslog or whatever you configured at /etc/php.ini
- tiqrzend's logs /opt/tiqrzend/application/logs/
Deploy the Shibboleth IdP extension
Build the Extension
Building the IdP extension requires Apache Maven. You can build the extension outside where IdP resides, but you need the same Java environment to build the extension there.
Here is how to install Apache Maven 3.5.0 in /opt/ directory.
Under the "idp/" directory in this project, run the following commands:
tiqrshibauthn-2.x.jar in target/ is what we want.
If you are outside the host where IdP resides, copy the jar file to the server.
Install the Extension into Shibboleth IdP
From this step, we assume you logged in the host where IdP resides as root.
Before going forward, we recommend to stop Tomcat.
Place tiqrshibauthn-2.x.jar in
Add the following XML content in `/opt/shibboleth-idp/edit-webapp/WEB-INF/web.xml`. If you don't have the web.xml file, copy from `/opt/shibboleth-idp/webapp/WEB-INF/web.xml` in advance.
Rebuild the modified IdP WAR package using bin/build.sh.
Depending on your Tomcat configuration, you may need to copy `idp.war` in `$CATALINA_BASE/webapps/` and remove `idp/` directory there.
Also depending on your Tomcat version, you may need to remove temporary files.
Configure IdP for the Extension
Move to `/opt/shibboleth-idp/` and modify relevant configuration files.
Create `flows/authn/tiqrshib/` directory and copy some relevant XML files. Then edit copied files so they become ready for tiqrshib authentication.
You can use the following sequence of sed commands if original XML are untouched:
All the procedures above are case-sensitive. Distinguish between "authn/tiqrshib" and "Authn/TiqrShib".
Add the following XML content in `conf/authn/general-authn.xml`.
You probably want to modify `classRef` settings, depending on what authnContext you want to use for the tiqrshib authn.
Modify `conf/idp.properties` so `idp.authn.flows` contain "tiqrshib"
Context element in `$CATALINA_BASE/conf/Catalina/localhost/idp.xml` in order to be able to check JSESSIONID in PHP side. E.g.:
Finally, start Tomcat.
Make Shibboleth SP Rely on Shibbolized Tiqr
Modify SP so that it requests the authnContext you specified in general-authn.xml on certain path.
Here's an example of httpd configuration on a Shibboleth SP server, assuming it is already under a same federation with the IdP.
Now that you confirmed Shibbolized Tiqr works on your server, we recommend reviewing your tiqrshib settings. Check your application.ini and review your settings. If you copied it from application.example.ini, you will see prenty of comments that describe each configuration and some recommendations.
In this section, we'll describe some of most important aspects of possible configurations.
Encryption Key and IV
Change secrets shared between tiqrzend and the IdP extension.
- On tiqrzend side, modify resources.tiqrshib.encryption.key and resources.tiqrshib.encryption.iv.
- On the extension side, modify AES_KEY and AES_IV in TiqrShibConstants.java in the IdP extension.
Note that the modification requires recreating jar file and IdP package re-build.
Metadata for Tiqr Server
Tiqr mobile application will show users basic information about the Tiqr server. The information is provided from Tiqr server on enrollment process. You probably want to change it before production use.
Check the following three settings.
Consult to the official document (https://tiqr.org/tiqr-simplesaml-integration-guide) for more information.
When SQLite3 is used, all the secret for users will be stored in local storange.
You may want some redundancy or possibly more performance, in which case consider using MySQL instead of SQLite3. There are descriptions in the example config how to achieve it.