<div dir="ltr"><div>Hi, I&#39;m running into a loop problem with Shibboleth over SSL. But it doesn&#39;t appear to be any of the usual issues that people run into. Basically, it looks like the /Shibboleth.sso/SAML2/POST request is not sending a cookie in the response and therefore not setting a cookie in the browser and so I get stuck in an authentication loop.</div>
<div><br></div><div>I&#39;ve reviewed the [looping page](<a href="https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLooping">https://wiki.shibboleth.net/confluence/display/SHIB2/NativeSPLooping</a>) and [flows and config](<a href="https://wiki.shibboleth.net/confluence/display/SHIB2/FlowsAndConfig">https://wiki.shibboleth.net/confluence/display/SHIB2/FlowsAndConfig</a>). </div>
<div><br></div><div>I&#39;ve verified that all of my requests are happening over SSL.</div><div><br></div><div>I&#39;m seeing the following requests:</div><div><br></div><div>- GET <a href="https://myserver.cascadeserver.com">https://myserver.cascadeserver.com</a> - redirects to IDP</div>
<div>- GET <a href="https://idp.school.edu">https://idp.school.edu</a> - sets _idp_authn_lc_key cookie for <a href="http://idp.blah.com">idp.blah.com</a></div><div>- POST <a href="https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST">https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST</a> - post data includes a RelayState and a SAMLResponse but the server response doesn&#39;t set a cookie. It does include a redirect to my &quot;target&quot; <a href="https://myserver.cascadeserver.com/login.act">https://myserver.cascadeserver.com/login.act</a></div>
<div>- GET <a href="https://myserver.cascadeserver.com">https://myserver.cascadeserver.com</a> - because no cookie was set during the POST, none is passed in this request and again no cookie is set in the response</div><div>
 </div><div> and then it goes back to the IDP and loops indefinitely.</div><div><br></div><div>I&#39;ve set both shibd.logger and native.logger root category to DEBUG and attached the logging from 3 cycles of the loop below.</div>
