From 1d529a8d09a2577da9a3883572c2f8ae6dd04d58 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 24 Feb 2010 11:29:23 -0700 Subject: Run ipaserver under mod_wsgi --- install/conf/ipa.conf | 103 ++++++++++++++++++---------------------------- install/share/Makefile.am | 1 + install/share/wsgi.py | 13 ++++++ 3 files changed, 54 insertions(+), 63 deletions(-) create mode 100644 install/share/wsgi.py (limited to 'install') diff --git a/install/conf/ipa.conf b/install/conf/ipa.conf index f5987fbe..dba47c5a 100644 --- a/install/conf/ipa.conf +++ b/install/conf/ipa.conf @@ -4,7 +4,6 @@ # LoadModule auth_kerb_module modules/mod_auth_kerb.so ProxyRequests Off -PythonImport ipaserver main_interpreter # ipa-rewrite.conf is loaded separately @@ -12,79 +11,47 @@ PythonImport ipaserver main_interpreter AddType application/java-archive jar +# FIXME: WSGISocketPrefix is a server-scope directive. The mod_wsgi package +# should really be fixed by adding this its /etc/httpd/conf.d/wsgi.conf: +WSGISocketPrefix /var/run/httpd/wsgi - - AuthType Kerberos - AuthName "Kerberos Login" - KrbMethodNegotiate on - KrbMethodK5Passwd off - KrbServiceName HTTP - KrbAuthRealms $REALM - Krb5KeyTab /etc/httpd/conf/ipa.keytab - KrbSaveCredentials on - Require valid-user - ErrorDocument 401 /ipa/errors/unauthorized.html - - SetHandler python-program - PythonInterpreter main_interpreter - PythonHandler ipaserver::handler - PythonDebug Off - PythonOption SCRIPT_NAME /ipa - PythonAutoReload Off - - - -# -# SetHandler python-program -# PythonInterpreter main_interpreter -# PythonHandler ipaserver::xmlrpc -# PythonDebug Off -# PythonOption SCRIPT_NAME /ipa/xml -# PythonAutoReload Off -# - -# -# SetHandler python-program -# PythonInterpreter main_interpreter -# PythonHandler ipaserver::jsonrpc -# PythonDebug Off -# PythonOption SCRIPT_NAME /ipa/json -# PythonAutoReload Off -# - -# -# SetHandler python-program -# PythonInterpreter main_interpreter -# PythonHandler ipaserver::webui -# PythonDebug Off -# PythonOption SCRIPT_NAME /ipa/ui -# PythonAutoReload Off -# -Alias /ipa-assets/ "/var/cache/ipa/assets/" - - Allow from all - AllowOverride None - # add Indexes to Options to allow browsing - Options FollowSymLinks - ExpiresActive On - ExpiresDefault A31536000 - +# Configure mod_wsgi handler for /ipa +WSGIDaemonProcess ipa processes=2 threads=1 maximum-requests=500 +WSGIProcessGroup ipa +WSGIApplicationGroup ipa +WSGIImportScript /usr/share/ipa/wsgi.py process-group=ipa application-group=ipa +WSGIScriptAlias /ipa /usr/share/ipa/wsgi.py +WSGIScriptReloading Off +# Turn off mod_msgi handler for errors, config, crl: SetHandler None - SetHandler None - SetHandler None +# Protect /ipa with Kerberos + + AuthType Kerberos + AuthName "Kerberos Login" + KrbMethodNegotiate on + KrbMethodK5Passwd off + KrbServiceName HTTP + KrbAuthRealms $REALM + Krb5KeyTab /etc/httpd/conf/ipa.keytab + KrbSaveCredentials on + Require valid-user + ErrorDocument 401 /ipa/errors/unauthorized.html + + + # This is where we redirect on failed auth Alias /ipa/errors "/usr/share/ipa/html" @@ -102,7 +69,6 @@ Alias /ipa/config "/usr/share/ipa/html" # For CRL publishing Alias /ipa/crl "/var/lib/pki-ca/publish" - SetHandler None AllowOverride None @@ -111,6 +77,18 @@ Alias /ipa/crl "/var/lib/pki-ca/publish" Allow from all + +# WebUI assets +Alias /ipa-assets/ "/var/cache/ipa/assets/" + + Allow from all + AllowOverride None + Options FollowSymLinks + ExpiresActive On + ExpiresDefault A31536000 + + + # Protect our CGIs AuthType Kerberos @@ -125,20 +103,19 @@ Alias /ipa/crl "/var/lib/pki-ca/publish" ErrorDocument 401 /ipa/errors/unauthorized.html + # migration related pages Alias /ipa/migration "/usr/share/ipa/migration" - AllowOverride None Satisfy Any Allow from all - AddHandler mod_python .py PythonHandler mod_python.publisher -#Alias /ipatest "/usr/share/ipa/ipatest" +#Alias /ipatest "/usr/share/ipa/ipatest" # # AuthType Kerberos # AuthName "Kerberos Login" diff --git a/install/share/Makefile.am b/install/share/Makefile.am index e3e7cf60..92d50775 100644 --- a/install/share/Makefile.am +++ b/install/share/Makefile.am @@ -38,6 +38,7 @@ app_DATA = \ unique-attributes.ldif \ schema_compat.uldif \ ldapi.ldif \ + wsgi.py \ $(NULL) EXTRA_DIST = \ diff --git a/install/share/wsgi.py b/install/share/wsgi.py new file mode 100644 index 00000000..457d8e02 --- /dev/null +++ b/install/share/wsgi.py @@ -0,0 +1,13 @@ +""" +WSGI appliction for IPA server. +""" + +from ipalib import api +api.bootstrap(context='server', debug=True, log=None) +api.finalize() +api.log.info('*** PROCESS START ***') +import ipawebui +ui = ipawebui.create_wsgi_app(api) + +# This is the WSGI callable: +application = api.Backend.session -- cgit