-
Notifications
You must be signed in to change notification settings - Fork 40
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
Cannot set an env var (GSSPROXY_SOCKET) that mod_auth_gssapi will use #287
Comments
The environment variable for GSSPROXY_SOCKET is observed by the gssproxy mechglue plugin in gssapi and mod_auth_gssapi is completely oblivious to that. The env var is a process level variable and would require httpd to set this variable and fork before gssproxy client libs are ever used because gssproxy client libs tend to cache the file descriptor used to communicate to the server. If you can force httpd to execute different virtualhosts as different users that will be easier to manage with a single socket and just configuration I believe. If that will not work, I am afraid a gssproxy enhancement request need to be raised and some design done on that side. |
Interesting, thanks. My app is a wsgi app and I can set it to run as a different user, but I think mod_auth_gssapi works before that, no? |
can you check gssproxy to see if new connections are being made or if apahce opened a connection early and then child processes just keep using the same connections they inherit from the parent ? |
Uhm actually the client will detect a fork or a change in euid/egid and reopen the socket ... so it seem like apache is running the authentication code before handing the request to a forked process ? |
Sure! When I run curl on the second app, I get 3 connections to the "ipa-httpd" service, which is the service for the apache user, not the one for the user the second app is running as (fasjson):
In the Apache error log I get a message because the principal for fasjson is not found in IPA's keytab, of course: My apache config for FASJSON:
And the gssproxy config:
The HTTP and gssproxy configs for IPA are the default ones, I didn't change anything there. |
Ah I see, you are running the WSGI app as a user, but auth happens always in apache way before stuff is send down to the pipe talking to the python app. Should probbably look into apahce-mtm-itk which can run the whole apache's virtualhost handling as a different user. |
Cool, thanks for the tip! I tried with |
Alright, it does work with mpm-itk, but it requires adjustments it a few places and I'd rather not change IPA's environment too much, so I'll stop here and put IPA in its own VM. Thanks for the help though! |
mod_auth_gssapi can't on its own, it would be a toggle somehow exposed by the gssproxy mechanism. But that mechanism is designed to be transparent to GSSAPI applications ... so ... not so easy. This is how the thing works: Httpd -> mod_auth_gssapi -> libgssapi -> [gssproxy-mechanism -> gssproxy-client] ===> gssproxy-daemon -> libgssapi -> krb5-mechanism (Where -> means dynamic linking, and ===> means socket communication, and [] is the component that deals with the env var) The thing that selects the socket is the gssproxy-mechanism/client part, which is a layered module that intercepts gssapi operations and shoves them into the gssproxy daemon. As you can see it is pretty deep into the chain, and wholly separated from what mod_auth_gssapi knows about. There are ways though, in theory, feel free to open a RFE against gssproxy. Thanks for the discussion it will be useful to others and for future plans. |
I have multiple web applications running with different keytabs and gssproxy. I use gssproxy's sockets to differentiate between them. For that, I need to pass the
GSSPROXY_SOCKET
environment variable tomod_auth_gssapi
, and I can't find a way to do it. I've tried:/etc/systemd/system/httpd.service.d/
, that works fine but I can't differentiate between the web apps running in the same apacheSetEnv
, which is documented not to work, and indeed it doesn'tSetEnvIf
, it doesn't work either (I triedSetEnvIf Host app.example.com GSSPROXY_SOCKET=/var/lib/gssproxy/app.sock
)RewriteRule
, and it doesn't work either. I triedRewriteCond %{HTTP_HOST} app.example.com \n RewriteRule .* - [E=GSSPROXY_SOCKET:/var/lib/gssproxy/app.sock]
. I did check with increased logging that the rule was matching on the request.Is there a way to pass an environment variable to mod_auth_gssapi, that is dependent on the virtualhost or even the request path? If so, it would be great if it could be added to the docs (here and/or in gssproxy's Apache doc). Thanks!
The text was updated successfully, but these errors were encountered: