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 while installing this.
Shibbolized Tiqr is tested under the following environment.
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:
This document assumes they are installed based on the following document provided by GakuNin. If you installed them in a different way, consider modifying some of our procedures.
https://meatwiki.nii.ac.jp/confluence/pages/viewpage.action?pageId=20021624
To install depending packages, run the following command:
$ sudo yum -y install httpd php mod_ssl php-gd php-pdo php-mcrypt sqlite |
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 the source code from the repository.
$ svn co https://forge.gakunin.nii.ac.jp/anonsvn/tiqrshib/trunk tiqrshib |
It should contain two projects, "tiqrzend" and the IdP extension. Here we setup "tiqrzend" first.
After the procedure above, you can check the result with tree command:
$ tree --charset=ascii -L 2 /opt/tiqrzend/ /opt/tiqrzend/ |-- application | |-- Bootstrap.php | |-- configs | |-- controllers | |-- layouts | |-- modules | `-- views |-- library | |-- phpqrcode | |-- tiqr | |-- tiqrshib | |-- tiqr-zf | |-- zend -> ZendFramework-1.12.9-minimal | `-- ZendFramework-1.12.9-minimal |-- public | |-- images | |-- index.php | `-- scripts |-- resources | `-- Sample.php `-- tests |-- application |-- library `-- phpunit.xml 20 directories, 4 files |
Copy /opt/tiqrzend/application/configs/application.example.ini to /opt/tiqrzend/application/configs/application.ini.
$ cp /opt/tiqrzend/application/configs/application.example.ini /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:
Prepare DB for tiqrshib's "SecretStorage". For evaluation purpose, run the following commands:
$ mkdir -p /opt/tiqrzend/db/ $ sqlite3 /opt/tiqrzend/db/secrets.db sqlite> CREATE TABLE IF NOT EXISTS tiqrshibsecrets ( ...> `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT, ...> `uid` text NOT NULL UNIQUE, ...> `secret` text DEFAULT NULL, ...> `isActive` integer DEFAULT NULL); sqlite> (exit) $ sudo chown -R apache: /opt/tiqrzend/db |
Modify /etc/httpd/conf.d/ssl.conf (or whatever httpd config file you prefer) so httpd contain the following settings:
Alias /tiqr/ "/opt/tiqrzend/public/" <Location /tiqr> RewriteEngine On RewriteBase /tiqr RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$ /tiqr/index.php [NC,L] require all granted </Location> <Location /tiqr/shib/enroll/process> AuthType shibboleth ShibRequestSetting requireSession 1 require valid-user </Location> |
With the modifications above, tiqr authentication flow should be ready for evaluation.
Now try the following "enrollment" and "login" flow.
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.
There are multiple logs to be checked when there are some errors.
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 extenion there.
Here is how to install Apache Maven 3.5.0 in /opt/ directory.
$ export MVN_VERSION=3.5.0 $ wget http://ftp.riken.jp/net/apache/maven/maven-3/${MVN_VERSION}/binaries/apache-maven-${MVN_VERSION}-bin.tar.gz $ tar xf apache-maven-${MVN_VERSION}-bin.tar.gz -C /opt/ $ export PATH=/opt/apache-maven-${MVN_VERSION}/bin:$PATH $ mvn --version (Check Maven is installed) |
Under the "idp/" directory in this project, run the following commands:
$ ls pom.xml src $ mvn -DskipTests=false clean package ... (a lot of logs) ... [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.683 s [INFO] Finished at: 2017-09-05T16:41:39+09:00 [INFO] Final Memory: 24M/361M [INFO] ------------------------------------------------------------------------ $ ls pom.xml src target $ ls target/ classes maven-archiver tiqrshibauthn-2.0.jar |
Here, tiqrshibauthn-2.0.jar in target/ is what we want.
If you are outside the host where IdP resides, copy the jar file to the server.
From this step, we assume you logged in the host where IdP resides as root. You should also prepare IdP's installation package unpacked somewhere.
# pwd /root/shibboleth-identity-provider-3.3.1 |
Before going forward, we recommend to stop Tomcat.
# systemctl stop tomcat |
Place tiqrshibauthn-2.0.jar in IdP installer's webapp/WEB-INF/lib/ directory.
<servlet> <servlet-name>TiqrShibAuthnHandler</servlet-name> <servlet-class>jp.gakunin.tiqrshib.TiqrShibAuthnServlet</servlet-class> <load-on-startup>4</load-on-startup> </servlet> <servlet-mapping> <servlet-name>TiqrShibAuthnHandler</servlet-name> <url-pattern>/Authn/TiqrShib</url-pattern> </servlet-mapping> |
Install the modified IdP using bin/install.sh as usual IdP installation.
# bin/install.sh |
Depending on your Tomcat configuration, you may need to copy `idp.war` in `/usr/java/tomcat/webapps/` and remove `idp/` directory there.
# cp -f /opt/shibboleth-idp/war/idp.war /usr/java/tomcat/webapps/ # rm -rf /usr/java/tomcat/webapps/idp |
If you choose to run Tomcat under the user "tomcat", you may also need to review directory permissions in /opt/shibboleth-idp/ again.
# chown -R tomcat:tomcat /opt/shibboleth-idp/logs # chgrp -R tomcat /opt/shibboleth-idp/conf # chmod -R g+r /opt/shibboleth-idp/conf # find /opt/shibboleth-idp/conf -type d -exec chmod -R g+s {} \; # chgrp tomcat /opt/shibboleth-idp/metadata # chmod g+w /opt/shibboleth-idp/metadata # chmod +t /opt/shibboleth-idp/metadata |
Move to `/opt/shibboleth-idp/` and modify relevant configuration files.
# cd /opt/shibboleth-idp |
Create `flows/authn/tiqrshib/` directory and copy some relevante 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:
# mkdir flows/authn/tiqrshib/ # cp system/flows/authn/external-authn-flow.xml flows/authn/tiqrshib/tiqrshib-flow.xml # sed -i 's/external-authn-beans\.xml/tiqrshib-beans.xml/' flows/authn/tiqrshib/tiqrshib-flow.xml # cp system/flows/authn/external-authn-beans.xml flows/authn/tiqrshib/tiqrshib-beans.xml # sed -i 's/external-authn-config\.xml/tiqrshib-authn-config.xml/' flows/authn/tiqrshib/tiqrshib-beans.xml # cp dist/conf/authn/external-authn-config.xml.dist conf/authn/tiqrshib-authn-config.xml # sed -i 's/Authn\/External/Authn\/TiqrShib/' conf/authn/tiqrshib-authn-config.xml |
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`.
<bean id="authn/tiqrshib" parent="shibboleth.AuthenticationFlow" p:nonBrowserSupported="false"> <property name="supportedPrincipals"> <list> <bean parent="shibboleth.SAML2AuthnContextClassRef" c:classRef="urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorUnregistered" /> </list> </property> </bean> |
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"
idp.authn.flows=Password|tiqrshib |
Finally, start Tomcat.
# systemctl start tomcat |
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.
<Location /shibtiqr_protected> AuthType shibboleth ShibRequestSetting requireSession 1 ShibRequestSetting authnContextClassRef urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorUnregistered Require valid-user </Location> |
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.
Change secrets shared between tiqrzend and the IdP extention.
Note that the modification requires recreating jar file and IdP re-installation.
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 officitial 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.