<div><br></div><div>I&#39;m surprised I&#39;m not seeing any logging about it unpacking the SAMLResponse and extracting the attributes. Is that to be expected?</div><div><br></div><div>I&#39;m not seeing any problems per se. The main &quot;symptom&quot; is that the cookies are not getting sent in the response, not being set in my browser and thus not being sent in the subsequent requests.</div>
<div><br></div><div>Thanks!</div><div><br></div><div>shibd.log</div><div><br></div><div>2013-11-04 14:35:02 DEBUG Shibboleth.Listener [1]: dispatching message (default/Login::run::SAML2SI)</div><div>2013-11-04 14:35:02 DEBUG XMLTooling.StorageService [1]: inserted record (0f9eddbece19507bdf266a30e335ae15a8c5ab30fd43990a9d11c72dae0c480e) in context (RelayState) with expiration (1383594302)</div>
<div>2013-11-04 14:35:02 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: validating input</div><div>2013-11-04 14:35:02 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: marshalling, deflating, base64-encoding the message</div>
<div>2013-11-04 14:35:02 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: marshalled message:</div><div>&lt;samlp:AuthnRequest xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot; AssertionConsumerServiceURL=&quot;<a href="https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST">https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST</a>&quot; Destination=&quot;<a href="https://idp.school.edu/idp/profile/SAML2/Redirect/SSO">https://idp.school.edu/idp/profile/SAML2/Redirect/SSO</a>&quot; ID=&quot;_333270a428b0ef2cebaabc0493d38a76&quot; IssueInstant=&quot;2013-11-04T19:35:02Z&quot; ProtocolBinding=&quot;urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&quot; Version=&quot;2.0&quot;&gt;&lt;saml:Issuer xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;&gt;<a href="https://myserver.cascadeserver.com/shibboleth">https://myserver.cascadeserver.com/shibboleth</a>&lt;/saml:Issuer&gt;&lt;samlp:NameIDPolicy AllowCreate=&quot;1&quot;/&gt;&lt;/samlp:AuthnRequest&gt;</div>
<div>2013-11-04 14:35:02 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: message encoded, sending redirect to client</div><div>2013-11-04 14:35:03 DEBUG Shibboleth.Listener [1]: dispatching message (default/Login::run::SAML2SI)</div>
<div>2013-11-04 14:35:03 DEBUG XMLTooling.StorageService [1]: inserted record (dc774a67d7c09ceddcdcecfcd61205c61edfb9439e13490ae55641968225f166) in context (RelayState) with expiration (1383594303)</div><div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: validating input</div>
<div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: marshalling, deflating, base64-encoding the message</div><div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: marshalled message:</div>
<div>&lt;samlp:AuthnRequest xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot; AssertionConsumerServiceURL=&quot;<a href="https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST">https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST</a>&quot; Destination=&quot;<a href="https://idp.school.edu/idp/profile/SAML2/Redirect/SSO">https://idp.school.edu/idp/profile/SAML2/Redirect/SSO</a>&quot; ID=&quot;_51062bd5050319691cb4850db5c227b0&quot; IssueInstant=&quot;2013-11-04T19:35:03Z&quot; ProtocolBinding=&quot;urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&quot; Version=&quot;2.0&quot;&gt;&lt;saml:Issuer xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;&gt;<a href="https://myserver.cascadeserver.com/shibboleth">https://myserver.cascadeserver.com/shibboleth</a>&lt;/saml:Issuer&gt;&lt;samlp:NameIDPolicy AllowCreate=&quot;1&quot;/&gt;&lt;/samlp:AuthnRequest&gt;</div>
<div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: message encoded, sending redirect to client</div><div>2013-11-04 14:35:03 DEBUG Shibboleth.Listener [1]: dispatching message (default/Login::run::SAML2SI)</div>
<div>2013-11-04 14:35:03 DEBUG XMLTooling.StorageService [1]: inserted record (5cbe51db3513eb20a5e825f8b3d0789f1a30c0720fb0d3d6ff89ad43996fb269) in context (RelayState) with expiration (1383594303)</div><div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: validating input</div>
<div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: marshalling, deflating, base64-encoding the message</div><div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: marshalled message:</div>
<div>&lt;samlp:AuthnRequest xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot; AssertionConsumerServiceURL=&quot;<a href="https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST">https://myserver.cascadeserver.com/Shibboleth.sso/SAML2/POST</a>&quot; Destination=&quot;<a href="https://idp.school.edu/idp/profile/SAML2/Redirect/SSO">https://idp.school.edu/idp/profile/SAML2/Redirect/SSO</a>&quot; ID=&quot;_86341d1ac119e7f14359d1f4194eb857&quot; IssueInstant=&quot;2013-11-04T19:35:03Z&quot; ProtocolBinding=&quot;urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&quot; Version=&quot;2.0&quot;&gt;&lt;saml:Issuer xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;&gt;<a href="https://myserver.cascadeserver.com/shibboleth">https://myserver.cascadeserver.com/shibboleth</a>&lt;/saml:Issuer&gt;&lt;samlp:NameIDPolicy AllowCreate=&quot;1&quot;/&gt;&lt;/samlp:AuthnRequest&gt;</div>
<div>2013-11-04 14:35:03 DEBUG OpenSAML.MessageEncoder.SAML2Redirect [1]: message encoded, sending redirect to client</div><div><br></div><div><br></div><div>native.log</div><div><br></div><div>2013-11-04 14:35:02 DEBUG Shibboleth.Apache [16087] shib_check_user: mapped <a href="https://myserver.cascadeserver.com/">https://myserver.cascadeserver.com/</a> to default</div>
<div>2013-11-04 14:35:02 DEBUG Shibboleth.SessionInitiator.SAML2 [16087] shib_check_user: attempting to initiate session using SAML 2.0 with provider (<a href="https://idp.school.edu/idp/shibboleth">https://idp.school.edu/idp/shibboleth</a>)</div>
<div>2013-11-04 14:35:02 DEBUG Shibboleth.Listener [16087] shib_check_user: sending message (default/Login::run::SAML2SI)</div><div>2013-11-04 14:35:02 DEBUG Shibboleth.Listener [16087] shib_check_user: send completed, reading response message</div>
<div>2013-11-04 14:35:03 DEBUG Shibboleth.Apache [16087] shib_check_user: mapped <a href="https://myserver.cascadeserver.com/login.act">https://myserver.cascadeserver.com/login.act</a> to default</div><div>2013-11-04 14:35:03 DEBUG Shibboleth.SessionInitiator.SAML2 [16087] shib_check_user: attempting to initiate session using SAML 2.0 with provider (<a href="https://idp.school.edu/idp/shibboleth">https://idp.school.edu/idp/shibboleth</a>)</div>
<div>2013-11-04 14:35:03 DEBUG Shibboleth.Listener [16087] shib_check_user: sending message (default/Login::run::SAML2SI)</div><div>2013-11-04 14:35:03 DEBUG Shibboleth.Listener [16087] shib_check_user: send completed, reading response message</div>
<div>2013-11-04 14:35:03 DEBUG Shibboleth.Apache [16087] shib_check_user: mapped <a href="https://myserver.cascadeserver.com/login.act">https://myserver.cascadeserver.com/login.act</a> to default</div><div>2013-11-04 14:35:03 DEBUG Shibboleth.SessionInitiator.SAML2 [16087] shib_check_user: attempting to initiate session using SAML 2.0 with provider (<a href="https://idp.school.edu/idp/shibboleth">https://idp.school.edu/idp/shibboleth</a>)</div>
<div>2013-11-04 14:35:03 DEBUG Shibboleth.Listener [16087] shib_check_user: sending message (default/Login::run::SAML2SI)</div><div>2013-11-04 14:35:03 DEBUG Shibboleth.Listener [16087] shib_check_user: send completed, reading response message</div>
<div><br></div><div><br></div><div>Here&#39;s my Apache config:</div><div><br></div><div>LoadModule mod_shib /usr/lib64/shibboleth/mod_shib_22.so</div><div><br></div><div># Ensures handler will be accessible.</div><div>&lt;Location /Shibboleth.sso&gt;</div>
<div>  Satisfy Any</div><div>  Allow from all</div><div>&lt;/Location&gt;</div><div><br></div><div>ProxyIOBufferSize 65536</div><div><br></div><div>&lt;VirtualHost *:80&gt;</div><div>  RewriteEngine on</div><div>  RewriteRule ^(.*)$ <a href="https://myserver.cascadeserver.com">https://myserver.cascadeserver.com</a>$1 [R=301,L]</div>
<div>&lt;/VirtualHost&gt;</div><div><br></div><div>&lt;VirtualHost *:443&gt;</div><div>  ServerName  <a href="http://myserver.cascadeserver.com">myserver.cascadeserver.com</a></div><div>  SSLEngine on</div><div>  SSLProxyEngine on</div>
<div>  SSLProtocol all</div><div>  SSLCertificateFile /path/to/crt</div><div>  SSLCertificateKeyFile /path/to/key</div><div>  SSLCertificateChainFile /path/to/intermediate_crt</div><div>  &lt;Location /&gt;</div><div>    AuthType shibboleth</div>
<div>    ShibRequestSetting requireSession 1</div><div>    require valid-user</div><div>  &lt;/Location&gt;</div><div><br></div><div>  ProxyPass / ajp://localhost:8009/</div><div>  ProxyPassReverse / ajp://localhost:8009/</div>
<div>&lt;/VirtualHost&gt;</div><div><br></div><div><br></div><div>Here&#39;s my shibboleth2.xml file:</div><div><br></div><div>&lt;SPConfig xmlns=&quot;urn:mace:shibboleth:2.0:native:sp:config&quot;</div><div>    xmlns:conf=&quot;urn:mace:shibboleth:2.0:native:sp:config&quot;</div>
<div>    xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;</div><div>    xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot;</div><div>    xmlns:md=&quot;urn:oasis:names:tc:SAML:2.0:metadata&quot;</div>
<div>    clockSkew=&quot;180&quot;&gt;</div><div><br></div><div>    &lt;ApplicationDefaults entityID=&quot;<a href="https://myserver.cascadeserver.com/shibboleth">https://myserver.cascadeserver.com/shibboleth</a>&quot;</div>
<div>                         REMOTE_USER=&quot;eppn uid persistent-id targeted-id&quot;</div><div>                         attributePrefix=&quot;AJP_&quot;&gt;</div><div><br></div><div>        &lt;Sessions lifetime=&quot;28800&quot; timeout=&quot;3600&quot; relayState=&quot;ss:mem&quot;</div>
<div>                  checkAddress=&quot;false&quot; handlerSSL=&quot;true&quot; cookieProps=&quot;https&quot;&gt;</div><div><br></div><div>            &lt;SSO entityID=&quot;<a href="https://idp.school.edu/idp/shibboleth">https://idp.school.edu/idp/shibboleth</a>&quot;&gt;</div>
<div>              SAML2</div><div>            &lt;/SSO&gt;</div><div>            &lt;Logout&gt;SAML2 Local&lt;/Logout&gt;</div><div>            &lt;Handler type=&quot;MetadataGenerator&quot; Location=&quot;/Metadata&quot; signing=&quot;false&quot;/&gt;</div>
<div>            &lt;Handler type=&quot;Status&quot; Location=&quot;/Status&quot; acl=&quot;127.0.0.1 ::1&quot;/&gt;</div><div>            &lt;Handler type=&quot;Session&quot; Location=&quot;/Session&quot; showAttributeValues=&quot;false&quot;/&gt;</div>
<div>            &lt;Handler type=&quot;DiscoveryFeed&quot; Location=&quot;/DiscoFeed&quot;/&gt;</div><div>        &lt;/Sessions&gt;</div><div><br></div><div>        &lt;Errors supportContact=&quot;<a href="mailto:support@hannonhill.com">support@hannonhill.com</a>&quot;</div>
<div>            helpLocation=&quot;/about.html&quot;</div><div>            styleSheet=&quot;/shibboleth-sp/main.css&quot;/&gt;</div><div><br></div><div>        &lt;MetadataProvider type=&quot;XML&quot; uri=&quot;<a href="https://idp.school.edu/idp-metadata.xml">https://idp.school.edu/idp-metadata.xml</a>&quot;</div>
<div>              reloadInterval=&quot;7200&quot;</div><div>              backingFilePath=&quot;example-metadata.xml&quot;&gt;</div><div>        &lt;/MetadataProvider&gt;</div><div><br></div><div>        &lt;AttributeExtractor type=&quot;XML&quot; validate=&quot;true&quot; reloadChanges=&quot;false&quot; path=&quot;attribute-map.xml&quot;/&gt;</div>
<div><br></div><div>        &lt;AttributeResolver type=&quot;Query&quot; subjectMatch=&quot;true&quot;/&gt;</div><div>        &lt;AttributeFilter type=&quot;XML&quot; validate=&quot;true&quot; path=&quot;attribute-policy.xml&quot;/&gt;</div>
<div><br></div><div>        &lt;!-- CredentialResolver type=&quot;File&quot; key=&quot;/path/to/key&quot; certificate=&quot;/path/to/crt&quot; / --&gt;</div><div>    &lt;/ApplicationDefaults&gt;</div><div><br></div><div>    &lt;SecurityPolicyProvider type=&quot;XML&quot; validate=&quot;true&quot; path=&quot;security-policy.xml&quot;/&gt;</div>
<div>    &lt;ProtocolProvider type=&quot;XML&quot; validate=&quot;true&quot; reloadChanges=&quot;false&quot; path=&quot;protocols.xml&quot;/&gt;</div><div>&lt;/SPConfig&gt;</div><div><br></div></div>