wsgi setup getting Permission Denied

Ed Wong cc at pw-wspx.org
Fri Jul 21 04:31:47 UTC 2023


Hi,

Having given up with the httpd proxy to get Kallithea working with
Apache,  I'm going with the Apache mod_wsgi path and am nearly
there.

My setup;

dispatch.wsgi:

ini = '/var/www/kali/my.ini'
from logging.config import fileConfig
fileConfig(ini, {'__file__': ini, 'here': '/var/www/kali'})
from paste.deploy import loadapp
application = loadapp('config:' + ini)


The repository is at /repos/repos [user: kali, group: kali]

The Source installation is at /repos/kallithea [user: kali, group: kali]

Virtual env:  /var/www/kali/venv

Python 3.9
Apache 2.4.37

Apache configuration:

<VirtualHost *:80>
    ServerName 127.0.0.1
    CustomLog logs/kali/access.log common
    ErrorLog logs/kali/error.log

    WSGIDaemonProcess kallithea user=kali group=kali processes=5
threads=1 maximum-requests=100 python-home=/var/www/kali/venv

    WSGIProcessGroup kalllithea
    WSGIScriptAlias / /var/www/kali/dispatch.wsgi
process-group=kallithea application-group=%{GLOBAL}
    WSGIPassAuthorization On
    WSGIApplicationGroup %{GLOBAL}
    <Directory "/var/www/kali">
      Order deny,allow
      Allow from all
      Require all granted
    </Directory>
    <Directory "/repos/kallithea/kallithea">
      Order allow,deny
      Allow from all
      Require all granted
    </Directory>
</VirtualHost>



When I run the above setup, I get the following error in the traceback:


[Fri Jul 21 03:45:11.596117 2023] [wsgi:error] [pid 65057:tid
140148165671232]   File "<frozen importlib._bootstrap>", line 925, in
_find_spec
[Fri Jul 21 03:45:11.596123 2023] [wsgi:error] [pid 65057:tid
140148165671232]   File
"/var/www/kali/venv/lib64/python3.9/site-packages/__editable___Kallithea_0_7_0_finder.py",
line 19, in find_spec
[Fri Jul 21 03:45:11.596126 2023] [wsgi:error] [pid 65057:tid
140148165671232]     return cls._find_spec(fullname, Path(pkg_path, *rest))
[Fri Jul 21 03:45:11.596132 2023] [wsgi:error] [pid 65057:tid
140148165671232]   File
"/var/www/kali/venv/lib64/python3.9/site-packages/__editable___Kallithea_0_7_0_finder.py",
line 28, in _find_spec
[Fri Jul 21 03:45:11.596135 2023] [wsgi:error] [pid 65057:tid
140148165671232]     if candidate.exists():
[Fri Jul 21 03:45:11.596141 2023] [wsgi:error] [pid 65057:tid
140148165671232]   File "/usr/lib64/python3.9/pathlib.py", line 1424, in
exists
[Fri Jul 21 03:45:11.596144 2023] [wsgi:error] [pid 65057:tid
140148165671232]     self.stat()
[Fri Jul 21 03:45:11.596149 2023] [wsgi:error] [pid 65057:tid
140148165671232]   File "/usr/lib64/python3.9/pathlib.py", line 1232, in
stat
[Fri Jul 21 03:45:11.596152 2023] [wsgi:error] [pid 65057:tid
140148165671232]     return self._accessor.stat(self)
[Fri Jul 21 03:45:11.596163 2023] [wsgi:error] [pid 65057:tid
140148165671232] PermissionError: [Errno 13] Permission denied:
'/repos/kallithea/kallithea/__init__.py'


I added the following to top of dispatch.wsgi:

import getpass

print(getpass.getuser())


And I get:

kali


So I know for sure that it's trying to access
/repos/kallithea/kallithea/__init__.py as kali; but I still get
permission denied.

Permission of /repos/kallithea/kallithea/__init__.py: rw-rw-rw-.
[kali.kali]

Permission of /repos/kallithea:  drwxrwxr-x.   [kali.kali]

Permission of /repos: drwxr-xr-x.  [kali.kali]

Am I missing something?

Thanks

Ed


More information about the kallithea-general mailing list