Shibboleth como SP
=Shibboleth Service Provider=
Datos importantes:
Para esta configuración se utilizo los siguientes IDP y SP: SP: mail2.riu.edu.ar IDP: id.riu.edu.ar
Instalación
apt-get install libapache2-mod-shib2 shibboleth-sp2-schemas
Configuración de Apache
Para habilitar el modulo de shibboleth ejecuto lo siguiente:
a2enmod shib2
Luego modifico el VirtualHost y agrego las lineas que están resaltadas en negritas:
<Directory /var/www/mail2>
'''AuthType shibboleth'''
'''ShibRequireSession On'''
'''require shibboleth'''
Options FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Para finalizar reinicio el servicio para que tome los cambios
/etc/init.d/apache2 restart
Configuración Shibboleth
Creo los certificados necesarios para crear los metadatos de mi servidor:
shib-keygen -h mail2.riu.edu.ar
Luego copio el archivo example-shibboleth2.xml como shibboleth2.xml y lo modifico con los datos de mi servidor
<SPConfig xmlns="urn:mace:shibboleth:2.0:native:sp:config"
xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
logger="syslog.logger" clockSkew="180">
<OutOfProcess logger="shibd.logger">
</OutOfProcess>
<InProcess logger="native.logger">
<ISAPI normalizeRequest="true" safeHeaderNames="true">
<Site id="1" name="mail2.riu.edu.ar"/>
</ISAPI>
</InProcess>
<UnixListener address="shibd.sock"/>
<StorageService type="Memory" id="mem" cleanupInterval="900"/>
<SessionCache type="StorageService" StorageService="mem" cacheAssertions="false"
cacheAllowance="900" inprocTimeout="900" cleanupInterval="900"/>
<ReplayCache StorageService="mem"/>
<ArtifactMap artifactTTL="180"/>
<RequestMapper type="Native">
<RequestMap>
<Host name="mail2.riu.edu.ar">
<Path name="secure" authType="shibboleth" requireSession="true"/>
</Host>
</RequestMap>
</RequestMapper>
<ApplicationDefaults entityID="https://mail2.riu.edu.ar"
REMOTE_USER="eppn persistent-id targeted-id"
signing="false" encryption="false">
<Sessions lifetime="28800" timeout="3600" checkAddress="false"
handlerURL="/Shibboleth.sso" handlerSSL="false" relayState="ss:mem"
exportLocation="http://mail2.riu.edu.ar/Shibboleth.sso/GetAssertion" exportACL="127.0.0.1"
idpHistory="false" idpHistoryDays="7">
<SessionInitiator type="Chaining" Location="/Login" isDefault="true" id="Login"
entityID="https://id.riu.edu.ar/shib13/idp/metadata.php">
<SessionInitiator type="Shib1"/>
</SessionInitiator>
<md:AssertionConsumerService Location="/SAML2/POST" index="1"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
<md:AssertionConsumerService Location="/SAML2/POST-SimpleSign" index="2"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign"/>
<md:AssertionConsumerService Location="/SAML2/Artifact" index="3"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
<md:AssertionConsumerService Location="/SAML2/ECP" index="4"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:PAOS"/>
<md:AssertionConsumerService Location="/SAML/POST" index="5"
Binding="urn:oasis:names:tc:SAML:1.0:profiles:browser-post"/>
<md:AssertionConsumerService Location="/SAML/Artifact" index="6"
Binding="urn:oasis:names:tc:SAML:1.0:profiles:artifact-01"/>
<LogoutInitiator type="Chaining" Location="/Logout">
<LogoutInitiator type="SAML2" template="bindingTemplate.html"/>
<LogoutInitiator type="Local"/>
</LogoutInitiator>
<md:SingleLogoutService Location="/SLO/SOAP"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
<md:SingleLogoutService Location="/SLO/Redirect" conf:template="bindingTemplate.html"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
<md:SingleLogoutService Location="/SLO/POST" conf:template="bindingTemplate.html"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
<md:SingleLogoutService Location="/SLO/Artifact" conf:template="bindingTemplate.html"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
<md:ManageNameIDService Location="/NIM/SOAP"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
<md:ManageNameIDService Location="/NIM/Redirect" conf:template="bindingTemplate.html"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"/>
<md:ManageNameIDService Location="/NIM/POST" conf:template="bindingTemplate.html"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"/>
<md:ManageNameIDService Location="/NIM/Artifact" conf:template="bindingTemplate.html"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact"/>
<md:ArtifactResolutionService Location="/Artifact/SOAP" index="1"
Binding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"/>
<Handler type="MetadataGenerator" Location="/Metadata" signing="false" acl="10.22.0.0/24"/>
<Handler type="Status" Location="/Status" acl="127.0.0.1"/>
<Handler type="Session" Location="/Session" showAttributeValues="true" acl="127.0.0.1"/>
<Handler type="DiscoveryFeed" Location="/DiscoFeed"/>
</Sessions>
<Errors supportContact="postmaster@riu.edu.ar"
logoLocation="/shibboleth-sp/logo.jpg"
styleSheet="/shibboleth-sp/main.css"/>
<MetadataProvider type="XML" file="mail2-metadata.xml"/>
<MetadataProvider type="XML" file="id.riu.edu.ar-metadata.xml"/>
<TrustEngine type="ExplicitKey"/>
<TrustEngine type="PKIX"/>
<AttributeExtractor type="XML" validate="true" path="attribute-map.xml"/>
<AttributeResolver type="Query" subjectMatch="true"/>
<AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>
<CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>
</ApplicationDefaults>
<SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>
<ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>
</SPConfig>
Una vez terminada la configuración de shibboleth.xml creo el archivo id.riu.edu.ar-metadata.xml y dentro del mismo coloco los datos obtenidos de mi IDP, los mismos los obtengo de la siguiente manera.
Ingreso a mi IDP por WEB → voy a la solapa federación y en la parte de Metadatos IdP Shib 1.3 hago clic sobre [ Ver metadatos ] y copio los metadatos que están en formato xml.
Cuando termino de realizar esto procedo a general los metadatos de mi SP, para hacerlo ejecuto el siguiente comando:
shib-metagen -h mail2.riu.edu.ar > mail2-metadata.xml
Luego para que el SP quede funcionando reinicio shibboleth
/etc/init.d/shibd restart