Control de acceso: XACML, SAMLceleste/docencia/doctorado/2006/AC-XACML.pdf · 1 Control de acceso:...

Post on 30-Apr-2020

7 views 0 download

Transcript of Control de acceso: XACML, SAMLceleste/docencia/doctorado/2006/AC-XACML.pdf · 1 Control de acceso:...

1

Control de acceso:XACML, SAML

Computación Ubicua. Curso de doctoradoAndrés Marín López amarin@it.uc3m.es

Marzo 2005

Índice

Introducción al control de accesoXACMLSAML

2

Introduction to Access Control

John quiere acceso a “PatientRecord1.doc”

Authentication Authorization

(Access Control)

File Server

“PatientRecord1.doc”

“PatientRecord2.doc”

…Soy John,

Mi contraseña es X#$@!

Quiero “PatientRecord1.doc”

1. Es usuario válido

2. Es contraseña válida

1. Puede John acceder a

“PatientRecord1.doc”

<John(X#$@>), “PatientRecord1.doc”, R>

<John, “PatientRecord1.doc”, R>

<Bob, “PatientRecord2.doc”, R>

<Bill, “PatientRecord1.doc”, W>

Definiciones

<John “PatientRecord.doc”, R>

{Request}

<John, “PatientRecord1.doc”, R>

<Bob, “PatientRecord2.doc”, R>

<Bill, “PatientRecord1.doc”, W>

{Policy or Access Control List (ACL)}

Permit

{Response}VS

<S, O, A>

{Request}

<S, O, A>*

{Access Control List (ACL)}

<D>*

{Response}VS

S – Subject, O – Object, A – Action, D - Decision

3

Autenticación, gestión de indentidad(Version 2.0)

OASIS SAML (SecurityAssertion Markup Language)

Gestión de relaciones de confianzaWS-Trust (Web Services Trust Language)

Gestión de identidadWS-Federation (Web Services Federation

Language)

Integridad, no repudio, Confidencialidad(mensajes)

OASIS Web Services Security

Authorización/Control de accesoXACML (Extensible Access Control Markup Language)

Integridad, no repudio, confidencialidad(sesiones)

WS-SecureConversation(Web Services Secure

Conversation Language)

Gestión de identidadThe Liberty Alliance

Requisitos de seguridadEspecificación

XACML

Introducción a XACMLXACML schema.XACML framework.Instalación y uso del paquete XACML Detalles de XACMLEjemplosExtensiones de usuario a XACML

4

Introducción a XACML

John quiere acceder a “PatientRecord1.doc”Request Context XACML Policy Response Context

<rule effect=“permit”>

<target>

<subject>

<value>John</value>

</subject>

<resource> <value>PatientRecord1.doc</value>

</resource>

<action>

<value>R</value>

</action>

</target>

</rule>

<request>

<subject>

<value>John</value>

</subject>

<resource> <value>PatientRecord1.doc</value>

</resource>

<action>

<value>R</value>

</action>

</request>

<response>

<decision>

<value>Permit</value>

</decision>

</response>

Introduction to XACML contd.

Authorization

File

PDP

P

E

P

Server

0. XACML Policy Repository

2. Request

XACML Compliant3. Response

1. Authenticated Request

PEP – Policy Enforcement Point

PDP – Policy Decision Point

4. Decision Enforcement

How does XACML Work?

5

XACML Schemas

Policy SchemaRequest Schema Response Schema

PolicySet (Combining Alg)

Policy* (Combining Alg)

Rule* (Effect)

Subject*

Resource*

Action

Condition*

Obgligation*

Request

Subject

Resource

Action

Response

Decision

Obligation*

XACML Framework (Data flow model)

6

XACML Framework (Policy Language Model)

Instalación y uso de XACML

Implementaciones disponiblesSun Microsystems (http://sunxacml.sourceforge.net/)

necesita “ant” (http://ant.apache.org)incluir sunxacml.jar en el class path.

Jiffy Software (http://www.jiffysoftware.com/)

7

Uso de la implementación de XACML

http://sunxacml.sourceforge.net/guide.html#usingDescripción de APIsConstrucción de un PDP básicoConstrucción de un PEP básicoValidación de políticas y peticiones

Detalles de XACML

Combinaciones de políticas y reglasMúltiples sujetosAtributosCondicionesObligacionesFuncionesEvaluaciónDelegación

8

Combinación de políticas y reglas

Algoritmos:Permit Overrides:

Si una regla permite una solicitud, el resultado del PDP es Permit, independientemente del resto de las reglas

Deny Overrides:Si una regla prohibe una solicitud el resultado es Deny

First Applicable:El resultado es el de la primera regla aplicable

Only-one-applicable:Si dos reglas con distintos efectos se pueden aplicar, el resultado es indeterminado

Múltiples sujetos

A menudo es necesario plantear requisitos sobre múltiples sujetos al control de acceso

Una transacción financiera puede requerir la aprobación de distintos individuosXACML propone el atributo subject-category

En ocasiones el control de acceso se hace en función de alguna caracteritica del individuo distinta de su identidad

rfc822Name, patientID, etc.XACML propone el atributo SubjectAttributeDesignator

9

Atributos

Permiten diferenciar instancias distintas de elementosLos operadores los utilizan para aplicar las reglasHay conjuntos de atributos (Set)Cuando queremos recuperar atributos podemos encontrar con enumeraciones que contengan múltiples valores por atributo, para esto utilizamos los bags

Condiciones

Utilización de expresiones booleanasUtilización de variables de contexto: tiempo, etc.

John puede acceder a patientrecord1.doc desde las 9am hasta las 4pm.

10

Obligaciones

Operaciones que deben ser realizadas de acuerdo a una política o conjunto de políticas para poder llegar(enforce) a una decisión de autorización

ObligationIDFulfillOnAttributeAssignment

Las obligaciones quedan a elección de la autoridadEnviar un correo informando de la decisiónPresentar un certificado de atributosEtc.

Funciones de XACML

Predicados de igualdadAritméticas y predicados aritméticosConversión de StringsConversión de tipos de números (float, double, etc.)LógicasFechas y tiemposSetEtc.

11

Evaluación target

“Indeterminate”“Indeterminate”Don't careDon't careDon't care

“Indeterminate”Don't care“Indeterminate”Don't careDon't care

“Indeterminate”Don't careDon't care“Indeterminate”Don't care

“Indeterminate”Don't careDon't careDon't care“Indeterminate”

“No match”“No match”“Match” or “No match”

“Match” or “No match”

“Match” or “No match”

“No match”“Match” or “No match”

“No match”“Match” or “No match”

“Match” or “No match”

“No match”“Match” or “No match”

“Match” or “No match”

“No match”“Match” or “No match”

“No match”“Match” or “No match”

“Match” or “No match”

“Match” or “No match”

“No match”

“Match”“Match”“Match”“Match”“Match”

Target valueEnvironments value

Actions valueResources value

Subjects value

Evaluación subject

“No match”All “No match”

“Indeterminate”None matches and at least one “Indeterminate”

“Match”At least one “Match”

<Subjects> Value<Subject> values

12

Evaluación rule

“Indeterminate”Don’t care“Indeterminate”

“NotApplicable”

Don’t care“No-match”

“Indeterminate”“Indeterminate”

“Match”

“NotApplicable”

“False”“Match”

Effect“True”“Match”

Rule ValueConditionTarget

Evaluación policy

“Indeterminate”Don’t care“Indeterminate”

“NotApplicable”Don’t care“No-match”

Specified by the rule-combining algorithm

At least one rule value is “Indeterminate”

“Match”

“NotApplicable”All rule values are “NotApplicable”

“Match”

Specified by the rule-combining algorithm

At least one rule value is its Effect

“Match”

Policy ValueRule valuesTarget

13

Evaluación policy set

“Indeterminate”Don’t care“Indeterminate”

“NotApplicable”Don’t care“No-match”

Specified by the policy-combining algorithm

At least one policy value is “Indeterminate”

“Match”

“NotApplicable”All policy values are “NotApplicable”

“Match”

Specified by the policy-combining algorithm

At least one policy value is its Decision

“Match”Policy Set ValuePolicy valuesTarget

Delegación

XACML permite delegación dinámica (versión 2.0)Para ello incluye administración de políticasPermite crear políticas dinámicamente que expresen:

Si yo estoy autorizado a hacer algo, puedo delegarlo en alguienSi yo puedo delegar algo, siempre puedo hacerlo creando la política que se refiere a mí

Las políticas pueden incluir un PolicyIssuer, si no lo hacen se sobreentiende el trusted issuer

14

Ejemplo

Cuatro políticas:1. Trusted issuer, un empleado puede

imprimir, Carol puede crear nuevas políticas para delegar en administradores

2. Carol, un empleado puede imprimir, Bobpuede delegar en cualquiera

3. Mallory, Alice puede imprimir4. Bob, Alice puede imprimir

Ejemplo<PolicySet>

<Target/>

<Policy PolicyId="Policy 1"PolicyCombiningAlgId="urn:oasis:names:tc:xacml:1.0:policy-combining-algorithm:permit-overrides"><Target>

<Subjects><Subject>

<SubjectMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">

<AttributeValueDataType=http://www.w3.org/2001/XMLSchema#string

>employee</AttributeValue><SubjectAttributeDesignator

AttributeId="group" DataType="http://www.w3.org/2001/XMLSchema#string"/>

</SubjectMatch></Subject>

</Subjects><Resources>

<Resource><ResourceMatch

MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">printer</AttributeValue><ResourceAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ResourceMatch></Resource>

</Resources><Actions>

<Action><ActionMatch

MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">print</AttributeValue><ActionAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ActionMatch></Action>

</Actions>

15

<Delegates><Delegate>

<DelegateMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">Carol</AttributeValue><DelegateAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</DelegateMatch></Delegate>

</Delegates></Target>

<Rule RuleId="Rule1" Effect="Permit"><Target/><Condition>

<IndirectDelegatesConditionFunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"

AttributeId="group"DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string"

>administrator</AttributeValue></IndirectDelegatesCondition>

</Condition></Rule>

</Policy>

RuleCombiningAlgId urn:oasis:names:tc:xacml:1.0:rule combining algorithm:permit overrides ><PolicyIssuer>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>Carol</AttributeValue></Attribute>

</PolicyIssuer><Target>

<Subjects><Subject>

<SubjectMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">

<AttributeValueDataType="http://www.w3.org/2001/XMLSchema#string"

>employee</AttributeValue><SubjectAttributeDesignator

AttributeId="group" DataType="http://www.w3.org/2001/XMLSchema#string"/>

</SubjectMatch></Subject>

</Subjects><Resources>

<Resource><ResourceMatch

MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">printer</AttributeValue><ResourceAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ResourceMatch></Resource>

</Resources><Actions>

<Action><ActionMatch

MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">print</AttributeValue><ActionAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ActionMatch>

16

<Delegates><Delegate><DelegateMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValueDataType="http://www.w3.org/2001/XMLSchema#string">Bob</AttributeValue>

<DelegateAttributeDesignatorAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</DelegateMatch></Delegate>

</Delegates></Target><Rule RuleId="Rule1" Effect="Permit"><Target/>

</Rule></Policy>

<Policy PolicyId="Policy 3"RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides"><PolicyIssuer><AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>Mallory</AttributeValue></Attribute>

</PolicyIssuer><Target><Subjects><Subject><SubjectMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">Alice</AttributeValue><SubjectAttributeDesignatorSubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</SubjectMatch></Subject>

</Subjects><Resources><Resource><ResourceMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">printer</AttributeValue><ResourceAttributeDesignatorAttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ResourceMatch></Resource>

</Resources><Actions><Action><ActionMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">print</AttributeValue><ActionAttributeDesignatorAttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ActionMatch></Action>/A ti

17

<Policy PolicyId="Policy 4"RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides"><PolicyIssuer>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>Bob</AttributeValue></Attribute></PolicyIssuer>

<Target><Subjects>

<Subject><SubjectMatch

MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">Alice</AttributeValue><SubjectAttributeDesignator

SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</SubjectMatch></Subject></Subjects>

<Resources><Resource>

<ResourceMatchMatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">printer</AttributeValue><ResourceAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ResourceMatch></Resource></Resources>

<Actions><Action><ActionMatch

MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue

DataType="http://www.w3.org/2001/XMLSchema#string">print</AttributeValue><ActionAttributeDesignator

AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string"/>

</ActionMatch></Action></Actions></Target>

P it

Alice quiere imprimir<Request><Subject

SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"><Attribute

AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>Alice</AttributeValue></Attribute><Attribute

AttributeId="group"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>employee</AttributeValue></Attribute>

</Subject><Resource>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>printer</AttributeValue></Attribute>

</Resource><Action>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>print</AttributeValue></Attribute>

</Action>

</Request>

18

Las reglas 3 y 4 lo permiten…

… pero hay que reducirlas al trusted issuer

Reduciendo la 3: se genera la Administrative request

<Request><Subject

SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"><Attribute

AttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>Alice</AttributeValue>

</Attribute><Attribute

AttributeId="group"DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>employee</AttributeValue>

</Attribute></Subject><Resource>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>printer</AttributeValue>

</Attribute></Resource><Action>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>print</AttributeValue>

</Attribute></Action><Delegate>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string"><AttributeValue>Mallory</AttributeValue>

</Attribute></Delegate>

</Request>

19

Reduciendo la 3…

Access Request

Policy 1Trusted: N/A

Policy 2Carol: N/A

Policy 3Mallory: Permit

Policy 4Bob: Permit

Adminstrative Request 1

Policy 1Trusted: N/A

Policy 2Carol: N/A

Policy 4Bob: N/A

PolicySet

Sin éxito, No aplicable

Reduciendo la 4: se genera la Administrative request

<Request><Subject

SubjectCategory="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject"><AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>Alice</AttributeValue></Attribute> <Attribute

AttributeId="group"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>employee</AttributeValue></Attribute>

</Subject><Resource>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>printer</AttributeValue></Attribute>

</Resource><Action>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>print</AttributeValue></Attribute>

</Action><Delegate>

<AttributeAttributeId="urn:oasis:names:tc:xacml:1.0:subject:subject-id"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>Bob</AttributeValue></Attribute><Attribute

AttributeId="group"DataType="http://www.w3.org/2001/XMLSchema#string">

<AttributeValue>administrator</AttributeValue></Attribute>

</Delegate></Request>

20

Reduciendo la 4

Bien! Carol puede hacerlo. Seguimos reduciendo la 2

Reduciendo la 2

21

Ya tenemos un Trusted!

Y el resultado es que se autoriza

Access Request

Policy 1Trusted: N/A

Policy 2Carol: N/A

Policy 3unauthorized

Policy 4Trusted: Permit

PolicySet

22

Extensiones de usuario

http://sunxacml.sourceforge.net/guide.html#extending

AtributosFuncionesAlgoritmos de combinación de políticas y reglasMódulos para encontrar reglas y políticas.

SAML

XACML necesita de un protocolo que tranporte sus solicitudes y respuestasSAML define un protocolo válido, en el que realizar las aserciones de autenticación y autorización, y un mecanismo para acompañarlasXACML se utiliza entonces para definir las reglas necesarias para tomar las decisiones de autorización

23

SAML SSO

Un usuario quiere acceder a un recurso de un sitio B

El usuario se autentica en su propio sitio (A)Desde A el usuario solicita el recurso de BA redirige al usuario a B con un tokenEl PEP de B examina la solicitud con su PDPEl PDP de B puede pedir autenticación SAML (aserción) pasando el token de vuelta a AA devuelve la prueba de autenticación B devuelve el recurso solicitado al usuario

Perfil de SAML 2.0 para XACML 2.0

24

Referencias

www.oasis-open.orgXACML SpecificationEspecificación de SAML 2.0

Sun’s XACML Implementationhttp://www.ibm.com/developerworks/xml/library/x-xacml/

XML Security“The Current and Emerging State of Web Services Standards” J. Chiusano“XACML”, Kailash Bhoopalam