techservicesillinois / elmr Goto Github PK
View Code? Open in Web Editor NEWIntegration service for services deployed in Docker containers needing Shibboleth authentication.
License: MIT License
Integration service for services deployed in Docker containers needing Shibboleth authentication.
License: MIT License
We found that elmrsample fails after redirecting to /auth/elmr/session with following error message:
HTTP Status 400 – Bad Request
Type Status Report
Message Failed to find a request attribute named Shib_Session_ID. Please check your web server configuration.
Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
Apache Tomcat/9.0.11
When I performed a curl against auth/elmr/session
, I received the following headers:
$ curl --cookie '__edu.illinois.techservices.elmr.serviceUrl=/foo/bar' -sD - http://127.0.0.1/auth/elmr/session
HTTP/1.1 302 302
Server: nginx/1.14.2
Date: Fri, 05 Apr 2019 19:05:37 GMT
Content-Length: 0
Connection: keep-alive
Set-Cookie: __edu.illinois.techservices.elmr.servlets.sessionKey=MTIzNA==; Path=/
Location: http://127.0.0.1/foo/bar
According to RFC 7234 we should assume that this page will be cached since no Cache-Control
headers are set:
Although caching is an entirely OPTIONAL feature of HTTP, it can be assumed that reusing a cached response is desirable and that such reuse is the default behavior when no requirement or local configuration prevents it.
It is not desirable that any page coming from elmrsample
be cached since it is wrapped with Shibboleth, and the content itself is not designed to be cacheable. Please ensure that all pages set the following Cache-Control
headers per Amazon's recommendations:
Cache-Control: no-cache, no-store
FYI This stack overflow thread gives a bunch of code examples in various languages including Java and Python. In addition, for backwards compatibility with all browers since the 90's it recommends the following settings:
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: 0
For modern browsers and caches the settings recommended by Amazon are sufficient. You can find more information about these directives from the RFC here. I will leave it to you to decide which recommendation to follow. I will test for no-cache, no-store
.
Elmr does not set the Secure
or HttpOnly
flags for the cookie it creates as can be seen here:
$ curl --cookie '__edu.illinois.techservices.elmr.serviceUrl=/foo/bar' -sD - http://127.0.0.1/auth/elmr/session
HTTP/1.1 302 302
Server: nginx/1.14.2
Date: Fri, 05 Apr 2019 19:05:37 GMT
Content-Length: 0
Connection: keep-alive
Set-Cookie: __edu.illinois.techservices.elmr.servlets.sessionKey=MTIzNA==; Path=/
Location: http://127.0.0.1/foo/bar
Secure
should be set to prevent the cookie from being sent in the clean:
When a cookie has the Secure attribute, the user agent will include the cookie in an HTTP request only if the request is transmitted over a secure channel (typically HTTP over Transport Layer Security (TLS) [RFC2818]).
https://tools.ietf.org/html/rfc6265#section-4.1.2.5
HttpOnly
should be set to prevent Javascript attacks:
The HttpOnly attribute limits the scope of the cookie to HTTP requests. In particular, the attribute instructs the user agent to omit the cookie when providing access to cookies via "non-HTTP" APIs (such as a web browser API that exposes cookies to scripts).
https://tools.ietf.org/html/rfc6265#section-4.1.2.6
elmr is logging at level FINE. If we want to suppress the FINE messages how would we do so?
Elmr was not working with following error message:
"Session key had no data associated with it"
We debugged some of the elmr code and found that a method is missing an implementation and added one. Please see commit 981cb40 and review it.
If I go to http://localhost/auth/elmr/config
then press logout (http://localhost/auth/elmr/session?mode=logout
) I receive the following error in the browser:
HTTP Status 500 – Internal Server Error
Type Exception Report
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
java.lang.NullPointerException
edu.illinois.techservices.elmr.servlets.SessionServlet.sessionDestroyed(SessionServlet.java:139)
edu.illinois.techservices.elmr.servlets.SessionServlet.service(SessionServlet.java:41)
javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
Note The full stack trace of the root cause is available in the server logs.
Apache Tomcat/9.0.11
@argherna @yoonlees FYI as written mod_jk.conf currently requires the use of the deprecated module mod_access_compat.so. This module is required because of the following lines of code:
<Location /elmr/session>
Allow from all
AuthType shibboleth
ShibRequestSetting requireSession 1
ShibRequestSetting ShibUseEnvironment 1
Require valid-user
</Location>
<Location /elmr/config>
Allow from all
AuthType shibboleth
ShibRequestSetting requireSession 1
ShibRequestSetting ShibUseEnvironment 1
Require valid-user
</Location>
We should replace the Allow directive with Require directives from the mod_authz_core module.
@argherna please consider the following curl commands:
$ curl -b cookie.txt -c cookie.txt -I http://127.0.0.1/elmrsample/attributes
HTTP/1.1 302
Server: nginx/1.14.0
Date: Wed, 07 Nov 2018 01:33:49 GMT
Connection: keep-alive
Set-Cookie: __edu.illinois.techservices.elmr.serviceUrl=/elmrsample/attributes; Path=/
Location: http://127.0.0.1/auth/elmr/session
$ curl -b cookie.txt -c cookie.txt -I http://127.0.0.1/auth/elmr/session
HTTP/1.1 302 302
Server: nginx/1.14.0
Date: Wed, 07 Nov 2018 01:34:13 GMT
Connection: keep-alive
Set-Cookie: __edu.illinois.techservices.elmr.servlets.sessionKey=LTcwNTEzNTYwNjYwNjE4MjExMQ==; Path=/
Location: http://127.0.0.1/elmrsample/attributes
$ curl -b cookie.txt -c cookie.txt -I http://127.0.0.1/auth/elmr/session
HTTP/1.1 302 302
Server: nginx/1.14.0
Date: Wed, 07 Nov 2018 01:34:37 GMT
Connection: keep-alive
Set-Cookie: __edu.illinois.techservices.elmr.servlets.sessionKey=OTQ3MjA4MzcxMTk3MzYyNzY5; Path=/
Location: http://127.0.0.1/elmrsample/attributes
Note that sessionKey changes between the first call to /auth/elmr/session
and the last call. This does not seem desirable to me. If the user's Shibboleth session has not changed then why should we change the session key ID? Also this could be a potential DoS attack. This would allow a single user to spam elmr with requests which would eventually blow out the Redis cache.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.