Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempting to bypass external authentication for API results in Exception: HTTP_REMOTE_USER not provided #3265

Closed
lparsons opened this issue Dec 5, 2016 · 10 comments
Assignees

Comments

@lparsons
Copy link
Contributor

lparsons commented Dec 5, 2016

We use Apache and mod_auth_cas for external authentication. When setting up the API bypass we experience exceptions in the main interface when requesting histories.

File '/galaxy/galaxy-app/lib/galaxy/web/framework/webapp.py', line 432 in _ensure_valid_session
  "use_remote_user is set but %s header was not provided" % self.app.config.remote_user_header
AssertionError: use_remote_user is set but HTTP_REMOTE_USER header was not provided

Gist of full stack trace

@lparsons
Copy link
Contributor Author

lparsons commented Dec 5, 2016

@dannon, I know you worked on something related to this in the past. Am I missing something?

@lparsons
Copy link
Contributor Author

lparsons commented Dec 5, 2016

Possibly related: #972

@hexylena
Copy link
Member

hexylena commented Dec 5, 2016

@lparsons I use mod_auth_cas too!

Which version of galaxy are you on? Might also be affected by #1003

@lparsons
Copy link
Contributor Author

lparsons commented Dec 5, 2016

@erasche I'm using release_16.07 right now, though I'm considering moving to bleeding edge release_16.10 due to conda issues.

Do you have a way to use the API at the moment (i.e. setting up a bypass)?

@hexylena
Copy link
Member

hexylena commented Dec 5, 2016

Huh, odd. I'm on release_16.07 as well. My apache conf looks like:

    <Location "/galaxy/api/">
        Satisfy Any 
        Allow from all
    </Location>

    <Location "/galaxy">
        AuthName "CAS"
        AuthType CAS
        Require valid-user
        RequestHeader set X-URL-SCHEME https
        XSendFile on
        XSendFilePath /
        RequestHeader set CAS-User "%{REMOTE_USER}s@tamu.edu"
    </Location>
    ProxyPass /galaxy uwsgi://127.0.0.1:4001/

@lparsons
Copy link
Contributor Author

lparsons commented Dec 8, 2016

From IRC discussion with @dannon:

This issue comes up only when there is no API and the remote_user_header is not set at all during an API request. If the remote_user_header is set, but blank, everything works, since Galaxy falls back to the users existing web session.

The assertion at line 431 of webapp.py causes the problem. This assertion does not appear to be necessary and should very likely be removed (or at least changed to a log.debug message).

@dannon
Copy link
Member

dannon commented Dec 8, 2016

@lparsons Thanks for documenting this! I started refactoring that, and there's a bit more we need to handle beyond removing it, but hopefully I'll be able to get something in soon.

@dannon dannon self-assigned this Dec 8, 2016
@dannon
Copy link
Member

dannon commented May 11, 2017

@lparsons Forgot to update this issue, but can you verify this is resolved with the refactoring from #3976?

@lparsons
Copy link
Contributor Author

@dannon Sorry, I don't have a way to really test this beyond my production system, where I've already implemented the workaround of making sure the remote_user_header is set, but blank.

@dannon
Copy link
Member

dannon commented May 11, 2017

Ok, no worries. I'm pretty sure this resolves the issue you were seeing, feel free to reopen this if you do see it again.

@dannon dannon closed this as completed May 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants