* PACS AT <
ouc...@gmail.com> [2018-10-26 17:08]:
> Thank you very much Peter. This was very helpful. I'm knew to memcached in
> general, so all of this has been a big learning experience. But I got it
> installed, running as a service, and after installing all the other
> prerequisites I installed the auth_memcookie apache module and got it
> running. (Using the new one you pointed out) . I have it almost working. My
> application redirects and comes back, just working on some kinks with these
> errors:
>
> PHP Fatal error: Class 'Memcache'
> not found in /home/simplesamlphp/modules/memcookie/lib/AuthMemCookie.php on line 118
Did you follow the instructions for that module, installing it using
composer?
https://github.com/simplesamlphp/simplesamlphp-module-memcookie
I guess something needs to pull in the memcached code, and I'm
assuming that'd need to be done by composer (if the code is not
included in the SimpleSAMLphp module referenced above).
> I see the obvious issue is the memcache class isn't installed for
> php, which I'm doing now
If only following the documentation does not get you a working system
then the docs may be incomplete. E.g. if you would have to install
software not mentioned in the docs that would be a bug.
> but I'm just trying to think through if I will have to do similar
> things for python/ruby.
No. The point of mod_auth_memcookie is to protect applications from
the web server (with the help of httpd modules), not using native
APIs.
This fact is made less clear since you're using SimpleSAMLphp (and
therefore, PHP) as SAML Service Provider to establish a session with
mod_auth_memcookie.
> Most of what you said about reverse proxy and using mod_proxy_uwsgi
> went over my head. But if it's something I'll need to learn for my
> python applications to work right then I'll need to learn that as
> well.
Trying to give a bit of context:
There are reasons to avoid API-level integration with applications for
SSO / Identity Federation, mostly because over time applications
and/or their SSO integration APIs change, breaking the integration.
(Others still prefer this approach and then native SSO implementations
would be the tool of choice, e.g. integrating PHP applications with
SimpleSAMLphp, integrating Python applications using pysaml2, Ruby
probably with Omniauth or whatever, Java with pac4j or whatever you're
stuck with using, etc.pp.)
Protecting resources using the web server avoids such breakage, as the
application only needs to be able to run in a web server and consume
environment variables, which is a very stable interface.
It also means you don't have to learn/secure one SSO implemenation per
language/API/framework.
Now, mod_auth_memcookie is one approach for doing just that, and
mod_mellon or mod_shib (Shibboleth SP) would be alternatives that
directly implement SAML2 without a need for PHP support in the web
server (as SimpleSAMLphp provids the SSO integration for
mod_auth_memcookie here, not mod_auth_memcookie).
(Personally I'd only ever add PHP to a web server if the purpose of
that server would be to run PHP applications, not merely to provide
SSO to mod_auth_memcookie.)
As for your Python etc. applications themselfs: I generally avoid HTTP
proxying (i.e., one web server proxying for another full webserver)
and instead use differnt approaches that provide better fidelity and
security compared to relying on HTTP Request Headers as only their
means of communication between those servers.
So that also informs my choices of web application servers, i.e.,
how to run Python or Ruby or Perl web applications: I don't use their
packaged or recommended application servers (e.g. Perl's Starman) that
would expose an HTTP or FCGI server to proxy to, but instead run the
applications using appropriate httpd modules:
While for Python mod_proxy_wsgi exists, or Phusion Passenger for
Ruby/Rack, or mod_perl or mod_psgi for Perl, etc. I find that uwsgi is
able to handle those just fine, allowing me to only a single
application server for running pretty much everything that's not PHP
(php-fpm and mod_proxy_fcgi suffices, I feel) or Java (mod_proxy_ajp
to Tomcat works OK). UWSGI is not for the faint-hearted, though.
That way authentication (and sometimes authorisation) is done with
httpd modules in the web server, and likewise httpd calls out to
proper application servers (not using HTTP proxying) using other httpd
modules, allowing me to rely on environment variables set by the httpd
modules (used for auth) and avoiding multiple steps of HTTP
parsing/proxying.
How/whether that relates to your applications and deployment
preferences and deployment targets and deployment platforms etc. I
couldn't say. It all depends, I guess.
-peter