Prisma Cloud 计算:SAML请求和响应
11542
Created On 11/18/19 19:32 PM - Last Modified 03/02/23 02:31 AM
Symptom
SAML 是一种用于在各方之间交换身份验证和授权数据的开放标准,特别是在身份提供者和服务提供者之间。
- 服务提供者 (SP ) = 旋锁控制台 UI
- IdentityProvider (IdP) = SiteMinder,ADFS , Okta, AzureAD,PING Federate、Shibboleth 等
这SAML规范可以在这里找到: http://docs.oasis-open.org/security/saml/v2.0/saml-core-2.0-os.pdf
在本文中,我们概述了示例SAML身份验证请求和SAML回复,详细解释在每个回复中要寻找的内容。 目的是帮助提供故障排除指南SAML与 Twistlock 相关的问题。
Environment
- 软件即服务
- 自托管 19.11 或更高版本
Resolution
例子SAML身份验证请求从 Twistlock 发送到ADFS身份提供商
<samlp:AuthnRequest
AssertionConsumerServiceURL="https://console.lab.twistlock.com/api/v1/authenticate"
目的地 =“https://saml-adfs.ad.lab.twistlock.com/adfs/ls”
ID ="_56f9f278-c1b1-ed6d-ecc8-c3ce057b2a09" IssueInstant="2019-04-15T20:19:12Z"
ProtocolBinding="urn:oasis:names:tc:SAML :2.0:绑定:HTTP-POST " 版本 = "2.0"
xmlns:saml="urn:oasis:names:tc:SAML :2.0:断言“
xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<saml:Issuer>pfox-twistlock</saml:Issuer>
<samlp:RequestedAuthnContext Comparison="exact" xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:oasis:names:tc:SAML :2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:federation:authentication:windows</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>
</samlp:AuthnRequest>
AssertionConsumerServiceURL="https://console.lab.twistlock.com/api/v1/authenticate"
目的地 =“https://saml-adfs.ad.lab.twistlock.com/adfs/ls”
ID ="_56f9f278-c1b1-ed6d-ecc8-c3ce057b2a09" IssueInstant="2019-04-15T20:19:12Z"
ProtocolBinding="urn:oasis:names:tc:SAML :2.0:绑定:HTTP-POST " 版本 = "2.0"
xmlns:saml="urn:oasis:names:tc:SAML :2.0:断言“
xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<saml:Issuer>pfox-twistlock</saml:Issuer>
<samlp:RequestedAuthnContext Comparison="exact" xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:oasis:names:tc:SAML :2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:federation:authentication:windows</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>
</samlp:AuthnRequest>
在 AuthnRequest 中寻找的东西
AssertionConsumerServiceURL
AssertionConsumerServiceURL="https://console.twistlock.com/api/v1/authenticate"
这是 IdP 将用来将用户的浏览器重定向回 Twistlock 的端点。 这个值可以在控制管理>验证>SAML > “安慰URL“设置。 当 Twistlock 控制台位于代理后面时,通常设置此值,例如OpenShift 外部路由器或一个Istio 入口控制器. Twistlock 代码会将“/api/v1/authenticate”添加到您在字段中输入的值。 如果未设置此值,Twistlock 代码将自动生成此值。 该值必须与 IdP 的 Twistlock 匹配SP配置
发行人
<saml:Issuer>console-twistlock</saml:Issuer>
Twistlock 控制台的标识符。 每一个SAMLIdP 必须具有所有 SP 的唯一标识符。 默认情况下,Twistlock 将发送扭锁发行人。 您可以在观众Twistlock 控制台中的值SAML设置。
AuthnContextClassRef
<samlp:RequestedAuthnContext Comparison="exact" xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:oasis:names:tc:SAML :2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:federation:authentication:windows</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:oasis:names:tc:SAML :2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef>
<saml:AuthnContextClassRef xmlns:saml="urn:oasis:names:tc:SAML :2.0:assertion">urn:federation:authentication:windows</saml:AuthnContextClassRef>
</samlp:RequestedAuthnContext>
请求身份验证方法发生在 IdP。瓮:联合会:身份验证:窗户是为了ADFS支持 Windows 集成身份验证的 IdP。 一些 IdP 不知道如何处理这些值。 例如,CA SiteMinder 将出错SAML回应:
<StatusMessage>不支持带有 AuthnContexts 的 AuthnRequest!</StatusMessage>
在这种情况下,您将需要配置 SiteMinder IdP 以忽略 AuthnContextClassRef 值。
例子SAML来自的回应ADFSIdP 到 Twistlock
<samlp:Response Consent="urn:oasis:names:tc:SAML :2.0:同意:未指定“
目的地 =“https://console.lab.twistlock.com/api/v1/authenticate”
ID ="_3ac05c43-11b8-4fac-9063-0b0a5f83707f" InResponseTo="_56f9f278-c1b1-ed6d-ecc8-c3ce057b2a09"
IssueInstant="2019-04-15T20:21:59.095Z" 版本="2.0"
xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<发行人 xmlns="urn:oasis:names:tc:SAML :2.0:assertion">http://console.lab.twistlock.com/adfs/services/trust</Issuer>
<ds:签名 xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3. org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:参考URI="#_3ac05c43-11b8-4fac-9063-0b0a5f83707f">
<ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org /2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>ppj1biegltD2D701NL9Of+xDctgdChV166ja9E2DqtQ=</ds:DigestValue>
</ds:参考>
</ds:SignedInfo>
<ds:SignatureValue>Mh9dAnyo2CY0kz+cah8KVwwu7ZSWXO6ubyPOBk7CjD6CVHPfR2OFJ2S3fM695/usCWYud2CwQsdd1DVCDsnnAqifkGZiabHH38bBa9Jdv3YdWs3hoz4nqQbFesdQGV5QjL54Ip19FxFWUAxt4bKpundfP2h8OikRjkoi24QLVzSIcvuH/vkvz/DP7vF6e+YCbzu6BJDPWXf3TzvO6Og1mx4URDw2kycy83CHsB0mMJm3cfvb39DSLlnE6EvR+msUqoTWuLw==</ds:SignatureValue>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate></ds:X509Certificate>
</ds:X509Data>
</KeyInfo>
</ds:签名>
<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML :2.0:状态:成功"/></samlp:状态>
<断言ID="_d6029da5-a589" IssueInstant="2019-04-15T20:21:59.095Z"
Version="2.0" xmlns="urn:oasis:names:tc:SAML :2.0:断言“>
<发行人>http://saml-adfs.ad.lab.twistlock.com/adfs/services/trust</发行人>
<主题>
<NameID>pfox</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML :2.0:cm:bearer"><SubjectConfirmationData InResponseTo="_56f9f278-c1b1-ed6d-ecc8-c3ce057b2a09"
NotOnOrAfter="2019-04-15T20:26:59.095Z"
Recipient="https://console.lab.twistlock.com/api/v1/authenticate"/></SubjectConfirmation>
</主题>
<条件 NotBefore="2019-04-15T20:21:59.095Z" NotOnOrAfter="2019-04-15T21:21:59.095Z">
<观众限制>
<Audience>console-twistlock</Audience>
</观众限制>
</条件>
<属性声明>
<属性名称="组">
<AttributeValue>域管理员</AttributeValue>
<AttributeValue>域用户</AttributeValue>
<AttributeValue>TLAdmins</AttributeValue>
</属性>
</属性声明>
<AuthnStatement AuthnInstant="2019-04-15T20:21:59.032Z"
SessionIndex="_d6029da5-a589-4559-beaf-b734f45fd452">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML :2.0:ac:classes:PasswordProtectedTransport</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</断言>
</samlp:响应>
目的地 =“https://console.lab.twistlock.com/api/v1/authenticate”
ID ="_3ac05c43-11b8-4fac-9063-0b0a5f83707f" InResponseTo="_56f9f278-c1b1-ed6d-ecc8-c3ce057b2a09"
IssueInstant="2019-04-15T20:21:59.095Z" 版本="2.0"
xmlns:samlp="urn:oasis:names:tc:SAML :2.0:协议“>
<发行人 xmlns="urn:oasis:names:tc:SAML :2.0:assertion">http://console.lab.twistlock.com/adfs/services/trust</Issuer>
<ds:签名 xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/><ds:SignatureMethod Algorithm="http://www.w3. org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:参考URI="#_3ac05c43-11b8-4fac-9063-0b0a5f83707f">
<ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org /2001/10/xml-exc-c14n#"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>ppj1biegltD2D701NL9Of+xDctgdChV166ja9E2DqtQ=</ds:DigestValue>
</ds:参考>
</ds:SignedInfo>
<ds:SignatureValue>Mh9dAnyo2CY0kz+cah8KVwwu7ZSWXO6ubyPOBk7CjD6CVHPfR2OFJ2S3fM695/usCWYud2CwQsdd1DVCDsnnAqifkGZiabHH38bBa9Jdv3YdWs3hoz4nqQbFesdQGV5QjL54Ip19FxFWUAxt4bKpundfP2h8OikRjkoi24QLVzSIcvuH/vkvz/DP7vF6e+YCbzu6BJDPWXf3TzvO6Og1mx4URDw2kycy83CHsB0mMJm3cfvb39DSLlnE6EvR+msUqoTWuLw==</ds:SignatureValue>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate></ds:X509Certificate>
</ds:X509Data>
</KeyInfo>
</ds:签名>
<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML :2.0:状态:成功"/></samlp:状态>
<断言ID="_d6029da5-a589" IssueInstant="2019-04-15T20:21:59.095Z"
Version="2.0" xmlns="urn:oasis:names:tc:SAML :2.0:断言“>
<发行人>http://saml-adfs.ad.lab.twistlock.com/adfs/services/trust</发行人>
<主题>
<NameID>pfox</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML :2.0:cm:bearer"><SubjectConfirmationData InResponseTo="_56f9f278-c1b1-ed6d-ecc8-c3ce057b2a09"
NotOnOrAfter="2019-04-15T20:26:59.095Z"
Recipient="https://console.lab.twistlock.com/api/v1/authenticate"/></SubjectConfirmation>
</主题>
<条件 NotBefore="2019-04-15T20:21:59.095Z" NotOnOrAfter="2019-04-15T21:21:59.095Z">
<观众限制>
<Audience>console-twistlock</Audience>
</观众限制>
</条件>
<属性声明>
<属性名称="组">
<AttributeValue>域管理员</AttributeValue>
<AttributeValue>域用户</AttributeValue>
<AttributeValue>TLAdmins</AttributeValue>
</属性>
</属性声明>
<AuthnStatement AuthnInstant="2019-04-15T20:21:59.032Z"
SessionIndex="_d6029da5-a589-4559-beaf-b734f45fd452">
<AuthnContext>
<AuthnContextClassRef>urn:oasis:names:tc:SAML :2.0:ac:classes:PasswordProtectedTransport</AuthnContextClassRef>
</AuthnContext>
</AuthnStatement>
</断言>
</samlp:响应>
在响应中寻找的东西
发行人
<发行人>http://saml-adfs.ad.lab.twistlock.com/adfs/services/trust</发行人>
响应令牌发行人值匹配身份提供者颁发者中的价值SAML的设置ADFS身份提供商
ds:签名
这SAML响应令牌必须是签署回应或者签名响应 + 断言IdP 的签名证书必须加载到 IdP 的 Twistlock 设置中X.509证书Base64 格式的字段。
团体
<属性声明>
<属性名称="组">
<AttributeValue>域管理员</AttributeValue>
<AttributeValue>域用户</AttributeValue>
<AttributeValue>TLAdmins</AttributeValue>
</属性>
</属性声明>
<属性名称="组">
<AttributeValue>域管理员</AttributeValue>
<AttributeValue>域用户</AttributeValue>
<AttributeValue>TLAdmins</AttributeValue>
</属性>
</属性声明>
组映射要求SAML令牌必须包含团体宣称。 这可以包含一组组名,它们将与SAML中定义的组管理>验证>团体. 这可能需要一个自定义声明.
名字ID
<主题>
<NameID>pfox</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML :2.0:cm:bearer"><SubjectConfirmationData InResponseTo="_56f9f278-c1b1-ed6d"
NotOnOrAfter="2019-04-15T20:26:59.095Z"
Recipient="https://console.lab.twistlock.com/api/v1/authenticate"/></SubjectConfirmation>
</主题>
<NameID>pfox</NameID>
<SubjectConfirmation Method="urn:oasis:names:tc:SAML :2.0:cm:bearer"><SubjectConfirmationData InResponseTo="_56f9f278-c1b1-ed6d"
NotOnOrAfter="2019-04-15T20:26:59.095Z"
Recipient="https://console.lab.twistlock.com/api/v1/authenticate"/></SubjectConfirmation>
</主题>
nameid 属性必须存在并匹配 TwistlockSAML如果不使用组关联,则为用户名。