I seem to have my test setup of OnDemand 1.6 working quite well; since we’re extremely limited in routable IP addresses, I have been using ‘redir’ to just redirect connections from a high port on the head node to the (otherwise non-routable) system OOD is installed on with good success.
However, I realized that every logged connection in OOD has the address of the proxying server and not the actual origin. If I’m going to open OOD to internet logins, I expect I’ll need to use fail2ban to keep brute force attacks to a minimum and need to log the actual source address.
Is anyone successfully using a web proxy to do this with apache or nginx? If so, could you possibly share the configuration you’re using to do so?
I gave setting up a proxy from scratch a shot. I tried with apache 2.2 first, which seemed to work until I tried websocket apps; it’s too old to include support for websockets; however it does appear that the mod_proxy_wstunnel module resolves that problem for apache 2.4, and it apparently is backported to 2.2.
Since I had nginx 1.14.1 available, I gave that a try, and it appears to work nicely for proxying to Open OnDemand so far. My configuration was a modified version of what I had used when testing JupyterLab, so it may be less than ideal:
I believe all I need to do now is figure out how to properly set the Apache LogFormat via update_ood_portal to include the X-Forwarded-For (and perhaps related) headers to show the original source address. Then it’s a matter of configuring fail2ban.
Thanks for updating the topic with what you’ve done! We at OSC don’t run OOD behind a load balancer/proxy/VIP so we’re very interested in folks who do, and there have been several topics opened asking us how to do it.
Let us know how it turns out, what updates you make and how well it works for you! If you save the config or deployment scripts on Github let us know.
At my site we are in the progress of setting up a proxy for ondemand with haproxy. It works very well for now, with just a small addition to ood-portal-generator (https://github.com/OSC/ondemand/pull/74)
if anyone is interested I can share parts of our config.
We’re very interested @wdpypere. I’d suggest open sourcing some templated configs in ruby’s ERB or python jinja2, that way you don’t have to show anything that’s secret while still showing the entire configuration file(s).
Awesome, this topic now seems to have proxy configs for Apache httpd, Nginx and HAProxy. Thanks so much! We’d love to see more like github repos or blog posts about how to set this up, what your architecture looks like, challenges, failure modes, etc. Whatever you want to share, we’d love to see it.
When using Haproxy as LoadBalancer, certain applications like “shell” timeout with the message “your connection to remote server has been terminated” with-in a minute of inactivity
This is due to the default timeout configured for websockets in haproxy is 50s
you can increase the timeout by adding the following to your backend config in /etc/haproxy/haproxy.cfg file
in https://{hostname}:5554/.well-known/openid-configuration ?
It seems to me it is generated from field issuer defined in dex/config.yaml beeing autogenerated from FQDN of dex portal host. Instead of that, it should be, IMO, the FQDN of reverse proxy.