- Multi-factor installation guide (IdP and MfaProvider)
- Multi-factor installation guide
- https://git.rnp.br/GT-AMPTo/mfap-installation-guide
- Use this repository to perform the automated installation of the MFaP solution at the Identity Provider. The script will download codes from MFaProvider and MfaProviderIdp repositories
- MFaProvider
- https://git.rnp.br/GT-AMPTo/MfaProvider
- Application responsible for performing MFA authentication of users and which presents a dashboard for users to enable their authentication factors
- MFaP library for the IdP
- https://git.rnp.br/GT-AMPTo/mfadialogo
- Library to be invoked by the IdP's
AuthFlow
(in the.xml
file) and that will allow to interact with the MFaProvider
- Mobile applications specific for Phone Prompt
- https://git.rnp.br/GT-AMPTo/App2Ampto - Android version
- https://git.rnp.br/GT-AMPTo/amptoios - iOS version
- Required if you want to use the Phone Prompt as a second authentication factor
- IdP Shibboleth v3.3, Tomcat 8 and Apache 2 already installed.
Follow the next steps in order to configure Google Firebase Cloud Messaging (FCM):
- Create a Google Account for the institution (if you already have one, skip this step).
- Go to the FCM console page and log in with the account from the step 1.
- Click on
Add Project
. - Type a name for the project (ignore the other fields), check the "I Accept the terms.." option and then click on
Create Project
. - Click on the Android icon to add Firebase to the Android app, as the following image shows:
- Fill in the Android Package Name field:
br.edu.ifsc.sj.gtampto
and click onRegister APP
. - In the Download the configuration file step, click on
Next
. - In the Add Firebase SDK, click on
Next
. - In Run your app to verify installation, FCM will attempt to connect the app. As it is previously configured, this step can be skipped. So click on
Skip this step
- When you finish creating the FCM account and registering the app according to the instructions, click on settings as the following image shows:
- Click on
Project Configurations
and then in the Cloud Messaging tab. Take note of theLegacy server key
andSender ID
attribute values because they will be needed by the installation script.
In order for the IdP to be able to make requests to its address, it is necessary to adjust the /etc/hosts
configuration.
- Edit the
/etc/hosts
file:
sudo vi /etc/hosts
- Delete the line containing the
127.0.1.1
address. The edited file should look like the following:
127.0.0.1 localhost
#IP Address and Host
191.36.8.39 idpexemplo.idp.edu.br idpexemplo
- Restart the network service in order to apply the new configuration:
sudo systemctl restart networking.service
The MfaProvider communicates with the IdP through HTTPs requests, so the Java Virtual Machine (JVM) needs to trust the certificate. If the certificate is self-signed, it has to be imported to the JVM trust store with the following command:
<JAVA_HOME>/bin/keytool -import -alias <server_name> -keystore <JAVA_HOME>/jre/lib/security/cacerts -file public.crt
In case you don't know what certificate should be imported, run the following command to show the certificate file path:
cat /etc/apache2/sites-enabled/01-idp.conf | grep SSLCertificateFile
Assuming that your JAVA_HOME is /usr/lib/jvm/java-8-oracle and that the certificate to be imported is located at /etc/ssl/certs/server.crt, and that the server_name is idp.rnp.br, the command to import the certificate would be as follows:
/usr/lib/jvm/java-8-oracle/bin/keytool -import -alias idp.rnp.br -keystore /usr/lib/jvm/java-8-oracle/jre/lib/security/cacerts -file /etc/ssl/certs/server.crt
Attention: You will be prompted to provide the JVM keystore password. The default password, if it wasn't changed already, is (usually) changeit .
Every time the certificate changes, this procedure has to be repeated.
After you finish the import, restart the Tomcat: sudo systemctl restart tomcat8
Install MongoDB using the package manager:
sudo apt-get install mongodb
Obs: When the installation is finished, the MongoDB service will start automatically. You can check if it is running, execute the following command:
sudo systemctl status mongodb.service
(if it is not running, you can start it by runningsudo systemctl start mongodb
).
MfaProvider Installation and configuration
Obs: run all the commands as user root
- Clone the
mfap-installation-guide
project to the directory of your choice. For instance, your home dir.
git clone https://git.rnp.br/GT-AMPTo/mfap-installation-guide.git
Obs: If you run into certificate issues, you can run the following:
git -c http.sslVerify=false clone https://git.rnp.br/GT-AMPTo/mfap-installation-guide.git
- Enter the directory where you have cloned the repository and cd into
scripts
. This will be our working dir in the next steps.
cd scripts
There are two ways of proceeding with the installation, a basic and an advanced one.
- In the basic one, the script will prompt you for the values of the basic variables for a standard multi-factor installation.
- In the advanced one, you can change the default path for the MfaProvider (
idp.instituicao.edu.br/conta
) or any other value related to dir paths and the like.
In the scripts dir, run the install.py
script:
python2 install.py
The installation script will prompt you to define the following:
- Username and password for the database;
- Username and password for the REST endpoints;
- IdP address without the protocol part. Ex.:
idp.instituicao.edu.br
;
When you finish the installation, check the section Tests to verify if the application is running.
In the scripts dir, edit the config.ini
file like the following:
a) In case you want to change pathnames
:
-
Metadata filepath: change the attribute:
idp.metadata=/opt/shibboleth-idp/metadata/idp-metadata.xml
-
IdP base dir: change the attribute:
dir_base_idp_shibboleth=/opt/shibboleth-idp
-
Tomcat's server.xml filepath: change the attribute:
tomcat_server_config=/etc/tomcat8/server.xml
-
Configuration file of the IdP in Apache: change the attribute:
apache_conf_file=/etc/apache2/sites-enabled/01-idp.conf
b) In case you want to change the MfaProvider pathname:
- Pathname:
change the attribute
mfapbasepath=conta
Don't change the other attributes, the blank ones, because the installation script will prompt you to provide the information during the installation process.
Finally, in the scripts dir, run the install.py
script:
python2 install.py
When you finish the installation, check the section Tests to verify if the application is running.
The MfAProvider will be available at the configured address, ex: https://idp.instituicao.edu.br/conta
. Go to that address and log in to check the available help in the dashboard in order to configure and use a second factor.
Obs.: If when you access that address, you are warned about certificate issues like your connection is not private, this may indicates that you have a self-signed certificate and will have to execute the procedure described in the section Self-signed Certificate. This will prevent errors after the login.
When an update is available, you can update the MfaProvider using an available update script for that.
To do so, go to the directory where you have cloned the roteiro de instalação
(according to the installation guide MfaProvider Installation and configuration), and run the following:
python update_mfaprovider.py
The above script will update the MfaProvider, by downloading the source code from the git repository, building the package to deploy on Tomcat 8 server and restarting it.
In the /opt/mfaprovider
dir, run the following script, providing the user login that will have the second factor removed when prompted.
./removeSecondFactor.sh
After you run the installation script, you will have the MfaProvider source code available at scripts/MfaProvider
. Edit the file src/main/resource/factor.properties
and set to true
to enable or to false
to disable the factor you want to edit. After that, while you still are in the scripts/MfaProvider
dir, run the following to deploy the MfaProvider for the changes to take effect:
./deploy.sh