List Info

Thread: proper way to set up admin with SSL




proper way to set up admin with SSL
user name
2007-01-30 13:40:23
I am wondering if this is the best way of setting up a site
to use SSL 
for admin login.  If so then consider this a HOWTO.  If not,
any 
direction is appreciated.  (My motivation for posting is
mostly that I 
struggled until I realized that you need PythonInterpreter
for you 
mod_python configuration.)

We use LDAP authentication for admin access and want to use
SSL for 
the login.

We use different settings files for each virtual host.  The

settingsadmin.py file adds 'django.contrib.admin' to
INSTALLED_APPS, 
includes the appropriate MIDDLEWARE_CLASSES, such as 
'django.contrib.auth.middleware.AuthenticationMiddleware',
and points 
to a limited ROOT_URLCONF.

If you are using IP-based virtual hosts and the server name
is the 
same for each, it appears that you must set        
PythonInterpreter 
for each container.  (see http://article.gmane.org/
gmane.comp.apache.user/66248)

Excepted from our apache config:

<VirtualHost 192.168.0.210:80>
    ServerName our.site.com
    #...

    Redirect permanent /admin/ https://our.site.com/admi
n/

    <Location "/">
        SetHandler python-program
        PythonPath "['/var/local/source/django_src'] +
['/var/sites/
ourroot'] + sys.path"
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE our.settingspublic
        PythonInterpreter public
    </Location>

    #...
</VirtualHost>

<VirtualHost 192.168.0.210:443>
    ServerName our.site.com

    SSLEngine on
    #...

    <Location "/">
        SetHandler python-program
        PythonPath "['/var/local/source/django_src'] +
['/var/sites/
ourroot'] + sys.path"
        PythonHandler django.core.handlers.modpython
        SetEnv DJANGO_SETTINGS_MODULE our.settingsadmin
        PythonInterpreter admin
        PythonDebug On
    </Location>

    #...
</VirtualHost>

It seems to work!

Peace,
David S.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )