Hello,

I'm new to mod_wsgi (and I am not a programmer, so please bear with me).  I 
have a Django/Python application that was written by someone else that I 
have deployed using mod_wsgi 3.4 on Ubuntu 14.04LTS with Apache 2.4.7, 
using the following in my apache config:

#Django WSGI

WSGIScriptAlias / /var/www/transfergateway/myproject/wsgi.py

WSGIPythonPath /var/www/transfergateway

<VirtualHost *:443>

    ServerName *redacted* 

        <Directory /var/www/transfergateway>

 <Files wsgi.py>

 Order deny,allow

 Allow from all

 </Files>

</Directory>
The application is running fine using mod_wsgi and apache.

However, I want to make this application more secure, so I would like to 
have mod_wsgi run in a chroot jail.  I created a chroot jail using the 
instructions here: https://help.ubuntu.com/community/BasicChroot and copied 
the application into /var/chroot/var/www/transfergateway .  Then, in the 
chroot, I installed python2.7 and used pip install to install the python 
packages used in the project (as far as I can tell).

I have created a new Apache config:

#test chroot jail for Django WSGI

WSGISocketPrefix /var/run/wsgi

<VirtualHost *:443>

    ServerName *redacted* 

WSGIScriptAlias / /var/chroot/var/www/transfergateway/myproject/wsgi.py

WSGIProcessGroup chroot 

WSGIDaemonProcess chroot user=daemon group=daemon processes=2 threads=25 
chroot=/var/chroot

        <Directory /var/chroot/var/www/transfergateway/myproject/>

 <Files wsgi.py>

 Order deny,allow

 Allow from all

 </Files>

</Directory>


But I am getting the following errors in the Apache error log upon startup:

 Target WSGI script '/var/www/transfergateway/myproject/wsgi.py' cannot be 
loaded as Python module.

Exception occurred processing WSGI script 
'/var/www/transfergateway/myproject/wsgi.py'.

Traceback (most recent call last):

File "/var/www/transfergateway/myproject/wsgi.py", line 29, in <module>

from django.core.wsgi import get_wsgi_application

File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 1, 
in <module>

 from django.core.handlers.wsgi import WSGIHandler

 File 
"/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 
9, in <module>

from django import http

File "/usr/local/lib/python2.7/dist-packages/django/http/__init__.py", line 
1, in <module>

from django.http.cookie import SimpleCookie, parse_cookie

File "/usr/local/lib/python2.7/dist-packages/django/http/cookie.py", line 
3, in <module>

from django.utils.encoding import force_str

File "/usr/local/lib/python2.7/dist-packages/django/utils/encoding.py", 
line 4, in <module>

import datetime

ImportError: No module named datetime


I appreciate any advice on what I am doing wrong here.  Do I have my chroot 
set up properly?  Do I need to do anything with permissions on /var/chroot 
or /var/chroot/var/www/transfergateway?  Do I need to run mod_wsgi as a 
different user than daemon?


thanks in advance for any help!

--Jennifer

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to