SAML Server: Difference between revisions

 
(13 intermediate revisions by the same user not shown)
Line 1:
[[Category:Lab]]
= CreatingInstalling SAML Server =
 
Source: [https://www.helloitsliam.com/2014/12/23/install-configure-and-test-simplesamlphp-for-authentication-testing/ helloitsliam.com],[https://support.citrix.com/article/CTX200271 support.citrix.com], [https://simplesamlphp.org/docs/stable/simplesamlphp-idp simplesamlphp.org], [https://www.citrix.com/blogs/2012/08/24/174193098/ citrix.com]
Line 19:
*Installing SimpleSAMLphp binaries:
cd /var
 
sudo wget https://github.com/simplesamlphp/simplesamlphp/releases/download/v1.14.12/simplesamlphp-1.14.12.tar.gz
 
sudo tar zxf simplesamlphp-1.14.12.tar.gz
OR
cd simplesamlphp-1.14.12/
sudo mvwget https://simplesamlphp-1.14.12 simplesamlphporg/download?latest
sudo rmmv -fdownload\?latest simplesamlphp-1.14.12.tar.gz
 
sudo tar zxf simplesamlphp-*.tar.gz
sudo mv simplesamlphp-* simplesamlphp
sudo rm -f simplesamlphp-*.tar.gz
cd simplesamlphp/
 
== Configuring SAML Server as IDP ==
 
*Configuring SimpleSAML php:
Modify the below files as per given parameters depending on your environment:
 
*; /var/simplesamlphp/config/config.php
 
'auth.adminpassword' => 'test@123',
Line 41 ⟶ 45:
'session.phpsession.cookiename' => null,
 
*; /var/simplesamlphp/config/authsources.php
 
'my-ldap' => array(
Line 57 ⟶ 61:
'priv.password' => 'Password@123',
 
*; /var/simplesamlphp/metadata/saml20-idp-hosted.php
 
{{UC}}
'privatekey' => '/etc/apache2/ssl/wildcard.testlab.com.pem',
; /var/simplesamlphp/metadata/saml20-sp-remote.php
'certificate' => '/etc/apache2/ssl/wildcard.testlab.com.cer',
{{UC}}
'auth' => 'my-ldap',
 
Uncomment the below section:
 
'attributes.NameFormat' => 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
'authproc' => array(
// Convert LDAP names to oids.
100 => array('class' => 'core:AttributeMap', 'name2oid'),
),
 
Disable the message signing as the NetScaler does not understand this signature type
 
'saml20.sign.response' => FALSE,
'saml20.sign.assertion' => FALSE,
 
*; /var/simplesamlphp/metadata/saml20-sp-remote.php
 
Generate the metadata from the SP and paste in the end of this file:
 
<pre>
$metadata['testlab-AD-CA'] = array (
'entityid' => 'testlab-AD-CA',
'contacts' =>
array (
),
'metadata-set' => 'saml20-sp-remote',
'AssertionConsumerService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://samlvip.testlab.com/cgi/samlauth',
'index' => 255,
),
),
'SingleLogoutService' =>
array (
0 =>
array (
'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
'Location' => 'https://samlvip.testlab.com/cgi/tmlogout',
),
),
'keys' =>
array (
0 =>
array (
'encryption' => true,
'signing' => true,
'type' => 'X509Certificate',
'X509Certificate' => '
MIIFNjCCBB6gAwIBAgITYwAAAAsiKKYDFRKTlwAAAAAACzANBgkqhkiG9w0BAQsF
ADBGMRMwEQYKCZImiZPyLGQBGRYDY29tMRcwFQYKCZImiZPyLGQBGRYHdGVzdGxh
YjEWMBQGA1UEAxMNdGVzdGxhYi1BRC1DQTAeFw0xNjEyMTAxNTQwMTlaFw0xODEy
MTAxNTQwMTlaMEoxCzAJBgNVBAYTAklOMRIwEAYDVQQIEwlLYXJuYXRha2ExDzAN
BgNVBAoTBkNpdHJpeDEWMBQGA1UEAxQNKi50ZXN0bGFiLmNvbTCCASIwDQYJKoZI
hvcNAQEBBQADggEPADCCAQoCggEBAKoEslU503/iN1oJtzklquElyRFeiLpa+jJU
qcM3fb8eZbSkL1EmNhDTSKr1Dr/dvr3U3YQP4gi7Z+NaYIK90umw12/SEoQ7FUTj
anK6Aj66XgAgF1mqO/XJxb0Ht4dVRhuyVjpMMpoeX2QxCB16xI/mePA9Eph4haZ1
p8ZjRlYuNT4zSHaV4F1RbzQXE+PyL9r0PImB4wtJ+Rvvm164kb3YgQvgAxr2N6+b
On0wTpStcGdZfilkrgTMvk8r1YtWBGcfj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dFhZTN4H2Jb8rJSz8xmBzs8xbNGq
cLczDq9eChH8T0uboG58vrhMnwY3tnIMPELjO6LqbeOv7OdPxBtCbmSXG6CugzCk
7rYoP0r0zB6tw0SobgzjzAyOkoboOrEGjo780rgy6QLl4HQAmumwbWx8
 
 
',
),
),
);
</pre>
 
== Configuring Apache Server ==
 
*Pointing Apache to SimpleSAMLphp by editing below file:
 
sudo nano /etc/apache2/sites-available/000-default.conf
*; /etc/apache2/sites-available/000-default.conf
{{UC}}
<pre>
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
 
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
 
Alias /simplesaml /var/simplesamlphp/www/
<Directory /var/simplesamlphp/www/>
Require all granted
</Directory>
 
</VirtualHost>
</pre>
 
*Now check if application is accessible over HTTP:
http://<ip-address-of-server>/simplesamlphp
 
== Enabling SSL Access ==
 
*Generate Certificates
*Enabling Secure (read SSL) access:
 
cd /etc/apache2/
Line 83 ⟶ 189:
sudo openssl x509 -req -days 9999 -in Certificate.csr -signkey Certificate.key -out Certificate.crt
 
*Restart Apache
sudo a2enmod ssl
sudo service apache2 restart
 
*Point Apache to use these Certificates by editing below config file:
sudo nano /etc/apache2/sites-available/000-default.conf
; /etc/apache2/sites-available/000-default.conf
{{UC}}
 
<pre>
<VirtualHost *:443>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
 
SSLCertificateFile /etc/apache2/ssl/wildcard.testlab.com.cer
SSLCertificateKeyFile /etc/apache2/ssl/wildcard.testlab.com.pem
SSLEngine On
 
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
 
Alias /simplesaml /var/simplesamlphp/www/
<Directory /var/simplesamlphp/www/>
Require all granted
</Directory>
</VirtualHost>
</pre>
 
*Restart Apache
sudo a2ensite ssl
sudo a2enmod ssl
Line 98 ⟶ 226:
https://<ip-address-of-server>/simplesamlphp
 
== Logs ==
{{UC}}
 
== Packet Captures ==
{{UC}}