Differenze tra le versioni di "SAML-Subject-ID-Attribute"

Da WIKI IDEM GARR.
Jump to navigation Jump to search
Riga 55: Riga 55:
  
 
I valori possibili per l'Entity Attribute sono <code>subject-id</code>, <code>pairwise-id</code>, <code>any</code> und <code>none</code>. Nel caso sia specificato <code>any</code> allora l'Identity Provider dovrebbe rilasciare <code>pairwise-id</code>.
 
I valori possibili per l'Entity Attribute sono <code>subject-id</code>, <code>pairwise-id</code>, <code>any</code> und <code>none</code>. Nel caso sia specificato <code>any</code> allora l'Identity Provider dovrebbe rilasciare <code>pairwise-id</code>.
 +
 +
Tale dichiarazione avviene escluvamente modificando i metadata del SP via IDEM Registry (https://registry.idem.garr.it/rr3) tramite il percorso Edit Provider -> Entity Attributes e selezionando quello opportuno tra:
 +
 +
* SAML Profiles subject-id:req - subject-it
 +
* SAML Profiles subject-id:req - pairwise-id
 +
* SAML Profiles subject-id:req - any
 +
* SAML Profiles subject-id:req - none
  
 
==Configurazione per supportare i nuovi standard in Shibboleth Idp e Sp==
 
==Configurazione per supportare i nuovi standard in Shibboleth Idp e Sp==

Versione delle 15:22, 31 ott 2023

Subject Identifiers nella Federazione IDEM

Dal 2019 con la pubblicazione del documento [SAML-SubjectID-v1.0] "SAML V2.0 Subject Identifier Attributes Profile Version 1.0" sono stati standardizzati due nuovi attributi SAML per l'identificazione dei soggetti di sicurezza, con lo scopo di risolvere molti dei problemi legati ai precedenti Subject Identifier.

I nuovi standard sono:

  • urn:oasis:names:tc:SAML:attribute:subject-id
  • urn:oasis:names:tc:SAML:attribute:pairwise-id

Quelli che finora sono stati impiegati nella nostra Federazione sono i seguenti (provenienti dallo schema eduPerson):

  • eduPersonTargetedID (attributo deprecato normalmente valorizzato con urn:oasis:names:tc:SAML:2.0:nameid-format:persistent)
  • eduPersonPrincipalName
  • eduPersonUniqueID

Oltre all'impiego di attributi è in uso nella nostra Federazione il rilascio dei Name Identifiers nel subject dell'asserzione SAML:

  • urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
  • urn:oasis:names:tc:SAML:2.0:nameid-format:transient

L'impiego di Email Address come identificatore è vietato nella nostra Federazione (https://spaces.at.internet2.edu/display/federation/why-is-email-not-an-appropriate-user-identifier).

Definizione di SAML Subject-ID

A scoped, opaque, not reassignable, non-targeted pseudonym for a subject (person) – consultare Name Identifiers per chiarimenti sulla terminologia.

(https://wiki.oasis-open.org/security/SAMLSubjectIDAttr)

L'attributo è destinato a sostituire identificatori legacy come eduPersonUniqueID e possibilmente eduPersonPrincipalName

Sintassi

Il valore è costituito da due sottostringhe (denominate “unique ID” e “scope”) separate da un simbolo @ (ASCII 64) come delimitatore in linea.

The unique ID consists of 1 to 127 ASCII characters, each of which is either an alphanumeric ASCII character, an equals sign (ASCII 61), or a hyphen (ASCII 45). The first character MUST be alphanumeric.

The scope consists of 1 to 127 ASCII characters, each of which is either an alphanumeric ASCII character, a hyphen (ASCII 45), or a period (ASCII 46). The first character MUST be alphanumeric.

La grammatica ABNF [ RFC2234 ] è quindi:

<value> = <uniqueID> "@" <scope>
<uniqueID> = (ALPHA / DIGIT) 0*126(ALPHA / DIGIT / "=" / "-")
<scope> = (ALPHA / DIGIT) 0*126(ALPHA / DIGIT / "-" / ".")

Strategie per la scelta dell'attributo sorgente

  • non usare identificatori dipendenti dal database o directory utenti come entryCSN (OpenLDAP) e GUID (Active Directory)
  • Non utilizzare codice fiscale (non opachi)

Definizione di SAML Pairwise-ID

A scoped, opaque, not reassignable, targeted pseudonym for a subject (person) – consultare Name Identifiers per chiarimenti sulla terminologia.

(https://wiki.oasis-open.org/security/SAMLSubjectIDAttr)
L'attributo è destinato a sostituire identificatori legacy come eduPersonTargetedID e SAML 2.0 persistent NameID.

Approfondimento: Perché è necessario adottare i nuovi Subject Identifiers?

Spiegazione

Come segnalare la richiesta di tali attributi da parte di un SP

I Service Provider segnalano la richiesta di ricevere "Subject Id" o "Pairwise Id" attraverso la dichiarazione nei metadata di uno specifico Entity Attribute.

I valori possibili per l'Entity Attribute sono subject-id, pairwise-id, any und none. Nel caso sia specificato any allora l'Identity Provider dovrebbe rilasciare pairwise-id.

Tale dichiarazione avviene escluvamente modificando i metadata del SP via IDEM Registry (https://registry.idem.garr.it/rr3) tramite il percorso Edit Provider -> Entity Attributes e selezionando quello opportuno tra:

  • SAML Profiles subject-id:req - subject-it
  • SAML Profiles subject-id:req - pairwise-id
  • SAML Profiles subject-id:req - any
  • SAML Profiles subject-id:req - none

Configurazione per supportare i nuovi standard in Shibboleth Idp e Sp

Identity Provider (>=4.0.0)

Per abilitare il supporto ed il rilascio di subject-id e pairwise-id è necessario:

  1. Modificare attribute-resolver.xml
  2. Modificare, se necessario, attribute-filter.xml (la versione di default già contiene le regole di rilascio opportune)
  3. Modificare, se necessario, services.xml

Attribute Resolver

Nel file "attribute-resolver.xml" si deve aggiungere la definizione dei 2 nuovi attributi con:

<!-- Schema: SAML Subject ID attributes -->
 
<AttributeDefinition id="samlPairwiseID" xsi:type="Scoped" scope="%{idp.scope}">
    <InputDataConnector ref="computed" attributeNames="computedId" />
</AttributeDefinition>

<!-- aggiungere la def di "computed" -->


<!-- subjectHash è di tipo "scripted" e prende in ingresso "idp.persistentId.sourceAttribute" -->
<!-- "idp.persistentId.sourceAttribute" subisce la funzione "salted hash" -->
<!-- subjectHash così generato viene usato in seguito come parte sinistra di "samlSubjectID" -->

<AttributeDefinition id="subjectHash" xsi:type="ScriptedAttribute" dependencyOnly="true">
    <InputDataConnector ref="myLDAP" attributeNames="%{idp.persistentId.sourceAttribute}" />
    <Script><![CDATA[
      var digestUtils = Java.type("org.apache.commons.codec.digest.DigestUtils");
      var saltedHash  = digestUtils.sha256Hex(%{idp.persistentId.sourceAttribute}.getValues().get(0) + "%{idp.persistentId.salt}");
      subjectHash.addValue(saltedHash);
    ]]></Script>
</AttributeDefinition>
 
<AttributeDefinition id="samlSubjectID" xsi:type="Scoped" scope="%{idp.scope}">
    <InputAttributeDefinition ref="subjectHash" />
</AttributeDefinition>

Attribute Filter

Nel file "attribute-filter.xml", all'interno dell'elemento <AttributeFilterPolicyGroup> deve essere presente la seguente regola:

    <!--
    Example rule for honoring Subject ID requirement tag in metadata.
    The example supplies pairwise-id if subject-id isn't explicitly required.
    -->
    <AttributeFilterPolicy id="subject-identifiers">
        <PolicyRequirementRule xsi:type="ANY" />

        <AttributeRule attributeID="samlPairwiseID">
            <PermitValueRule xsi:type="OR">
                <Rule xsi:type="EntityAttributeExactMatch"
                    attributeName="urn:oasis:names:tc:SAML:profiles:subject-id:req"
                    attributeNameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                    attributeValue="pairwise-id" />
                <Rule xsi:type="EntityAttributeExactMatch"
                    attributeName="urn:oasis:names:tc:SAML:profiles:subject-id:req"
                    attributeNameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                    attributeValue="any" />
            </PermitValueRule>
        </AttributeRule>

        <AttributeRule attributeID="samlSubjectID">
            <PermitValueRule xsi:type="EntityAttributeExactMatch"
                attributeName="urn:oasis:names:tc:SAML:profiles:subject-id:req"
                attributeNameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri"
                attributeValue="subject-id" />
        </AttributeRule>
    </AttributeFilterPolicy>

Services

Nel file services.xml va abilitato l'attribute-filter.xml contenente le regole per il rilascio di subject-id e pairwise-id

<util:list id ="shibboleth.AttributeFilterResources">
   <value>%{idp.home}/conf/attribute-filter.xml</value>
   <ref bean="IdemAttributeFilterFull"/>
</util:list>

Service Provider (>=3.0.0)

Per abilitare il supporto ed l'utilizzo di subject-id e pairwise-id è necessario:

  1. Modificare, se necessario, attribute-policy.xml
  2. Modificare attribute-map.xml
  3. Abilitare la richiesta su IDEM Entity Registry

Attribute Policy

Per richiedere il subject-id e pairwise-id per il proprio SP nel formato corretto:

<AttributeRule attributeID="subject-id">
   <PermitValueRuleReference ref="ScopingRules"/>
</AttributeRule>

<AttributeRule attributeID="pairwise-id">
   <PermitValueRuleReference ref="ScopingRules"/>
</AttributeRule>

Attribute Map

<!-- New standard identifier attributes for SAML. -->

<Attribute name="urn:oasis:names:tc:SAML:attribute:subject-id" id="subject-id">
   <AttributeDecoder xsi:type="ScopedAttributeDecoder" caseSensitive="false"/>
</Attribute>
  
<Attribute name="urn:oasis:names:tc:SAML:attribute:pairwise-id" id="pairwise-id">
   <AttributeDecoder xsi:type="ScopedAttributeDecoder" caseSensitive="false"/>
</Attribute>

IDEM Entity Registry

Configurare il valore del Subject-ID richiesto dalla scheda EntityAttribute di IDEM Entity Registry tenendo in considerazione che selezionando "Any" si riceverà prevalentemente il valore di pairwise-id in quanto più safe di subject-id.

Configurazione per per supportare i nuovi standard in SimpleSAMLphp Idp e Sp

Il supporto ufficiale alla generazione e al rilascio di subject-id e pairwise-id in SimpleSAMLphp arriva ufficialmente dalla v2.0.0.

Nella nuova versione di SimpleSAMLphp sono stati sviluppati 2 nuovi moduli per il loro supporto:

Identity Provider (>=2.0.0)

Gli Identity Provider che sono stati configurati secondo i nostri idem-tutorials per la v2.x sono già in grado di rilasciare subject-id e pairwise-id.

idem-attribute-filter.php da testare: https://gitlab.dir.garr.it/-/snippets/7

Service Provider

TBD