<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Howto &#8211; privacyID3A</title>
	<atom:link href="https://www.privacyidea.org/category/howto/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.privacyidea.org</link>
	<description>flexible, Open Source Multi Factor Authentication (2FA)</description>
	<lastBuildDate>Wed, 11 Mar 2026 07:01:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.5</generator>

<image>
	<url>https://www.privacyidea.org/wp-content/uploads/2016/06/cropped-only-logo-white-background-32x32.png</url>
	<title>Howto &#8211; privacyID3A</title>
	<link>https://www.privacyidea.org</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Online Webinars in March</title>
		<link>https://www.privacyidea.org/online-webinars-in-march/</link>
		
		<dc:creator><![CDATA[Isabelle Mühlhausen]]></dc:creator>
		<pubDate>Wed, 11 Mar 2026 06:27:16 +0000</pubDate>
				<category><![CDATA[events]]></category>
		<category><![CDATA[Howto]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=2417</guid>

					<description><![CDATA[In March, we continue our webinar series about privacyIDEA. Therefore, we invite you to attend the following online webinars: “privacyIDEA as a replacement for DUO and Okta” on March 12 and “Management of SSH Keys with privacyIDEA” on March 24. In these free online events, we will show you how you can use privacyIDEA to [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>In March, we continue our webinar series about privacyIDEA.</p>



<p>Therefore, we invite you to attend the following online webinars:</p>



<p><strong>“privacyIDEA as a replacement for DUO and Okta” on March 12</strong> and <strong>“Management of SSH Keys with privacyIDEA” on March 24.</strong></p>



<p>In these free online events, we will show you how you can use privacyIDEA to design your authentication processes flexibly, securely, and independently.<br><br>In addition, <strong>Cornelius Kölbel</strong>, Founder of privacyIDEA with <strong>more than 25 years of experience</strong> in the field of multi-factor authentication, will answer your questions.</p>



<p>Take advantage of this opportunity to gain new insights for your authentication project and get answers to your questions!</p>



<p><strong>Dates &amp; Time</strong></p>



<ul id="wpforms-19653-field_11" class="wp-block-list">
<li>privacyIDEA as a Replacement for DUO and Okta (12.03.2026, 5:00 pm – 5:45 pm CET)</li>



<li>SSH Key Management with privacyIDEA (24.03.2026, 5:00 pm – 5:45 pm CET)</li>
</ul>



<p><strong>Secure your spot and learn more about MFA with privacyIDEA</strong>!</p>



<p><strong>Registration via:</strong> <a href="https://netknights.it/en/privacyidea-webinar-anmeldung/">https://netknights.it/en/privacyidea-webinar-anmeldung/</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Online Webinars in February 2026</title>
		<link>https://www.privacyidea.org/online-webinars-in-february-2026/</link>
		
		<dc:creator><![CDATA[Isabelle Mühlhausen]]></dc:creator>
		<pubDate>Sat, 31 Jan 2026 05:58:30 +0000</pubDate>
				<category><![CDATA[events]]></category>
		<category><![CDATA[Howto]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=2409</guid>

					<description><![CDATA[Learn more about MFA with privacyIDEA in our free webinars in February 2026.
]]></description>
										<content:encoded><![CDATA[
<p>We would like to give you the opportunity to learn more about multi-factor authentication with <strong>privacyIDEA</strong> and its many possible applications.</p>



<p>Therefore, we invite you to attend our free online webinars:</p>



<p><strong>“Central MFA with privacyIDEA” on February 10</strong> and <strong>&#8220;privacyIDEA Basics&#8221; on February 26.</strong></p>



<p>In these free online events, we will show you how you can use privacyIDEA to design your authentication processes flexibly, securely, and independently.<br><br>In addition, <strong>Cornelius Kölbel</strong>, Founder of privacyIDEA with <strong>more than 20 years of experience</strong> in the field of multi-factor authentication, will answer your questions.</p>



<p>Take advantage of this opportunity to gain new insights for your authentication project and get answers to your questions!</p>



<p><strong>Dates &amp; Time</strong></p>



<ul id="wpforms-19653-field_11" class="wp-block-list">
<li>Central MFA with privacyIDEA (10.02.2026, 5:00 pm &#8211; 5:45 pm CET)<br></li>



<li>privacyIDEA Basics (26.02.2026, 5:00 pm &#8211; 5:45 pm CET)<br></li>
</ul>



<p><strong>Secure your spot and learn more about MFA with privacyIDEA</strong>!</p>



<p><strong>Registration via:</strong> <a href="https://netknights.it/en/privacyidea-webinar-anmeldung/">https://netknights.it/en/privacyidea-webinar-anmeldung/</a></p>



<p></p>



<figure class="wp-block-image size-large"><a href="https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1.png"><img fetchpriority="high" decoding="async" width="1024" height="667" src="https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1-1024x667.png" alt="" class="wp-image-2411" srcset="https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1-1024x667.png 1024w, https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1-300x195.png 300w, https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1-768x500.png 768w, https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1-1536x1000.png 1536w, https://www.privacyidea.org/wp-content/uploads/2026/01/Webinars-February-1-2048x1333.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Online Webinars in August: Central MFA with privacyIDEA</title>
		<link>https://www.privacyidea.org/online-webinars-in-august-central-mfa-with-privacyidea/</link>
		
		<dc:creator><![CDATA[Isabelle Mühlhausen]]></dc:creator>
		<pubDate>Tue, 12 Aug 2025 11:02:11 +0000</pubDate>
				<category><![CDATA[events]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Whatsup]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=2381</guid>

					<description><![CDATA[We would like to give you the opportunity to learn more about multi-factor authentication with privacyIDEA and its many possible applications. Therefore, we invite you to attend our free online events “Central MFA with privacyIDEA” on August 19 or 28 and “privacyIDEA – Your replacement for DUO and OKTA” on September 16. In these free [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>We would like to give you the opportunity to learn more about multi-factor authentication with privacyIDEA and its many possible applications.<br></p>



<p>Therefore, we invite you to attend our free online events </p>



<p><strong>“Central MFA with privacyIDEA” on August 19 or 28 and “privacyIDEA – Your replacement for DUO and OKTA” on September 16.</strong></p>



<p>In these free online events, we will show you how you can use privacyIDEA to design your authentication processes flexibly, securely, and independently.<br><br>In addition, <strong>Cornelius Kölbel</strong>, CEO of NetKnights with <strong>more than 15 years of experience</strong> in the field of multi-factor authentication, will personally answer your questions.</p>



<p>Take advantage of this opportunity to gain new insights for your authentication project and get answers to your questions!</p>



<p><strong>Dates &amp; Time</strong><br></p>



<p>19 August, Central MFA with privacyIDEA, 3 pm-3:45 pm Central European Time</p>



<p>28 August, Central MFA with privacyIDEA, 7pm-7:45 pm Central European Time</p>



<p>16 September, privacyIDEA – Your replacement for DUO and OKTA, 7 pm-7:45 pm Central European Time</p>



<p><strong>Secure your free spot and learn more about MFA with privacyIDEA</strong>!<br></p>



<p><strong>Registration via:</strong> <a href="https://netknights.it/privacyidea-webinar-registration">https://netknights.it/privacyidea-webinar-registration</a></p>



<p>We look forward to your participation. If you have any further questions about the webinars, do not hesitate to contact us via <a href="&#x6d;a&#x69;&#108;&#x74;&#x6f;:&#x6d;&#97;&#x72;&#x6b;e&#x74;&#105;&#x6e;&#x67;&#64;&#x6e;&#101;&#x74;&#x6b;n&#x69;&#103;&#x68;&#x74;s&#x2e;&#105;&#x74;">m&#97;&#114;&#107;&#x65;&#x74;&#x69;ng&#64;&#110;&#x65;&#x74;&#x6b;&#x6e;ig&#104;&#116;&#x73;&#x2e;&#x69;&#x74;</a></p>



<figure class="wp-block-image size-large"><a href="https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2.png"><img decoding="async" width="1024" height="667" src="https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2-1024x667.png" alt="" class="wp-image-2382" srcset="https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2-1024x667.png 1024w, https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2-300x195.png 300w, https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2-768x500.png 768w, https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2-1536x1000.png 1536w, https://www.privacyidea.org/wp-content/uploads/2025/08/Webinar-Ankundigung-3060-x-1992-px2-2048x1333.png 2048w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Enroll a Yubikey as PIV smartcard</title>
		<link>https://www.privacyidea.org/enroll-a-yubikey-as-piv-smartcard/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Mon, 28 Dec 2020 10:35:08 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[smartcards]]></category>
		<category><![CDATA[Yubikey]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=2235</guid>

					<description><![CDATA[privacyIDEA supports enrollment of PIV smartcards. A from the scratch howto to enroll x509 certificates on Yubikeys.]]></description>
										<content:encoded><![CDATA[
<p>In this blog post we will show, how you can enroll a Yubikey as a PIV smartcard. privacyIDEA will issue the certificate request sent by the Yubikey but at the same time require an attestation certificate. This way privacyIDEA will assure, that the key pair indeed has been generated on the smartcard.</p>



<figure class="wp-block-image size-large"><img decoding="async" width="1000" height="469" src="https://www.privacyidea.org/wp-content/uploads/2020/12/enroll-yubikey.jpg" alt="" class="wp-image-2238" srcset="https://www.privacyidea.org/wp-content/uploads/2020/12/enroll-yubikey.jpg 1000w, https://www.privacyidea.org/wp-content/uploads/2020/12/enroll-yubikey-300x141.jpg 300w, https://www.privacyidea.org/wp-content/uploads/2020/12/enroll-yubikey-768x360.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>You could then use the Yubikey with the x509 certificate to login to you desktop, sign or decrypt emails. These application examples are not topic of this blog post and might be covered in later posts.</p>



<p>You will need a Yubikey 5 and a <a href="https://www.privacyidea.org/multi-factor-authentication-privacyidea-3-5-released/" data-type="post" data-id="2223">privacyIDEA installation with version 3.5</a>. We also assume in this example, that you are running Linux on your desktop.</p>



<h2 class="wp-block-heading">Setup CA in privacyIDEA</h2>



<p>First we have to setup a certificate authority (CA), that will sign the certificate signing request (CSR) generated by the Yubikey. privacyIDEA currently only supports local openssl based CAs. This could however be a sub CA to your existing enterprise CA. In this example, we create a new root CA.</p>



<p><strong>Note: You need read access to pi.cfg and write access to /etc/privacyidea/ca</strong></p>



<pre class="wp-block-code"><code># pi-manage ca create -t local myLocalCA</code></pre>



<p>This pi-manage command will create the CA files and also the CA configuration within privacyIDEA. You are asked a couple of questions and answer them accordingly:</p>



<pre class="wp-block-code"><code># pi-manage  ca create -t local  myLocalCA

             _                    _______  _______
   ___  ____(_)  _____ _______ __/  _/ _ \/ __/ _ |
  / _ \/ __/ / |/ / _ `/ __/ // // // // / _// __ |
 / .__/_/ /_/|___/\_,_/\__/\_, /___/____/___/_/ |_|
/_/                       /___/

Creating CA connector of type local.
In which directory do you want to create the CA &#91;./ca]: /etc/privacyidea/ca
What should be the keysize of the CA (2048/4096/8192)&#91;4096]: 
How many days should the CA be valid &#91;1800]: 
What is the DN of the CA &#91;/CN=myLocalCA]: 
How many days should the CRL be valid &#91;30]: 
What should be the overlap period of the CRL in days &#91;5]: 
============================================================

        Directory  : /etc/privacyidea/ca
        CA DN      : /CN=myLocalCA
        CA Keysize : 4096
        CA Validity: 1800

        Validity of issued certificates: 365

        CRL validity: 30
        CRL overlap : 5

Is this configuration correct? &#91;y/n] y</code></pre>



<p>You also need to fix the access to the directory</p>



<pre class="wp-block-code"><code>chown privacyidea -R /etc/privacyidea/ca</code></pre>



<p>and create a file <code>/etc/privacyidea/ca/templates.yaml</code> with the contents:</p>



<pre class="wp-block-code"><code>user:
    extenstions: "user"
    days: 365</code></pre>



<p>which will ensure, that the certificate will created as a user certificate with a validity period of 365 days.</p>



<p>You need to do some minor fixtues:</p>



<pre class="wp-block-code"><code>cd /etc/privacyidea/ca
openssl rand -writerand .rnd 
touch index.txt.attr 
chown privacyidea .rnd index.txt.attr</code></pre>



<p>For simplicity comment out two lines (crlDistributionPoints and authorityInformationAccess) in the section &#8220;user&#8221; in the file /etc/privacyidea/ca/openssl.cnf</p>



<pre class="wp-block-code"><code>&#91; user ]
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
basicConstraints = CA:FALSE
subjectKeyIdentifier=hash
authorityKeyIdentifier=keyid,issuer:always
#crlDistributionPoints = @crl_dp_policy
#authorityInfoAccess = caIssuers;URI:http://www.example.com/yourCA.crt</code></pre>



<p>As a last step, go to the Web UI in Config->CA and add the &#8220;Certificate template file&#8221; <code>/etc/privacyidea/ca/templates.yaml</code>.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="673" height="692" src="https://www.privacyidea.org/wp-content/uploads/2020/12/ca-templates.png" alt="" class="wp-image-2240" srcset="https://www.privacyidea.org/wp-content/uploads/2020/12/ca-templates.png 673w, https://www.privacyidea.org/wp-content/uploads/2020/12/ca-templates-292x300.png 292w" sizes="auto, (max-width: 673px) 100vw, 673px" /></figure>



<p>Now your CA is ready to go.</p>



<h2 class="wp-block-heading">Setup PIV trusted certificates</h2>



<p>The attestation certificate verifies that the private key was generated on the Yubikey. You can tell privacyIDEA, which attestation certificates should be trusted. Here we will use the Yubikey, so we need to fetch the <a href="https://developers.yubico.com/yubico-piv-tool/Attestation.html" target="_blank" rel="noreferrer noopener">Yubico PIV CA from their web site</a>.</p>



<pre class="wp-block-code"><code>mkdir /etc/privacyidea/attestation    
wget https://developers.yubico.com/PIV/Introduction/piv-attestation-ca.pem \
     -O /etc/privacyidea/attestation/yubico.pem</code></pre>



<p>The PIV Root CA has signed the attestation CA, that is contained on each Yubikey. We need to retrieve this from the Yubikey. Do do so insert a Yubikey and run the following command:</p>



<pre class="wp-block-code"><code>yubico-piv-tool --action=read-certificate \ 
      --slot=f9 >> /etc/privacyidea/attestation/yubico.pem</code></pre>



<p>The certificate we read from the Yubikey from slot f9 is the attestation CA, that was signed by the Yubico CA. The attestation CA will sign the attestation certificate, that testifies, that the CSR was created on the yubikey. The file yubico.pem now contains the certificate chain of the PIV Root CA and the Attestation CA.</p>



<p><strong>Note: With new production charges Yubico might put a new attestation CA on the yubikeys. So if you buy 100 yubikeys, they will most probably have the same attestation CA, but if you buy another 100 yubikeys several month later, they might have another attestation CA, so you need to repeat this step and put the new certificate chain in a second file.</strong></p>



<h2 class="wp-block-heading">Configure privacyIDEA policies</h2>



<p>privacyIDEA can already enroll x509 certificates. But to ensure, that it will only enroll certificates from CSRs, that are created on the Yubikey, we need to define a new policy, which is available starting with privacyIDEA 3.5.</p>



<p>We create a policy to require an attestation certificate</p>



<pre class="wp-block-code"><code>scope: enrollment
action: certificate_require_attestation=require_and_verify</code></pre>



<p>In this example we will have the administrator enroll yubikeys, so we set an admin policy, that specifies, where the trusted CA chains can be found:</p>



<pre class="wp-block-code"><code>scope: admin
action: certificate_trusted_Attestation_CA_path=/etc/privacyidea/attestation/</code></pre>



<h2 class="wp-block-heading">Enroll certificate</h2>



<p>Now the admin needs to pass the CSR and in addition an attestation certificate, if he wants to have the CSR signed and receive a certificate. The admin could do this manually with the yubico own tools and using the privacyIDEA REST API. </p>



<p>However, in this example we use the <em>privacyidea admin client</em>, which can be <a href="https://github.com/privacyidea/privacyideaadm" target="_blank" rel="noreferrer noopener">found at github</a>.</p>



<p><strong>Note: You can run the command line client on any other computer, it does not need to be your privacyIDEA server.</strong></p>



<p>In this case we are running it on an Ubuntu Linux desktop.</p>



<p>Prepare dependencies:</p>



<pre class="wp-block-code"><code>sudo apt-add-repository ppa:yubico/stable
sudo apt update
sudo apt install yubikey-manager
sudo apt install ykcs11</code></pre>



<p>Create a virtualenv:</p>



<pre class="wp-block-code"><code>virtualenv -p /usr/bin/python3 piv-test</code></pre>



<p>Enter the environment:</p>



<pre class="wp-block-code"><code>source piv-test/bin/activate</code></pre>



<p>Install the privacyidea admin client:</p>



<pre class="wp-block-code"><code>git clone https://github.com/privacyidea/privacyideaadm
cd privacyideaadm
pip install .</code></pre>



<p>Now you can use the current development branch of the admin client in your virtualenv.</p>



<p><strong>Note: You need to have enough hardware access rights, otherwise you might get errors like &#8221; Failed to transmit with protocol T1. Reader is unavailable&#8221;</strong></p>



<p>If necessary, you can reset the PIV data on your yubikey:</p>



<pre class="wp-block-code"><code>ykman piv reset</code></pre>



<p>Now you can enroll the yubikey certificate:</p>



<pre class="wp-block-code"><code>privacyidea-enroll-yubikey-piv init-cert -s cornelius -u cornelius \
     -U https://localhost -a super -p test -c myLocalCA -n -P 123456</code></pre>



<p>This will create a CSR on the Yubikey, with the subject &#8220;CN=cornelius&#8221; and access the Yubikey with the PIN &#8220;123456&#8221;. The CSR and the attestation certificate will be sent to privacyIDEA at &#8220;https://localhost&#8221;, the admin will authenticate as user &#8220;super&#8221; with the password &#8220;test&#8221; and enroll the certificate to the user &#8220;cornelius&#8221;. privacyIDEA will verify the attestation certificate, sign the CSR and the certificate will be imported to the Yubikey.</p>



<p><strong>Note: If you have problems enrolling and try to reenroll, you might need to delete temporary files _*.</strong></p>



<p>You can now use the Yubikey with the certificate on it to sign emails or login to your Desktop. As mentioned, this can be a topic for future blog posts.</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p>We showed here how an administrator can enroll a Yubikey with an x509 certificate to a user. At the same time privacyIDEA ensures, that the private key is really generated on the Yubikey. This is an important aspect, when using smartcards for authentication. This ensures, that the private key is unique and can not be copied, neither during the enrollment process nor lateron, making the smartcard a unique authentication factor.</p>



<p>The same way, a user could issue a CSR that was generated on a smartcard to privacyIDEA, making the enrollment process more robust.</p>



<p>This is an important fist step for privacyIDEA to deal with smartcards. We will continue working on  smartcard functionalities, smoothening the workflow and enhancing policies.</p>



<p>In an enterprise environment managing x509 certificates and smartcards on a central location is crucial. The Yubikey could contain several certificates. It can contain Webauthn profiles or HOTP slots. If a Yubikey is lost, the service desk should be able to revoke the one hardware key and the central management should know, which certificates and which HOTP slots are affected. With privacyIDEA we are working on this, to ease the life of administrators and service desk users.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Event-based logging with privacyIDEA and Logstash</title>
		<link>https://www.privacyidea.org/event-based-logging-with-privacyidea-and-logstash/</link>
					<comments>https://www.privacyidea.org/event-based-logging-with-privacyidea-and-logstash/#comments</comments>
		
		<dc:creator><![CDATA[Henning Hollermann]]></dc:creator>
		<pubDate>Sun, 05 Apr 2020 23:17:25 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Event Handler]]></category>
		<category><![CDATA[Logging]]></category>
		<category><![CDATA[logstash]]></category>
		<category><![CDATA[privacyIDEA]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1900</guid>

					<description><![CDATA[Keeping track of the system logs in a complex environment with many hosts and even more services can be challenging. 
A sophisticated logging system with aggregation and filtering capabilities helps the administrator to stay ahead of things. 
This article shows how to integrate privacyIDEA in the centralized logging system provided by the elastic stack]]></description>
										<content:encoded><![CDATA[
<p>Keeping track of the system logs in a complex environment with many hosts and even more services can be challenging. A sophisticated logging system with aggregation and filtering capabilities helps the administrator to stay ahead of things. Popular examples are <a href="https://www.splunk.com/">Splunk</a> and <a href="https://www.elastic.co/logstash">Logstash</a>. Both are intrinsically supported by privacyIDEA, since the software builds on the standard python logging library. This article shows how to integrate privacyIDEA in the centralized logging system provided by the elastic stack which consists of the software components Logstash, Elasticsearch and Kibana.</p>



<p>We will use the privacyIDEA logging facility to let the server not only store its system logs and audit locally but also feed them to a remote Logstash server. We will also show how to use the new Logging module of the Event Handler, introduced in privacyIDEA 3.3, to customize the logged information. The usual path of information is displayed in the following picture.</p>



<figure class="wp-block-image alignwide size-large"><img loading="lazy" decoding="async" width="1024" height="163" src="https://www.privacyidea.org/wp-content/uploads/2020/03/privacyIDEA-ELK_2000-1024x163.png" alt="" class="wp-image-1904" srcset="https://www.privacyidea.org/wp-content/uploads/2020/03/privacyIDEA-ELK_2000-1024x163.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/03/privacyIDEA-ELK_2000-300x48.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/03/privacyIDEA-ELK_2000-768x122.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/03/privacyIDEA-ELK_2000-1536x245.png 1536w, https://www.privacyidea.org/wp-content/uploads/2020/03/privacyIDEA-ELK_2000.png 1997w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h3 class="wp-block-heading">Setup the Base System</h3>



<p>As the installation Logstash, Elasticsearch and Kibana is documented at the <a href="https://www.elastic.co/guide/en/elastic-stack/current/installing-elastic-stack.html">vendors website</a>, we will not go into detail here. In any case, you need a java runtime environment. For Ubuntu you can use the package <code>default-jre</code>. Once you have the elastic stack up and running, turn towards privacyIDEA.</p>



<p>The installation of privacyIDEA is documented at <a href="https://privacyidea.readthedocs.io/en/latest/">privacyidea.readthedocs.io</a>. For a quick start, there is a community package repository for Ubuntu 18.04 LTS available. Install the privacyIDEA server and become a little familiar to the WebUI, which is the primary management interface.</p>



<p>The base configuration of privacyIDEA is set in the <a href="https://privacyidea.readthedocs.io/en/latest/installation/system/inifile.html">configuration file <code>pi.cfg</code></a> and the dedicated <a href="https://privacyidea.readthedocs.io/en/latest/installation/system/logging.html#advanced-logging">logging configuration file <code>logging.cfg</code> or <code>logging.yml</code></a>. In the default Ubuntu 18.04 package installation, those are located in /etc/privacyidea/. To be able to view the audit logs in the WebUI and send them at the same time to the python logger, the <a href="https://privacyidea.readthedocs.io/en/latest/audit/#container-audit">ContainerAudit</a> module is used.</p>



<pre class="wp-block-preformatted has-small-font-size"># /etc/privacyidea/pi.cfg
PI_AUDIT_MODULE = 'privacyidea.lib.auditmodules.containeraudit'
PI_AUDIT_CONTAINER_WRITE = ['privacyidea.lib.auditmodules.sqlaudit','privacyidea.lib.auditmodules.loggeraudit']
PI_AUDIT_CONTAINER_READ = 'privacyidea.lib.auditmodules.sqlaudit'
PI_AUDIT_LOGGER_QUALNAME = 'pi-audit'
PI_LOGCONFIG = '/etc/privacyidea/logging.cfg'</pre>



<p>Note that we use a custom audit logger name &#8220;pi-audit&#8221; in the above configuration. See the documentation of the <a href="https://privacyidea.readthedocs.io/en/latest/audit/index.html#logger-audit">Logger Audit</a>.</p>



<h3 class="wp-block-heading">Send privacyIDEA logs to Logstash</h3>



<p>The logging module <code>privacyidea.lib.auditmodules.loggeraudit</code> sends the audit messages to the python logging system and makes it available to the configuration by <code>logging.yml</code>. To send both the privacyIDEA server logs and the audit log to Logstash, the <a href="https://github.com/eht16/python-logstash-async">module <code>python-logstash-async</code></a> comes in handy. It can be installed through pip by</p>



<pre class="wp-block-preformatted has-small-font-size">~$ pip install python-logstash-async</pre>



<p>The module can be used in a <code>logging.cfg</code> or <code>logging.yml</code> in YAML and INI format respectively. <a href="https://gist.github.com/laclaro/a9ba8b6f1f1ed8f9de23d1383f71666c">Minimal examples for the configuration of the logstash-async module</a> are found on Github Gist. A <a href="https://gist.github.com/laclaro/6cbd3f51bba0041d5307569644a575fc">more detailed YAML configuration file</a> is also available, which provides a good basis for this test case.</p>



<p>Restart privacyidea for the changes to have effect. If you used the extended configuration from gist, you should now see the audit log in /var/log/privacyidea/audit.log.</p>



<h3 class="wp-block-heading">Receive privacyIDEA logs with Logstash</h3>



<p>On the other end, Logstash is configured to listen on port 5959 and to forward the logs to Elasticsearch using different indices for the qualnames pi-audit, pi-eventlog and all the rest (privacyidea.*).</p>



<pre class="wp-block-preformatted has-small-font-size"># /etc/logstash/conf.d/privacyidea_elasticsearch.conf
# privacyIDEA input is logged by the python-logstash-async module
input {
   tcp {
      port =&gt; 5959
      codec =&gt; json
      tags =&gt; ["privacyidea"]
   }
}
# filter adds metadata field according to logger to
# separate the privacyIDEA audit log from the rest
filter {
   if [extra][logger_name] == "pi-audit" or [extra][logger_name] == "privacyidea.lib.auditmodules.loggeraudit" {
      mutate { add_field =&gt; { "[@metadata][indexPrefix]" =&gt; "pi-audit" } }
   } else if [extra][logger_name] == "pi-eventlog" {
      mutate { add_field =&gt; { "[@metadata][indexPrefix]" =&gt; "pi-eventlog" } }
   } else {
      mutate { add_field =&gt; { "[@metadata][indexPrefix]" =&gt; "privacyidea" } }
   }
}
# Logs are sent to elasticsearch using the indexPrefix
output {
   elasticsearch {
      index =&gt; "%{[@metadata][indexPrefix]}-%{+YYYY.MM.dd}"
   }
   # additional output to syslog
   stdout {
      codec =&gt; rubydebug
   }
}</pre>



<p>Restart logstash afterwards. The output section contains an additional part for logging to stdout. On a systemd-driven system (check <code>~$ ps -p 1</code>), it can be viewed by</p>



<pre class="wp-block-preformatted has-small-font-size">~# journalctl -f -u logstash</pre>



<p>Once you interact with the privacyIDEA server, you should see the incoming audit log messages in json format in the journalctl ountput on the logstash machine. The example below is the audit message for viewing the audit log in the privacyIDEA WebUI:</p>



<pre class="wp-block-preformatted has-small-font-size">{
          "extra" =&gt; {
                    "logger_name" =&gt; "pi-audit",
                   "process_name" =&gt; "MainProcess",
                    "thread_name" =&gt; "MainThread",
                           "line" =&gt; 85,
         "logstash_async_version" =&gt; "1.6.4",
                           "path" =&gt; "/opt/privacyidea/privacyidea/lib/auditmodules/loggeraudit.py",
                      "func_name" =&gt; "finalize_log",
                    "interpreter" =&gt; "/opt/privacyidea/venv/bin/python",
            "interpreter_version" =&gt; "3.6.9"
     },
          "level" =&gt; "INFO",
        "program" =&gt; "/opt/privacyidea/pi-manage",
           "port" =&gt; 47962,
            "pid" =&gt; 10047,
      "logsource" =&gt; "myhost",
     "@timestamp" =&gt; 2020-03-25T15:32:42.748Z,
       "@version" =&gt; "1",
           "type" =&gt; "python-logstash",
        "message" =&gt; "{'success': True, 'serial': '<strong>', 'user': '</strong>', 'realm': '**', 'resolver': '', 'token_type': '', 'client': '127.0.0.1', 'client_user_agent': 'firefox', 'privacyidea_server': 'localhost:5000', 'action': 'GET /audit/', 'action_detail': '', 'info': '', 'administrator': 'admin', 'policies': '', 'timestamp': datetime.datetime(2020, 3, 25, 15, 32, 42, 748526)}",
           "host" =&gt; "henning-t470"
 }</pre>



<h3 class="wp-block-heading">Display privacyIDEA logs with Kibana</h3>



<p>The logs received by Logstash are sent to Elasticsearch which talks to the Kibana instance. The Elasticsearch indices should appear in Kibana&#8217;s index management, available from the home screen.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" width="273" height="154" src="https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-index-patterns-button-1.png" alt="" class="wp-image-1917" style="width:205px;height:116px"/></figure>



<p>The privacyIDEA indices will look like shown below.</p>


<div class="wp-block-image is-style-default">
<figure class="aligncenter size-large is-resized"><a href="https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-indices.png"><img loading="lazy" decoding="async" width="1024" height="437" src="https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-indices-1024x437.png" alt="" class="wp-image-1911" style="width:768px;height:328px" srcset="https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-indices-1024x437.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-indices-300x128.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-indices-768x328.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/03/kibana-indices.png 1082w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure></div>


<p>Note: the yellow health status is due to a default index setting <code>"index.number_of_replicas": "1"</code>. Changing it to zero will result in a green status. Under &#8220;Data Views&#8221; create a new data view with the index-pattern &#8220;privacyidea*,pi-audit-*,pi-event*&#8221;.</p>



<figure class="wp-block-gallery alignwide has-nested-images columns-default wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex">
<figure class="wp-block-image size-full"><a href="https://www.privacyidea.org/wp-content/uploads/2024/11/Create-Data-View.png"><img loading="lazy" decoding="async" width="816" height="568" data-id="2362" src="https://www.privacyidea.org/wp-content/uploads/2024/11/Create-Data-View.png" alt="" class="wp-image-2362" srcset="https://www.privacyidea.org/wp-content/uploads/2024/11/Create-Data-View.png 816w, https://www.privacyidea.org/wp-content/uploads/2024/11/Create-Data-View-300x209.png 300w, https://www.privacyidea.org/wp-content/uploads/2024/11/Create-Data-View-768x535.png 768w" sizes="auto, (max-width: 816px) 100vw, 816px" /></a></figure>



<figure class="wp-block-image size-large"><a href="https://www.privacyidea.org/wp-content/uploads/2024/11/Logs_View.png"><img loading="lazy" decoding="async" width="1024" height="498" data-id="2363" src="https://www.privacyidea.org/wp-content/uploads/2024/11/Logs_View-1024x498.png" alt="" class="wp-image-2363" srcset="https://www.privacyidea.org/wp-content/uploads/2024/11/Logs_View-1024x498.png 1024w, https://www.privacyidea.org/wp-content/uploads/2024/11/Logs_View-300x146.png 300w, https://www.privacyidea.org/wp-content/uploads/2024/11/Logs_View-768x374.png 768w, https://www.privacyidea.org/wp-content/uploads/2024/11/Logs_View.png 1042w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>
</figure>



<p>In the Logs view, select the privacyIDEA data view you can select the log columns (&#8220;selected fields&#8221;) to be shown. The privacyIDEA log messages are now nicely display<em>ed.</em></p>



<figure class="wp-block-image alignwide size-large"><a href="https://www.privacyidea.org/wp-content/uploads/2024/11/Bild3.png"><img loading="lazy" decoding="async" width="1024" height="498" src="https://www.privacyidea.org/wp-content/uploads/2024/11/Bild3-1024x498.png" alt="" class="wp-image-2364" srcset="https://www.privacyidea.org/wp-content/uploads/2024/11/Bild3-1024x498.png 1024w, https://www.privacyidea.org/wp-content/uploads/2024/11/Bild3-300x146.png 300w, https://www.privacyidea.org/wp-content/uploads/2024/11/Bild3-768x374.png 768w, https://www.privacyidea.org/wp-content/uploads/2024/11/Bild3.png 1042w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>



<p>Don&#8217;t forget to save!</p>



<h3 class="wp-block-heading">Event-based logging from privacyIDEA to Logstash</h3>



<p>New in <a href="https://www.privacyidea.org/privacyidea-3-3-with-webauthn/">privacyIDEA 3.3</a> is the Event Handler module &#8220;Logging&#8221;. With this module, custom logging messages can be bound to any event. This opens the door to a whole new world of monitoring possibilities in privacyIDEA. To demonstrate the feature, we simply log whenever a token is disabled &#8212; a silly example, of course. The Event Handler is created as shown below.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large is-resized"><a href="https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification4.png"><img loading="lazy" decoding="async" width="930" height="942" src="https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification4.png" alt="" class="wp-image-1928" style="width:698px;height:707px" srcset="https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification4.png 930w, https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification4-296x300.png 296w, https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification4-768x778.png 768w" sizes="auto, (max-width: 930px) 100vw, 930px" /></a></figure></div>


<p>For the Logging module, only one action is available. The log level, the name of the logger and a custom message are required. The message field supports variables known from the user notification module (see <a href="https://privacyidea.readthedocs.io/en/latest/eventhandler/logginghandler.html">documentation</a>). Note, that it depends on the context of the RESTful API event if a certain variable is available or not. </p>



<p>The chosen logger name has to be added as a logger in <code>logging.yml</code> to send it to Logstash.</p>



<pre class="wp-block-preformatted has-small-font-size">loggers:
  pi-eventlog:
    handlers:
      - logfile
      - logstash_async
    level: DEBUG</pre>



<p>Restart privacyIDEA to apply the changes in the config file <code>logging.yml</code>. After triggering the event by disabling a token in privacyIDEA, Kibana shows the notification.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="25" src="https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification3-1024x25.png" alt="" class="wp-image-1927" srcset="https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification3-1024x25.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification3-300x7.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification3-768x18.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/03/LoggingNotification3.png 1081w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Of course, you can use the logging event handler for more reasonable purposes like not to send the full audit log to logstash but to single-out the important validate-check events. You can even apply some more conditions, if you like making use of the powerful condition properties of the privacyIDEA Event Handlers. This not only spares bandwidth and storage space but prevents important information to be buried by other data. The message field in privacyIDEA can be used for a custom log message with contextual information. The configurable logger name (e.g. <em>pi-validate-check</em>) provides an additional identifier. In the case of suspicious behavior or a security incident, all the information is there to quickly track down the threat.</p>



<h3 class="wp-block-heading">Conclusion</h3>



<p>With this demonstration of the logging facility, privacyIDEA proves again to be extraordinarily scalable. It integrates well with logging systems like Logstash and Splunk since the privacyIDEA server builds on the standard python logging library. For Logstash, this article showed the detailed steps how to integrate privacyIDEA via the loggeraudit and a small third-party python module called <em>python-logstash-async</em>.</p>



<p>In privacyIDEA 3.3 the logging capabilities have been further extended by an Event Handler module which enables to conditionally log arbitrary events to the python logging system. We showed that also these messages can easily be passed to Logstash and open a vast playground custom logging.</p>



<p>The solution shown here is only one possible approach. Since privacyIDEA is available as open source an licensed under the AGPL, another possibility would be of course to write your very own logger module to do whatever <em>you</em> want. privacyIDEA is and will be always open source and therefore it will <em>always stay</em> in <em>your</em> hands.</p>



<p>If you would like to have a custom logger module, but have no time to  implement it yourself, you can always request a quote from <a href="https://netknights.it/en/">Netknights</a>, the company which drives the privacyIDEA innovation via <a href="https://github.com/privacyidea/">Github</a>. They also provide professional support for privacyIDEA, including enterprise repositories for Ubuntu and CentOS/RHEL containing the server and a number of additional components and tools.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/event-based-logging-with-privacyidea-and-logstash/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Versatile 2FA Single Sign-On with Keycloak and privacyIDEA</title>
		<link>https://www.privacyidea.org/versatile-2fa-single-sign-on-with-keycloak-and-privacyidea/</link>
					<comments>https://www.privacyidea.org/versatile-2fa-single-sign-on-with-keycloak-and-privacyidea/#comments</comments>
		
		<dc:creator><![CDATA[Henning Hollermann]]></dc:creator>
		<pubDate>Tue, 24 Mar 2020 17:53:00 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[2FA]]></category>
		<category><![CDATA[Integration]]></category>
		<category><![CDATA[keycloak]]></category>
		<category><![CDATA[kolab]]></category>
		<category><![CDATA[OpenID Connect]]></category>
		<category><![CDATA[privacyIDEA]]></category>
		<category><![CDATA[Roundcubemail]]></category>
		<category><![CDATA[SSO]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1772</guid>

					<description><![CDATA[The integration of privacyIDEA with Keycloak to provide a solid basis to secure your applications with a second factor in a single sign-on (SSO) environment. For maximum flexibility, the system relies on standard protocols such as SAML or OpenID Connect (OIDC). This article shows exemplarily the integration of Keykcloak, privacyIDEA and Kolab.]]></description>
										<content:encoded><![CDATA[
<p>In a <a href="https://netknights.it/en/single-sign-on-with-privacyidea/">previous article</a>, we wrote about benefits and risks of single sign-on (SSO) in enterprise environments and how a solid 2-factor-authentication solution as provided by privacyIDEA helps reduce risks. In this article we will demonstrate how to setup a SSO system with <a href="https://www.keycloak.org/">Keycloak</a> and <a href="https://netknights.it/en/produkte/privacyidea/">privacyIDEA</a>. As an example application we integrate the <a href="https://kolabsystems.com/">Kolab Groupware Server</a> and setup the Roundcubemail webmailer to authenticate with OpenID Connect (OIDC) and a second factor managed by privacyIDEA. Other popular collaboration platforms such as <a href="https://www.tine20.com/en/">Tine 2.0</a> or <a href="https://www.open-xchange.com/">Open-Xchange</a> and many other applications will also work with Keycloak and privacyIDEA as long as they support at least one standard SSO protocol.</p>



<div class="wp-block-image is-style-default"><figure class="aligncenter size-large is-resized"><img decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/03/network-987x1024.png" alt="" class="wp-image-1932" width="600" srcset="https://www.privacyidea.org/wp-content/uploads/2020/03/network-987x1024.png 987w, https://www.privacyidea.org/wp-content/uploads/2020/03/network-289x300.png 289w, https://www.privacyidea.org/wp-content/uploads/2020/03/network-768x797.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/03/network.png 1100w" sizes="(max-width: 987px) 100vw, 987px" /></figure></div>



<p>First, we setup three machines with Ubuntu Server 18.04 and provide similar /etc/hosts files to each of them. For a proper setup, Kolab requires a fully qualified domain name. We choose <code>kolab.netknights.it</code>.</p>



<pre class="wp-block-preformatted has-small-font-size">127.0.0.1      localhost
127.0.1.1      kolab
192.168.56.200 kolab.netknights.it    kolab
192.168.56.201 pi.netknights.it       pi
192.168.56.202 keycloak.netknights.it keycloak</pre>



<p>To put the system into action, one would have to configure DNS and NAT  properly so that the server is reachable from the internet. DNS record  of type A, AAAA and MX are crucial to do this. You may read about this  requirement in the Kolab docs &#8220;<a href="https://docs.kolab.org/installation-guide/preparing-the-system.html">preparing the system</a>&#8220;. For this proof of concept we will not use any logical volumes nor discuss firewall setups or SSL transport layer security.</p>



<p>After updating the initial Ubuntu Server systems, we install privacyIDEA, Keycloak and Kolab following their general installing instructions. We start with Kolab, since in this scenario, we would like to attach the ds-389 LDAP directory delivered by Kolab to our backend, i.e. Keycloak and privacyIDEA.</p>



<h3 class="wp-block-heading">Kolab 16 Installation</h3>



<p>The primary OS supported by Kolab is CentOS, which is also supported by privacyIDEA. However, there are also Kolab and privacyIDEA packages available for Ubuntu 18.04. We will use these for our setup. The install instructions can be found at <a href="https://docs.kolab.org/installation-guide/ubuntu-18.04.html">docs.kolab.org</a>. We summarize them here for convenience</p>



<pre class="wp-block-preformatted has-small-font-size"># Add repositories for apt to /etc/sources/ 
~$ echo 'deb http://obs.kolabsys.com/repositories/Kolab:/16/Ubuntu_18.04/ ./ deb-src http://obs.kolabsys.com/repositories/Kolab:/16/Ubuntu_18.04/ ./' \ 
| tee /etc/apt/sources.list.d/kolab.list 
# Add signing key 
~$ wget -q -O- https://ssl.kolabsys.com/community.asc | apt-key add - 
~$ echo -e 'Package: *\nPin: origin obs.kolabsys.com\nPin-Priority: 501' \ 
| tee /etc/apt/preferences.d/kolab 
~$ apt-get update
~$ apt-get install kolab</pre>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/01-install-kolab-terminal-1.png" alt="" class="wp-image-1784" width="733" height="194" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/01-install-kolab-terminal-1.png 733w, https://www.privacyidea.org/wp-content/uploads/2020/02/01-install-kolab-terminal-1-300x79.png 300w" sizes="auto, (max-width: 733px) 100vw, 733px" /></figure></div>



<p>We let the postfix SMTP service be configured as &#8220;Internet with smarthost&#8221;. Outbound email will be relayed to another (trusted) mail server, e.g. the one of your ISP. Inbound mail will reach postfix on port 25 if your DNS records are configured correctly. After installation the configuration script is called via</p>



<pre class="wp-block-preformatted has-small-font-size">~$ setup-kolab</pre>



<p>It will ask for some information and several passwords. The password for the directory manager will be used to first login, so remember it. Also passwords for a the cyrus-imapd administrator, a kolab-service user, the mysql database root user and several database passwords are needed. Note, that all of them are stored in the /etc/kolab/kolab.conf file and only very few are needed for interactive logins.</p>



<p>Kolab comes without a predefined admin user. Only the directory admin is defined which should not be used for user administration. So we login as &#8220;cn=Directory Manager&#8221; and define a new admin user. In our default setup, the UID is generated from the surname (check the &#8220;System&#8221; tab), so we choose <code>kolab-admin</code> to differentiate from <code>pi-admin</code> and <code>keycloak-admin</code> later.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/03-kolab-webadmin-login-ssl.png" alt="" class="wp-image-1786" width="524" height="361" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/03-kolab-webadmin-login-ssl.png 627w, https://www.privacyidea.org/wp-content/uploads/2020/02/03-kolab-webadmin-login-ssl-300x207.png 300w" sizes="auto, (max-width: 524px) 100vw, 524px" /></figure></div>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-add-user-1.png" alt="" class="wp-image-1788" width="534" height="513" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-add-user-1.png 534w, https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-add-user-1-300x288.png 300w" sizes="auto, (max-width: 534px) 100vw, 534px" /></figure></div>



<p>On the System tab we set the predefined <code>kolab-admin</code> role for the user to grant him access for user management. Also set a password.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-add-user-2.png" alt="" class="wp-image-1789" width="529" height="390" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-add-user-2.png 529w, https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-add-user-2-300x221.png 300w" sizes="auto, (max-width: 529px) 100vw, 529px" /></figure></div>



<p>Hit submit to complete the process. Next add another ordinary user to test the second factor login later on. We call this user <code>test-user</code>.</p>



<h3 class="wp-block-heading">privacyIDEA 3.x Installation</h3>



<p>Now, we setup privacyIDEA. Install instructions for the most recent version can be found at <a href="https://privacyidea.readthedocs.io/en/latest/">readthedocs.privacyidea.io</a>. We install the <a href="https://privacyidea.readthedocs.io/en/latest/installation/ubuntu.html#installing-privacyidea-3-0-or-higher">official Ubuntu packages</a>, specifically the <code>privacyidea-apache2</code> package. The installation only takes few minutes. After creating the admin user, here called <code>pi-admin</code>, with</p>



<pre class="wp-block-preformatted has-small-font-size">~$ pi-manage admin add pi-admin -e pi-admin@localhost</pre>



<p>we login to the UI. privacyIDEA needs to access the LDAP directory provided by Kolab, so we create an LDAP resolver and use the Kolab service account created above via &#8220;Config-&gt;Users-&gt;New ldapresolver&#8221;. The dn and password for the kolab-service account can be checked in the file /etc/kolab/kolab.conf. We use the OpenLDAP preset given by privacyIDEA but change the UID type to &#8220;dn&#8221;. The resolver test buttons help to avoid typos and to check the connection. For the test, we leave TLS to be configured later.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ldap-resolver-2-829x1024.png" alt="" class="wp-image-1794" width="829" height="1024" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ldap-resolver-2-829x1024.png 829w, https://www.privacyidea.org/wp-content/uploads/2020/02/ldap-resolver-2-243x300.png 243w, https://www.privacyidea.org/wp-content/uploads/2020/02/ldap-resolver-2-768x948.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/ldap-resolver-2.png 1149w" sizes="auto, (max-width: 829px) 100vw, 829px" /></figure></div>



<p>The resolver is added to a new realm <code>kolab_realm</code> at &#8220;Config-&gt;Realms-&gt;Create Realm&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1019" height="133" src="https://www.privacyidea.org/wp-content/uploads/2020/02/create-realm.png" alt="" class="wp-image-1796" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/create-realm.png 1019w, https://www.privacyidea.org/wp-content/uploads/2020/02/create-realm-300x39.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/create-realm-768x100.png 768w" sizes="auto, (max-width: 1019px) 100vw, 1019px" /></figure></div>



<p></p>



<p>You should now be able to see the users within privacyIDEA.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/users.png" alt="" class="wp-image-1803" width="478" height="274" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/users.png 637w, https://www.privacyidea.org/wp-content/uploads/2020/02/users-300x172.png 300w" sizes="auto, (max-width: 478px) 100vw, 478px" /></figure></div>



<p>We will enroll an HOTP token for <code>test-user</code> with the <a href="https://netknights.it/en/produkte/privacyidea-authenticator-app/">privacyIDEA App</a>, available from Google Play Store. You may alternatively use the Google Authenticator. Install the app and proceed with the enrollment as given below. The privacyIDEA UI auto-completes the username as you type. The generated QR code must be scanned with the App to complete the enrollment.</p>



<figure class="wp-block-gallery columns-3 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/enroll.png"><img loading="lazy" decoding="async" width="851" height="807" src="https://www.privacyidea.org/wp-content/uploads/2020/02/enroll.png" alt="" data-id="1797" class="wp-image-1797" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/enroll.png 851w, https://www.privacyidea.org/wp-content/uploads/2020/02/enroll-300x284.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/enroll-768x728.png 768w" sizes="auto, (max-width: 851px) 100vw, 851px" /></a><figcaption class="blocks-gallery-item__caption">Enroll a new OTP token&#8230;</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/enroll2-1-1024x376.png"><img loading="lazy" decoding="async" width="1024" height="376" src="https://www.privacyidea.org/wp-content/uploads/2020/02/enroll2-1-1024x376.png" alt="" data-id="1859" data-link="https://www.privacyidea.org/?attachment_id=1859" class="wp-image-1859" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/enroll2-1-1024x376.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/enroll2-1-300x110.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/enroll2-1-768x282.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/enroll2-1.png 1119w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a><figcaption class="blocks-gallery-item__caption">&#8230;with the privacyIDEA app.</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/token-1.jpg"><img loading="lazy" decoding="async" width="870" height="1024" src="https://www.privacyidea.org/wp-content/uploads/2020/02/token-1-870x1024.jpg" alt="" data-id="1860" data-full-url="https://www.privacyidea.org/wp-content/uploads/2020/02/token-1.jpg" data-link="https://www.privacyidea.org/?attachment_id=1860" class="wp-image-1860" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/token-1-870x1024.jpg 870w, https://www.privacyidea.org/wp-content/uploads/2020/02/token-1-255x300.jpg 255w, https://www.privacyidea.org/wp-content/uploads/2020/02/token-1-768x904.jpg 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/token-1.jpg 872w" sizes="auto, (max-width: 870px) 100vw, 870px" /></a><figcaption class="blocks-gallery-item__caption">The token is assigned to &#8220;test-user&#8221;.</figcaption></figure></li></ul></figure>



<p>The OTP token is now assigned to the user <code>test-user</code> and the privacyIDEA app on your phone should display a six-digits OTP code.</p>



<p>To issue trigger challenges asking for an OTP key on user login, privacyIDEA needs an authorization. Since we do not want our pi-admin password to flow through the wire all the time, we create another, unpriviledged admin user on the privacyIDEA terminal.</p>



<pre class="wp-block-preformatted has-small-font-size">~$ pi-manage admin add trigger-admin -e trigger-admin@localhost</pre>



<p>The trigger-admin needs a superuser policy to restrict the access. In &#8220;Config-&gt;Policies&#8221;, first create a default superuser policy using the &#8220;superuser&#8221; template. Add only the pi-admin to the <code>admin</code> field. Then add another policy without template. Name it <code>trigger_admin</code>, select the scope <code>admin</code>, add the action <code>triggerchallenge</code> and add the created trigger-admin to the <code>admin</code> field. Now, we have two admin users. pi-admin has the default superuser access and trigger-admin has only very limited access allowing to trigger the challenge.</p>



<p>As privacyIDEA is now up and running, we proceed with the Keycloak server, which will act as the central element in the SSO environment.</p>



<h3 class="wp-block-heading">Keycloak 9 Installation</h3>



<p>Start the Keycloak installation by downloading the Keycloak standalone server from <a href="https://www.keycloak.org/downloads.html">keycloak.org</a>. General install information is found in the <a href="https://www.keycloak.org/docs/latest/getting_started/">&#8220;getting started&#8221; guide</a>. A detailed guide how to integrate Keycloak with systemd on Ubuntu Server 18.04 LTS is found <a href="https:&#x2f;&#47;m&#x65;&#x64;&#105;u&#x6d;&#x2e;&#99;o&#x6d;&#x2f;&#64;h&#x61;&#x73;&#110;a&#x74;&#46;&#115;a&#x65;&#101;d/setup-keycloak-server-on-ubuntu-18-04-ed8c7c79a2d9">here</a>. The necessary steps are summarized below.</p>



<pre class="wp-block-preformatted has-small-font-size">~$ sudo apt-get update
~$ sudo apt-get install default-jre-headless
# Install Keycloak 9
~$ mkdir -p /opt/keycloak /etc/keycloak
~$ wget https://downloads.jboss.org/keycloak/9.0.0/keycloak-9.0.0.tar.gz
~$ tar -xvzf keycloak-9.0.0.tar.gz
~$ mv keycloak-9.0.0.tar.gz /opt/keycloak
# Add keycloak user
~$ groupadd keycloak
~$ useradd -r -g keycloak -d /opt/keycloak -s /sbin/nologin keycloak
~$ chown -R keycloak: /opt/keycloak
~$ chmod o+x /opt/keycloak/bin/
# Place config file
~$ cp /opt/keycloak/docs/contrib/scripts/systemd/wildfly.conf /etc/keycloak/keycloak.conf
# Setup systemd files
~$ sed 's/wildfly/keycloak/' /opt/keycloak/docs/contrib/scripts/systemd/launch.sh \
| tee /opt/keycloak/bin/launch.sh
~$ chown keycloak: /opt/keycloak/bin/launch.sh
~$ sed 's/wildfly/keycloak/g' /opt/keycloak/docs/contrib/scripts/systemd/wildfly.service \
| tee /etc/systemd/system/keycloak.service
# Enable and start the daemon
~$ systemctl daemon-reload
~$ systemctl enable keycloak
~$ systemctl start keycloak
~$ systemctl status keycloak
# Add admin user
~$ /opt/keycloak/bin/add-user-keycloak.sh -r master -u <strong>keycloak-admin</strong> -p <strong>&lt;password&gt;</strong> 
~$ systemctl restart keycloak</pre>



<p>Now you should be greeted by Keycloak at http://192.168.56.202:8080. Login with your created <code>keycloak-admin</code> user. As Keycloak should validate the user logins it has to have access to the user store. In &#8220;User Federation&#8221;, add an LDAP provider with the following settings. The kolab-service account is used as an unpriviledged bind and again we disable TLS for the test setup.</p>



<div class="wp-block-image"><figure class="alignleft size-full is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-ldap-setup-2.png" alt="" class="wp-image-1824" width="874" height="1625" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-ldap-setup-2.png 1089w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-ldap-setup-2-161x300.png 161w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-ldap-setup-2-551x1024.png 551w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-ldap-setup-2-768x1428.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-ldap-setup-2-826x1536.png 826w" sizes="auto, (max-width: 874px) 100vw, 874px" /></figure></div>



<p>Hit &#8220;Synchronize all users&#8221; to pull the users from LDAP to Keycloak. You may enable the periodic sync to keep the Keycloak user store up-to-date.</p>



<p><strong>Important: </strong>The keycloak-admin should not be required to provide a second factor to prevent locking the configuration while testing. For this purpose, define a <code>no2fa</code> group in &#8220;Groups&#8221; and add the keycloak-admin to that group in &#8220;Users&#8221;.</p>



<p>Next, privacyIDEA is integrated with Keycloak. Following our earlier article on the integration of <a href="https://community.privacyidea.org/t/how-to-use-keycloak-with-privacyidea/1132">Django with Keycloak and privacyIDEA</a>, we download the two files <a href="https://github.com/privacyidea/keycloak-provider/releases/download/v0.3/PrivacyIDEA-Provider.jar">PrivacyIDEA-Provider.jar</a> and <a href="https://github.com/privacyidea/keycloak-provider/releases/download/v0.3/privacyIDEA.ftl">privacyIDEA.ftl</a> of the most recent release of the <a href="https://github.com/privacyidea/keycloak-provider">privacyIDEA keycloak-provider</a> and install it to Keycloak.</p>



<pre class="wp-block-preformatted has-small-font-size">~$ wget https://github.com/privacyidea/keycloak-provider/releases/download/v0.3/PrivacyIDEA-Provider.jar
~$ wget https://github.com/privacyidea/keycloak-provider/releases/download/v0.3/privacyIDEA.ftl
~$ cp PrivacyIDEA-Provider.jar /opt/keycloak/standalone/deployment/
~$ cp privacyIDEA.ftl /opt/keycloak/themes/base/login/</pre>



<p>In Keycloak, the authentication is managed in so called &#8220;Authentication Flows&#8221;. Copy the default browser-based flow below and rename it to PrivacyIDEA.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-browser-1024x341.png" alt="" class="wp-image-1808" width="768" height="256" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-browser-1024x341.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-browser-300x100.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-browser-768x255.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-browser.png 1362w" sizes="auto, (max-width: 768px) 100vw, 768px" /></figure>



<p>Add an execution to &#8220;PrivacyIDEA Forms&#8221; and choose the installed plugin called PrivacyIDEA from the list.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution-button.png" alt="" class="wp-image-1810" width="760" height="96" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution-button.png 1013w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution-button-300x38.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution-button-768x97.png 768w" sizes="auto, (max-width: 760px) 100vw, 760px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution.png" alt="" class="wp-image-1809" width="516" height="142" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution.png 688w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-flow-add-execution-300x82.png 300w" sizes="auto, (max-width: 516px) 100vw, 516px" /></figure>



<p>Delete the unnecessary items in the flow (or set them to disabled), so that only &#8220;PrivacyIDEA Forms&#8221; and &#8220;Cookie&#8221; remain. The authentication flow should now look like this:</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-final-1024x280.png" alt="" class="wp-image-1813" width="768" height="210" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-final-1024x280.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-final-300x82.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-final-768x210.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-final.png 1132w" sizes="auto, (max-width: 768px) 100vw, 768px" /></figure>



<p>We set PrivacyIDEA to REQUIRED here, which means that additionally to username and password, the second factor is required for all users. We have to configure the plugin to reach our privacyIDEA server at https://192.168.56.202. We disable SSL-verification for the self-signed certificate here, which you must not do in a productive environment. Members of the <code>no2fa</code> group, defined above will not be asked for their second factor. For issuing the trigger challenge a service account is needed. We use the <code>trigger-admin</code> account created in privacyIDEA earlier.<br></p>



<figure class="wp-block-image size-large is-resized is-style-default"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-config-button.png" alt="" class="wp-image-1812" width="603" height="74" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-config-button.png 804w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-config-button-300x37.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-authentication-privacyidea-config-button-768x94.png 768w" sizes="auto, (max-width: 603px) 100vw, 603px" /></figure>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-privacyidea-settings3.png" alt="" class="wp-image-1829" width="617" height="497" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-privacyidea-settings3.png 822w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-privacyidea-settings3-300x242.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-privacyidea-settings3-768x619.png 768w" sizes="auto, (max-width: 617px) 100vw, 617px" /></figure>



<p>Set the edited authentication flow as default browser flow in &#8220;Bindings&#8221;.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/binding.png" alt="" class="wp-image-1821" width="608" height="283" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/binding.png 811w, https://www.privacyidea.org/wp-content/uploads/2020/02/binding-300x139.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/binding-768x357.png 768w" sizes="auto, (max-width: 608px) 100vw, 608px" /></figure>



<p>So privacyIDEA is now configured to challenge the second factor for every user. The last step is to enable OpenID Connect logins in roundcubemail.</p>



<h3 class="wp-block-heading">Installation of the Kolab SSO plugin</h3>



<p>For the OIDC, Kolab provides the <code>kolab_sso</code> plugin for Roundcubemail which is available on git.kolab.org. Clone the repository and copy the plugin to the Roundcubemail directory to install it.</p>



<pre class="wp-block-preformatted has-small-font-size">~$ git clone https://git.kolab.org/diffusion/RPK/roundcubemail-plugins-kolab.git
~$ cp -r roundcubemail-plugins-kolab/plugins/kolab_sso/ /usr/share/roundcubemail/plugins/</pre>



<p>Place the default configuration file.</p>



<pre class="wp-block-preformatted has-small-font-size">~$ cp /usr/share/roundcubemail/plugins/kolab_sso/config.inc.php.dist /etc/roundcubemail/kolab_sso.inc.php</pre>



<p>Apache should redirect <code>host.roundcube/sso</code> to <code>host.roundcube/?_task=login&amp;_action=sso</code>, since keycloak does not support parameters in urls. It will display &#8220;Invalid parameter: redirect_uri&#8221;. Add the redirect as follows to /etc/apache2/sites-enabled/roundcubemail.conf.</p>



<pre class="wp-block-preformatted has-small-font-size">RewriteEngine On
RewriteCond %{REQUEST_URI} ^/roundcubemail
RewriteRule "^sso" "/roundcubemail/?_task=login&amp;_action=sso" [L,QSA]</pre>



<p>We proceed on the Keycloak machine and add Roundcubemail as a new OpenID Connect client as given below.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="834" height="1024" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-settings-834x1024.png" alt="" class="wp-image-1817" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-settings-834x1024.png 834w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-settings-244x300.png 244w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-settings-768x943.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-settings.png 1100w" sizes="auto, (max-width: 834px) 100vw, 834px" /></figure>



<p>Save the form to access the &#8220;Credentials&#8221; tab. We will soon need the generated secret again.</p>



<figure class="wp-block-image size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-credentials.png" alt="" class="wp-image-1818" width="804" height="187" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-credentials.png 804w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-credentials-300x70.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-roundcubemail-client-credentials-768x179.png 768w" sizes="auto, (max-width: 804px) 100vw, 804px" /></figure>



<p>The kolab_sso plugin needs the certificate of the Keycloak server during the OpenID Connect authentication process. It is available from the Keycloak management console in the &#8220;Realm Settings&#8221;.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="253" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-realm-certificate2-1024x253.png" alt="" class="wp-image-1831" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-realm-certificate2-1024x253.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-realm-certificate2-300x74.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-realm-certificate2-768x190.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-realm-certificate2.png 1176w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Add the key and the client secret alongside the <code>token_uri</code> and <code>auth_uri</code> to the <code>kolab_sso.inc.php</code> configuration file. Make sure that the public key copied from keycloak is properly formatted. The IMAP, SMTP and LDAP credentials in the top part of the file are required for accessing the mailbox, sending emails and accessing the server addressbooks. Configure them accordingly.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="915" height="679" src="https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-kolab_sso-plugin-config-keycloak.png" alt="" class="wp-image-1807" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-kolab_sso-plugin-config-keycloak.png 915w, https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-kolab_sso-plugin-config-keycloak-300x223.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/kolab-kolab_sso-plugin-config-keycloak-768x570.png 768w" sizes="auto, (max-width: 915px) 100vw, 915px" /></figure></div>



<p>After successfully testing the ordinary password login with Roundcubemail at http://192.168.56.200/roundcubemail, you may disable the password login to allow only OpenID Connect by setting</p>



<pre class="wp-block-preformatted has-small-font-size"> $config['kolab_sso_disable_login'] = true;</pre>



<p>in <code>kolab_sso.inc.php</code>.</p>



<h3 class="wp-block-heading">Test the login</h3>



<p>We are now ready to test the OpenID Connect  login at Roundcubemail. Navigate once again to http://192.168.56.200/roundcubemail to test the login. You may monitor some log files during the process.</p>



<pre class="wp-block-preformatted has-small-font-size">/var/log/privacyidea/privacyidea.log
/var/log/roundcubemail/*
/opt/keycloak/standalone/log/*</pre>



<figure class="wp-block-gallery alignwide columns-4 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex"><ul class="blocks-gallery-grid"><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login.png"><img loading="lazy" decoding="async" width="453" height="287" src="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login.png" alt="" data-id="1840" data-link="https://www.privacyidea.org/?attachment_id=1840" class="wp-image-1840" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login.png 453w, https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login-300x190.png 300w" sizes="auto, (max-width: 453px) 100vw, 453px" /></a><figcaption class="blocks-gallery-item__caption">The Roundcubemail kolab_sso login&#8230;</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login.png"><img loading="lazy" decoding="async" width="577" height="514" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login.png" alt="" data-id="1836" data-link="https://www.privacyidea.org/?attachment_id=1836" class="wp-image-1836" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login.png 577w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login-300x267.png 300w" sizes="auto, (max-width: 577px) 100vw, 577px" /></a><figcaption class="blocks-gallery-item__caption">gets redirected to Keycloak.</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login_2FA.png"><img loading="lazy" decoding="async" width="525" height="305" src="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login_2FA.png" alt="" data-id="1837" data-link="https://www.privacyidea.org/?attachment_id=1837" class="wp-image-1837" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login_2FA.png 525w, https://www.privacyidea.org/wp-content/uploads/2020/02/keycloak-oidc_login_2FA-300x174.png 300w" sizes="auto, (max-width: 525px) 100vw, 525px" /></a><figcaption class="blocks-gallery-item__caption">After typing the password, the user is prompted to provide a second factor&#8230;</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/privacyIDEA_Authenticator.png"><img loading="lazy" decoding="async" width="540" height="327" src="https://www.privacyidea.org/wp-content/uploads/2020/02/privacyIDEA_Authenticator.png" alt="" data-id="1838" data-link="https://www.privacyidea.org/?attachment_id=1838" class="wp-image-1838" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/privacyIDEA_Authenticator.png 540w, https://www.privacyidea.org/wp-content/uploads/2020/02/privacyIDEA_Authenticator-300x182.png 300w" sizes="auto, (max-width: 540px) 100vw, 540px" /></a><figcaption class="blocks-gallery-item__caption">&#8230;which we get in this case from the OTP token in the privacyIDEA app.</figcaption></figure></li><li class="blocks-gallery-item"><figure><a href="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login_mailbox-1.png"><img loading="lazy" decoding="async" width="902" height="460" src="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login_mailbox-1.png" alt="" data-id="1842" data-full-url="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login_mailbox-1.png" data-link="https://www.privacyidea.org/?attachment_id=1842" class="wp-image-1842" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login_mailbox-1.png 902w, https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login_mailbox-1-300x153.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/roundcubemail-login_mailbox-1-768x392.png 768w" sizes="auto, (max-width: 902px) 100vw, 902px" /></a><figcaption class="blocks-gallery-item__caption">The correct OTP gets us directly to Roundcubemail webmail.</figcaption></figure></li></ul></figure>



<h3 class="wp-block-heading">Conclusion</h3>



<p>We demonstrated the integration of privacyIDEA with Keycloak to provide a solid basis to secure your applications with a second factor in a single sign-on (SSO) environment. For maximum flexibility, the system relies on standard protocols such as SAML or OpenID Connect (OIDC). The privacyIDEA keycloak-provider is designed to perfectly fit the two components together, uniting the rich identity management capabilities of Keycloak and the powerful multi factor management of privacyIDEA.</p>



<p>We chose the Roundcubemail webmailer of the Kolab Collaboration Server as an example application. The kolab_sso plugin provided the necessary interface to connect via OIDC to easily enhance security by adding a second factor managed by privacyIDEA. The setup of other popular open collaboration platforms such as <a href="https://www.tine20.com/en/">Tine 2.0</a> or <a href="https://www.open-xchange.com/">Open-Xchange</a> work similarly.</p>



<p>Including additional applications in this setup is very easy as long as they support at least one SSO protocol. These applications do not even to be hosted on your own servers. Nowadays, most cloud-based applications offer both, the possibility to use an external identity provider and to use OIDC. Thus, you can also use remote services with your own user base, defining access-rules to fit your needs.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/versatile-2fa-single-sign-on-with-keycloak-and-privacyidea/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
		<item>
		<title>Setup secure authentication with iOS privacyIDEA Push Token</title>
		<link>https://www.privacyidea.org/setup-secure-authentication-with-ios-privacyidea-push-token/</link>
					<comments>https://www.privacyidea.org/setup-secure-authentication-with-ios-privacyidea-push-token/#comments</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Wed, 12 Feb 2020 12:00:39 +0000</pubDate>
				<category><![CDATA[documentation]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[Push Token]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1707</guid>

					<description><![CDATA[Use iPhone for 2FA with Push Notification against privacyIDEA.]]></description>
										<content:encoded><![CDATA[
<p>In a previous post we explained <a href="https://www.privacyidea.org/testing-privacyidea-push-token/">how you can setup Push authentication with privacyIDEA</a>. This gives you the basic configuration in privacyIDEA, sets up your Firebase project and works well with Android based smartphones.</p>



<p>However with iOS devices things are a bit more complicated and <em>additional</em> steps have to be taken. These <em>additional</em> steps are described in this blog post.</p>



<h2 class="wp-block-heading">Apple push apps &#8211; different than Android</h2>



<p>The Firebase service can not directly push to apple devices. Instead, the Firebase service pushes to the Apple Notification Service. While Android allows an app to be connected to different Firebase projects, an iOS app with it&#8217;s app identifier can only be connected to one Apple Push project. </p>



<p>What does this mean?</p>



<p>For the Android devices you created a Firebase project. Your <em>own</em> Firebase project. You configure the data in the privacyIDEA server and the information about the Firebase project is passed to the privacyIDEA Authenticator<strong><em> for Android </em></strong>during the rollout process. This means that a privacyIDEA installation running with organization A connects the push tokens to their own Firebase project and organization B will connect their push tokens to a totally different own Firebase project.</p>



<p>Unfortunately this is not possible with the Apple Notification Service. NetKnights, the company behind privacyIDEA, created one Apple Notification Service project. The secret push key of this project is connected to the app identifier &#8220;privacyidea.authenticator&#8221; of the  privacyIDEA Authenticator App for iOS. The privacyIDEA installation in organization A sends the push notification for an iOS device to the organization&#8217;s own Firebase project, but then the Firebase project will forward the notification to the general Apple Notification Service project. This second step will be the same for all Push notifications to iOS devices connected to any privacyIDEA installation on this planet. This <strong><em>probably </em></strong>arises from Apples cloud-centric idea, that <strong><em>probably </em></strong>an app will only receive notifications from <em> one central cloud</em> service.</p>



<p>However, during enrollment of the iOS privacyIDEA Authenticator the app sends a random device identifier to your privacyIDEA server. Your privacyIDEA installation then uses this random identifier to send the push notification to this very device. It seems unlikely for another privacyIDEA installation to guess the device identifier of a foreign Apple device. If an attacker was able to guess a random device identifier the attacker could send arbitrary notifications to the iOS device. But in addition the iOS privacyIDEA Authenticator is also registered to your <em>own</em> Firebase project. This means, that the attacker indeed could send an arbitrary notification but such notification would not be processed by the privacyIDEA Authenticator.</p>



<p>If you do not like this (which we would understand) you need to recompile the privacyIDEA Authenticator for iOS with your own <strong><em>Apple Notification Service project</em></strong>, with your own Apple developer account, your own certificate and push notification key and with your own app identifier. Just like all other privacyIDEA code, the <a href="https://github.com/privacyidea/privacyidea-authenticator-ios">privacyidea-authenticator-ios</a> is available on github.</p>



<p>NetKnights hopes to be able to provide customization services one day to create customer specific apps as part of a privacyIDEA Authenticator Enterprise Edition, to circumvent this problem.</p>



<p>After this lengthy disclaimer lets now connect Firebase with the Apple Notification Service especially with the privacyIDEA Authenticator.</p>



<p><strong>Note</strong>: This howto discloses the secret project key, which is needed so that Firebase can send messages to the Apple Notification Service. This means, that an attacker could &#8211; after successfully guessing a device identifier &#8211; potentially <em>spam</em> messages to devices connected to the privacyIDEA Apple Notification Service. However, the impact on login security is none, since all messages are digitally signed in both directions. Again: This downside is due to the cloud-centric design or the Apple Notification Service and can only be avoided by compiling your own Authenticator app and publishing it to the Apple app store.</p>



<p>But let&#8217;s do the iOS device, now!</p>



<h2 class="wp-block-heading">Add new Firebase App</h2>



<p>In the <a href="https://console.firebase.google.com/" target="_blank" rel="noreferrer noopener" aria-label="Firebase console (opens in a new tab)">Firebase console</a>, you need to create a new App in your Firebase project. Do so so click the button &#8220;+ Add app&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="476" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-1024x476.png" alt="" class="wp-image-1715" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-1024x476.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-300x140.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app-768x357.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-01-add-app.png 1034w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure></div>



<p>The new app you want to create, is an iOS app. So click the round button &#8220;iOS&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1005" height="410" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app.png" alt="" class="wp-image-1716" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app.png 1005w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app-300x122.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-02-add-ios-app-768x313.png 768w" sizes="auto, (max-width: 1005px) 100vw, 1005px" /></figure></div>



<p>In the app registration dialog you need to create an iOS bundle ID. Creating a nickname is optional. For the <a href="https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids">bundle ID</a> you need to enter &#8220;privacyidea.authenticator&#8221;. Choose a nickname to your likings.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="558" height="549" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-03-register-app.png" alt="" class="wp-image-1717" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-03-register-app.png 558w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-03-register-app-300x295.png 300w" sizes="auto, (max-width: 558px) 100vw, 558px" /></figure></div>



<p>In the second step of the app registration you need to download the plist file. Save it for later, you need to enter the settings from within this file in your privacyIDEA policy.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="743" height="661" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-04-download-for-later.png" alt="" class="wp-image-1718" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-04-download-for-later.png 743w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-04-download-for-later-300x267.png 300w" sizes="auto, (max-width: 743px) 100vw, 743px" /></figure></div>



<p>In the third step you do not need to take any actions. You do not bother with the SDK, since the privacyIDEA Authenticator iOS app already exists!</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="732" height="787" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-05-no-need-to-take-any-achtion-here.png" alt="" class="wp-image-1719" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-05-no-need-to-take-any-achtion-here.png 732w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-05-no-need-to-take-any-achtion-here-279x300.png 279w" sizes="auto, (max-width: 732px) 100vw, 732px" /></figure></div>



<p>Also in the next step you do not need to take any action. Simply press &#8220;Next&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="757" height="899" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-06-no-need-to-take-any-action-here.png" alt="" class="wp-image-1720" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-06-no-need-to-take-any-action-here.png 757w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-06-no-need-to-take-any-action-here-253x300.png 253w" sizes="auto, (max-width: 757px) 100vw, 757px" /></figure></div>



<p>Now you are done registering your iOS app and you can &#8220;Continue to console&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="743" height="651" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-07-return-to-console.png" alt="" class="wp-image-1722" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-07-return-to-console.png 743w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-07-return-to-console-300x263.png 300w" sizes="auto, (max-width: 743px) 100vw, 743px" /></figure></div>



<h2 class="wp-block-heading">Adding the secret iOS Authentication key</h2>



<p>After you have told the Firebase service, that also iOS devices are going to connect to it, you now need to tell Firebase, how it can talk to the Apple Notification Service. For this you need the secret key we talked about at the <a rel="noopener noreferrer" href="#note" target="_blank">beginning</a> of this article. If you do not want to compile your own app and publish it in the app store, you unfortunately have to share the &#8220;secret&#8221; key with all other default installations of privacyIDEA. Download the <a rel="noreferrer noopener" href="https://privacyidea.org/wp-content/uploads/2020/02/AuthKey_2FZRBAT74S.p8" target="_blank">secret key file</a> to your computer and save it for later. </p>



<p>Still in the Firebase console, first go to the &#8220;Project settings&#8221; in the upper left corner</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="495" height="238" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-08-project-settings.png" alt="" class="wp-image-1723" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-08-project-settings.png 495w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-08-project-settings-300x144.png 300w" sizes="auto, (max-width: 495px) 100vw, 495px" /></figure></div>



<p>In the &#8220;Settings&#8221; go to the tab &#8220;Cloud Messaging&#8221;.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="495" height="270" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-cloud-messaging.png" alt="" class="wp-image-1724" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-cloud-messaging.png 495w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-cloud-messaging-300x164.png 300w" sizes="auto, (max-width: 495px) 100vw, 495px" /></figure></div>



<p>In &#8220;Cloud Messaging&#8221; you will find the &#8220;iOS app configuration&#8221;. There you can hit &#8220;Upload&#8221; to upload the secret key file. </p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="999" height="409" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key.png" alt="" class="wp-image-1725" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key.png 999w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key-300x123.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-09-upload-auth-key-768x314.png 768w" sizes="auto, (max-width: 999px) 100vw, 999px" /></figure></div>



<p>Now select the secret key file (AuthKey_2FZRBAT74S.p8) to upload it to the Firebase console.</p>



<p>Enter the Key ID (2FZRBAT74S) and Team ID (627QALYL3B) exactly as stated in the image below.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="669" height="551" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-10-select-key-file.png" alt="" class="wp-image-1726" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-10-select-key-file.png 669w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-10-select-key-file-300x247.png 300w" sizes="auto, (max-width: 669px) 100vw, 669px" /></figure></div>



<p>After hitting the &#8220;Upload&#8221; button you should be fine and your Firebase Push Service is connected to the Apple Notification Service for the privacyIDEA Authenticator iOS App.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="985" height="379" src="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded.png" alt="" class="wp-image-1728" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded.png 985w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded-300x115.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/ios-push-11-auth-key-successfully-uploaded-768x296.png 768w" sizes="auto, (max-width: 985px) 100vw, 985px" /></figure></div>



<h2 class="wp-block-heading">Configure iOS Authenticator in privacyIDEA</h2>



<p>Now open the plist file you saved earlier. Find the entries API_KEY and GOOGLE_APP_ID. It will look like this:</p>



<pre class="wp-block-code"><code>&lt;?xml version="1.0" encoding="UTF-8"?>
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
&lt;plist version="1.0">
&lt;dict>
        ...
	&lt;key>API_KEY&lt;/key>
	&lt;string>example-key_value&lt;/string>
        ...
    	&lt;key>GOOGLE_APP_ID&lt;/key>
	&lt;string>1:example:ios:appid&lt;/string>
&lt;/dict>
&lt;/plist></code></pre>



<p>You need to enter the value &#8220;example-key_value&#8221; in <em>apikeyios</em> and the value &#8220;1:example:ios:appid&#8221; in <em>appidios</em>.</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="693" src="https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-1024x693.png" alt="" class="wp-image-1749" srcset="https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-1024x693.png 1024w, https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-300x203.png 300w, https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea-768x520.png 768w, https://www.privacyidea.org/wp-content/uploads/2020/02/iOS-push-12-configure-privacyidea.png 1191w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Now you are ready to register iOS devices with your privacyIDEA Push setup and use your iPhones to authenticate via Push notification.</p>



<p>If you want to stay tuned for the enterprise edition, please consider <a href="https://netknights.it/en/unternehmen/kontakt/" target="_blank" rel="noreferrer noopener" aria-label="contacting the company NetKnights (opens in a new tab)">contacting the company NetKnights</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/setup-secure-authentication-with-ios-privacyidea-push-token/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>privacyIDEA &#8211; flexibility in the very genes</title>
		<link>https://www.privacyidea.org/privacyidea-flexibility-in-the-very-genes/</link>
					<comments>https://www.privacyidea.org/privacyidea-flexibility-in-the-very-genes/#comments</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Sat, 30 Nov 2019 08:43:18 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Whatsup]]></category>
		<category><![CDATA[Event Handler]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1664</guid>

					<description><![CDATA[Successful two factor authentication is a matter of smooth workflows. We learnt this in a lot of set ups and are claiming it since 2018 at the LinuxFest North West. One-solution-fits-all does not work out! Nowadays a company or organization wants to deploy 2FA to not only secure a certain login to a certain application, [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p><em>Successful two factor authentication is a matter of smooth workflows. </em></p>



<p>We learnt this in a lot of set ups and are claiming it since 2018 at the <a rel="noreferrer noopener" aria-label="LinuxFest North West (opens in a new tab)" href="https://linuxfestnorthwest.org/conferences/lfnw18/program/proposals/145" target="_blank">LinuxFest North West</a>. One-solution-fits-all does not work out! Nowadays a company or organization wants to deploy 2FA to not only secure a certain login to a certain application, but also wants to have secure workflows around the authentication process. Thus the perfect 2FA or MFA software needs to adapt to the needs of such company or organisation.</p>



<h2 class="wp-block-heading">The beauty of the event handlers</h2>



<p>privacyIDEA introduced the Event Handlers already in version 2.12, May 2016. The <a rel="noreferrer noopener" aria-label="script event handlers (opens in a new tab)" href="https://privacyidea.readthedocs.io/en/latest/eventhandler/scripthandler.html" target="_blank">script event handlers</a>, which I want to talk about today, followed in version 2.17, December 2016.</p>



<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img loading="lazy" decoding="async" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-1024x718.png" alt="" class="wp-image-1565" width="550" height="385" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-1024x718.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-300x210.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-768x538.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image.png 1198w" sizes="auto, (max-width: 550px) 100vw, 550px" /></figure></div>



<p>Event Handlers were used quite actively since then. Only the script handles seemed special and awkward. It has been quiet around this one for a while. But recently a comment and question of a German <a rel="noreferrer noopener" aria-label="partner (opens in a new tab)" href="https://netknights.it/en/unternehmen/partner/" target="_blank">partner</a> (<a rel="noreferrer noopener" aria-label="IT-Schmid (opens in a new tab)" href="https://it-schmid.com/hard-software/#av-tab-section-1-9" target="_blank">IT-Schmid</a>), who was implementing a roll out concept for a customer, caught my attention and reactivated the thinking about the beauty of the script handlers.</p>



<p>privacyIDEA is implemented in a very modular way &#8211; on a horizontal but also on a vertical level. <a rel="noreferrer noopener" aria-label="Database level, library level, the REST API and the Web UI are different (opens in a new tab)" href="https://privacyidea.readthedocs.io/en/latest/modules/index.html" target="_blank">Database level, library level, the REST API and the Web UI are different</a>, separated parts. And this helps us a lot with the script handlers. It is easily possible to write python scripts, that are using the library level, without the need to issue REST Requests that are processed through the web server. This improves performance of such scripts and it gives you access to ready made library functions, that allow you to address tasks with a few lines of code.</p>



<h2 class="wp-block-heading">Script collection at Github repository</h2>



<p>We realized, that it makes sense to provide a collection of example scripts, to give you a better understanding, what scripts can do and how this could be done. A new repository has been added at <a rel="noreferrer noopener" aria-label="Github to host such example scripts (opens in a new tab)" href="https://github.com/privacyidea/scripts" target="_blank">Github to host such example scripts</a>. The first script is a script is a few lines, that can reassign a token from a username in one realm to a username in another realm. This can be a useful step during more complex rollout scenario. But automating such tasks of course reduces complexity and efforts to be taken.</p>



<p>We are happy to receive ideas and pull requests with new interesting scripts, which could enhance the scenarios with privacyIDEA to unexpected widths.</p>



<p>Visit our <a href="https://community.privacyidea.org">community forum</a> for further discussions!</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/privacyidea-flexibility-in-the-very-genes/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Testing privacyIDEA Push Token</title>
		<link>https://www.privacyidea.org/testing-privacyidea-push-token/</link>
					<comments>https://www.privacyidea.org/testing-privacyidea-push-token/#comments</comments>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Wed, 17 Apr 2019 10:56:04 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Push Token]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1573</guid>

					<description><![CDATA[Use the Push Authentication with privacyIDEA 3.0.]]></description>
										<content:encoded><![CDATA[
<p>Today we released version 2.0 of our privacyIDEA Authenticator to the beta test program.</p>



<p>In Version 2.0 the privacyIDEA Authenticator implementes the Push Token. During Rollout the Push Token exchanges asymmetric keys between the privacyIDEA Server and the privacyIDEA Authenticator. </p>



<p>During authentication the privacyIDEA Server sends a cryptographic challenge via Firebase to the smartphone. The privacyIDEA Authenticator verifies the signature of the privacyIDEA Server and asks the user to confirm the login request. The App then signs the challenge and sends it back to the privacyIDEA Server.</p>



<p>The internals are described at our <a rel="noreferrer noopener" aria-label="github wiki page. (opens in a new tab)" href="https://github.com/privacyidea/privacyidea/wiki/concept%3A-PushToken" target="_blank">github wiki page.</a></p>



<h3 class="wp-block-heading">Join the Beta Test</h3>



<p>The privacyIDEA Authenticator 2.0 is available for Android phones at the moment. iOS will follow shortly.</p>



<p>We are happy if you want to participate in the public beta test. Simply go to <a rel="noreferrer noopener" aria-label="this site and follow the steps (opens in a new tab)" href="https://play.google.com/apps/testing/it.netknights.piauthenticator" target="_blank">this site and follow the steps</a> to join the beta test. You can install the privacyIDEA Authenticator 2.0 on your Android device (Minimum version &#8220;kitkat&#8221; &#8211; we do not recommend this! <img src="https://s.w.org/images/core/emoji/15.0.3/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h3 class="wp-block-heading">Set up for your tests</h3>



<p>In this blog post we want to give you an overview to get started. For a deeper understanding you can read more about the push token in the <a href="https://privacyidea.readthedocs.io/en/latest/tokens/tokentypes/push.html#configuration" target="_blank" rel="noreferrer noopener">online documentation</a> and at <a rel="noreferrer noopener" href="https://github.com/privacyidea/privacyidea/wiki/concept%3A-PushToken" target="_blank">github</a>.</p>



<h4 class="wp-block-heading">Get components</h4>



<p>Get <a rel="noreferrer noopener" aria-label="privacyIDEA 3.0 (opens in a new tab)" href="https://privacyidea.readthedocs.io/en/latest/installation/index.html" target="_blank">privacyIDEA 3.0</a> and the privacyIDEA <a rel="noreferrer noopener" aria-label="Authenticator 2.0 (opens in a new tab)" href="https://play.google.com/apps/testing/it.netknights.piauthenticator" target="_blank">Authenticator 2.0</a>.</p>



<h4 class="wp-block-heading">Network connectivity</h4>



<p>Assure, that your smartphone can reach your privacyIDEA server, e.g. by placing your smartphone in the same Wireless LAN like your privacyIDEA Server. The smartphone needs to connect to privacyIDEA during enrollment and during authentication.</p>



<h4 class="wp-block-heading">Firebase project</h4>



<p>In the <a rel="noreferrer noopener" aria-label="Firebase console (opens in a new tab)" href="https://console.firebase.google.com" target="_blank">Firebase console</a> you need to create your own Firebase Cloud Messaging project.</p>



<p>From the console you can download the relevant project information. </p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="773" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-7-1024x773.png" alt="" class="wp-image-1579" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-7-1024x773.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-7-300x226.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-7-768x580.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-7.png 1257w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p><del>The relevant information is the &#8220;Web API Key&#8221;, &#8220;App ID&#8221;, &#8220;Project ID&#8221; and the project number, which is the number part of the &#8220;Public-facing name&#8221;. Copy these values to create a new provider in privacyIDEA.</del></p>



<p>Download the file <em>google-services.json</em> and fetch the values &#8220;project_number&#8221;, &#8220;project_id&#8221;, &#8220;mobilesdk_app_id&#8221; and &#8220;api_key&#8221; from this file.</p>



<p>In addition you need to create a new service account for your Firebase project:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="715" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-8-1024x715.png" alt="" class="wp-image-1580" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-8-1024x715.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-8-300x209.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-8-768x536.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-8.png 1253w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>You can download the settings of this service account in a JSON file, which you need to copy to the privacyIDEA machine and later add in your privacyIDEA SMS Provider in the next step.</p>



<h4 class="wp-block-heading">Firebase SMS Provider</h4>



<p>In privacyIDEA you need to create an &#8220;SMS Gateway&#8221; of type &#8220;Firebase&#8221; with the Firebase project you created in the previous step. The privacyIDEA Server will connect to Firebase with this project.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="721" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-6-1024x721.png" alt="" class="wp-image-1578" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-6-1024x721.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-6-300x211.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-6-768x541.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-6.png 1183w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>Enter the data and json file, you downloaded from the Firebase console. E.g. the <em>JSON config file</em> needs to be copied to the privacyIDEA Server and you need to specify a local path on the privacyIDEA Server.</p>



<p>Finally you also need to enter the <em>registration URL</em>. This is the URL of the privacyIDEA Server which the privacyIDEA Authenticator contacts during the enrollment process. So you need to be sure, that this URL is in a format (FQDN, IP), which the smartphone can connect to. Unless you know otherwise the path or the URL should be <em>/ttype/push</em>.</p>



<h4 class="wp-block-heading">Policies</h4>



<p>Now you need to configure your privacyIDEA system. You need to create two policies, one for the enrollment and the other one for the authentication.</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="639" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-9-1024x639.png" alt="" class="wp-image-1582" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-9-1024x639.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-9-300x187.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-9-768x479.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-9.png 1153w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>The enrollment policy contains the name of the Firebase SMS Provider you created in the previous step.</p>



<p>The authentication policy can contain the text, that should be displayed in the notification:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="607" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-10-1024x607.png" alt="" class="wp-image-1584" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-10-1024x607.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-10-300x178.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-10-768x455.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-10.png 1115w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<h4 class="wp-block-heading">Testing</h4>



<p>You can now test you setup by</p>



<ol class="wp-block-list"><li>Enroll a new Push token and assign it to a user. Give the Push token a PIN.</li><li>In your browser you can simply issue an authentication request using the API <em>https://your.privacyidea.server/validate/check?user=testuser&amp;pass=yourpin</em></li><li>You should receive a notification on your enrolled smartphone, which you can confirm.</li></ol>



<h2 class="wp-block-heading">Your help and feedback</h2>



<p>The missing link currently is the Application that is supposed to <a rel="noreferrer noopener" aria-label="poll for the confirmed authentication (opens in a new tab)" href="https://github.com/privacyidea/privacyidea/wiki/concept%3A-PushToken#polling-endpoint-for-application" target="_blank">poll for the confirmed authentication</a>.</p>



<p>We need <strong>your</strong> feedback, to know on which application we should start working first. As an alternative we are also planning to add <a href="https://github.com/privacyidea/privacyidea/issues/1583" target="_blank" rel="noreferrer noopener" aria-label="a delayed response (opens in a new tab)">a delayed response</a>.</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.privacyidea.org/testing-privacyidea-push-token/feed/</wfw:commentRss>
			<slash:comments>13</slash:comments>
		
		
			</item>
		<item>
		<title>Reset failcounter using event handlers</title>
		<link>https://www.privacyidea.org/reset-failcounter-using-event-handlers/</link>
		
		<dc:creator><![CDATA[Cornelius Kölbel]]></dc:creator>
		<pubDate>Tue, 16 Apr 2019 17:02:55 +0000</pubDate>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Event Handler]]></category>
		<category><![CDATA[failcounter]]></category>
		<guid isPermaLink="false">https://www.privacyidea.org/?p=1564</guid>

					<description><![CDATA[How to reset the failcounter using event handlers.]]></description>
										<content:encoded><![CDATA[
<p>An attacker could try to brute force the token of a user. This is why privacyIDEA uses a failcounter that increases on each failed authentication request. If the failcounter reaches a maximum value, authentication requests are blocked.</p>



<p>Event handlers are really very flexible and provide you with a lot of possibilities, we did not think of, when we developed them. In this blog post we show you, how you can use event handlers to reset this failcounter.</p>



<p>To do so, we use two event handlers. The first one we call &#8220;Write Authentication&#8221; the second one &#8220;Reset Failcounter&#8221;.</p>



<h3 class="wp-block-heading">First event handler to store the authentication date</h3>



<p>The first event handler stores the date when the failcounter is allowed to be reset again. It does this on every authentication request. I.e. each authentication request pushes a blocked token forward in time. An attacker would increase this date of the token even while the token is blocked. (You could change this behavior by adding more logic to the event handler).</p>



<p>The event handler “Write Authentication” is a token handler and does not need any additional conditions. It is important that you provide a higher order to this event handler. In this case we set the &#8220;Order&#8221; to &#8220;2&#8221;.</p>



<p>The Actions of the event handler look like this:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="1024" height="718" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-1024x718.png" alt="" class="wp-image-1565" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-1024x718.png 1024w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-300x210.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-768x538.png 768w, https://www.privacyidea.org/wp-content/uploads/2019/04/image.png 1198w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p>This event handler sets a &#8220;tokeninfo&#8221; entry on each authentication request. The key of the tokeninfo is &#8220;allow_counter_reset&#8221;. The value is the current time (&#8220;{now}&#8221;) plus certain minutes. So this is a timestamp in the future, when the failcounter should be allowed to reset.</p>



<h3 class="wp-block-heading">Second event handler to reset the failcounter</h3>



<p>The second event hanlder is actually ment to reset
the failcounter.</p>



<p>Note, that the order (priority) must have a lower value than the first event handler. This way this reset event hanlder gets executed before the event handler, that sets the timestamp!</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="879" height="337" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-1.png" alt="" class="wp-image-1567" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-1.png 879w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-1-300x115.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-1-768x294.png 768w" sizes="auto, (max-width: 879px) 100vw, 879px" /></figure>



<p>The conditions of this event handler now check for the timestamp we set in the first event handler:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="879" height="302" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-2.png" alt="" class="wp-image-1569" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-2.png 879w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-2-300x103.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-2-768x264.png 768w" sizes="auto, (max-width: 879px) 100vw, 879px" /><figcaption><br><br></figcaption></figure>



<p>This event handler will trigger, if the token is locked (the failcounter has reached the maximum value) and the tokeninfo &#8220;allow_counter_reset&#8221; lies in the past. I.e. the specified minutes in the first event handler are actually over.</p>



<p> The action of this event handler simply resets the fail counter:</p>



<figure class="wp-block-image"><img loading="lazy" decoding="async" width="874" height="284" src="https://www.privacyidea.org/wp-content/uploads/2019/04/image-3.png" alt="" class="wp-image-1570" srcset="https://www.privacyidea.org/wp-content/uploads/2019/04/image-3.png 874w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-3-300x97.png 300w, https://www.privacyidea.org/wp-content/uploads/2019/04/image-3-768x250.png 768w" sizes="auto, (max-width: 874px) 100vw, 874px" /></figure>



<h2 class="wp-block-heading">Effective behaviour</h2>



<p>An authentication request, that occurs after the specified time will actually reset the failcounter. But since this event handler can only be executed <strong>after</strong> the authentication request, an authentication request with a valid OTP value will reset the failcounter, but it will not succeed, since the request has already been handled.  </p>



<p>Thus a user has to authenticate twice to first unlock the token and then to actually successfully authenticate.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
