wsgi on RedHat 9

Tonu Mikk via Roundup-users <[email protected]> Tue, 6 Feb 2024 11:17:28 -0600
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <CABDFm8j=AtOWt2EapqaNznqe=b25+G8gDHtK6m7sKqw3a1UDww@mail.gmail.com>
--===============5892146045030672800==
Content-Type: multipart/alternative; boundary="000000000000da8a7c0610b9c2ea"

--000000000000da8a7c0610b9c2ea
Content-Type: text/plain; charset="UTF-8"

Hello,

I am trying to configure a web interface for a Roundup tracker using Apache
2.4, Python 3.9, mod_wsgi on the RedHat 9 server. I am getting an error in
the Apache error log
authz core:error client denied by server configuration:
/opt/trackers/classic_wsgi.py . Seeking help in resolving this error. Here
are my configuration details.

   - I installed Roundup using the manual method -
   https://www.roundup-tracker.org/docs/installation.html#installing-from-downloaded-source
   . Roundup is installed into the system's Python tree and Roundup commands
   are available in /usr/bin .  I used this installation method as it seems to
   allow me to use the Apache web server with mod_wsgi.  I was not able to use
   the mod_wsgi express command as it doesn't seem to be available in my
   system.
   - I created a tracker home in /opt/trackers/classic
   - I modified the config.ini file to make the tracker web to be
   https://music.drc.umn.edu/piano/
   - I created an Apache virtual config file with the following directives:
   <VirtualHost *:80>
           ServerName music.drc.umn.edu
           <Directory /opt/trackers/classic>
                   Require all granted
           </Directory>
           WSGIScriptAlias /test_wsgi /opt/trackers/classic/test_wsgi.py
           WSGIScriptAlias /piano /opt/trackers/classic_wsgi.py
           WSGIDaemonProcess classic.apache user=tmikk group=mytrackergrp
   threads=25
           WSGIProcessGroup classic.apache
   </VirtualHost>
   - I created a file (classic_wsgi.py) in the tracker's home directory
   with the following directives:
   from roundup.cgi.wsgi_handler import RequestDispatcher
   tracker_home = '/opt/trackers/classic'
   application = RequestDispatcher(tracker_home)
   - I created a group called mytrackergrp:
   mytrackergrp:*:1002:tmikk,apache,daemon,mail
   - The permissions on the tracker directory
   drwxrwxrwx. 7 tmikk mytrackergrp 4096 Feb  6 08:21 classic
   - Permissions for the files in the tracker directory:
   drwxrwxrwx. 7 tmikk mytrackergrp  4096 Feb  6 08:21 .
   drwxrwxrwx. 3 root  root            21 Jan 23 08:48 ..
   -rwxrwxrwx. 1 tmikk mytrackergrp   140 Jan 23 08:50 classic_wsgi.py
   -rwxrwxrwx. 1 tmikk mytrackergrp 39654 Feb  6 10:34 config.ini
   drwxrwsrwx. 2 tmikk mytrackergrp    16 Jan 23 08:48 db
   drwxrwxrwx. 3 tmikk mytrackergrp   137 Jan 23 08:48 detectors
   drwxrwxrwx. 2 tmikk mytrackergrp    24 Jan 23 08:48 extensions
   drwxrwxrwx. 2 tmikk mytrackergrp  4096 Jan 23 08:48 html
   -rwxrwxrwx. 1 tmikk mytrackergrp  1070 Jan 23 08:48 initial_data.py
   drwxrwxrwx. 2 tmikk mytrackergrp    70 Jan 23 08:48 __pycache__
   -rwxrwxrwx. 1 tmikk mytrackergrp  7598 Jan 23 08:48 schema.py
   -rwxrwxrwx. 1 tmikk mytrackergrp   351 Jan 23 08:48 TEMPLATE-INFO.txt
   -rw-r-----. 1 tmikk mytrackergrp   295 Jan 25 08:30 test_wsgi.py

I also created a test mod_wsgi file in the /opt/trackers/classic directory
called test_wsgi with the following content:

def application(environ, start_response):
    status = '200 OK'
    output = b'Hooray, mod_wsgi is working'

    response_headers = [('Content-type', 'text/plain'),
                        ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

When I access http://music.drc.umn.edu/test_wsgi/ using a browser I am able
to see that the wsgi is working. It presents a message "Hooray, mod_wsgi is
working".
When I try to access http://music.drc.umn.edu/piano in the browser, I get a
message "Forbidden You don't have permission to access this resource." And
I see the following entry in the /var/log/httpd/error_log:
[Tue Feb 06 11:04:21.164299 2024] [authz_core:error] [pid 3091514:tid
3091575] [client 10.20.27.232:57914] AH01630: client denied by server
configuration: /opt/trackers/classic_wsgi.py .

Searching for this error led me to results that talk about Apache
permissions. I don't know if that is it as the virtual conf file includes
the "Require all granted" for /opt/trackers/classic directory.

The RedHat server comes with SELinux enabled. I have set the SELinux to
"permissive" and that makes no difference.

When I try to run the roundup server from the command line, I get an error
message that the port 80 is already in use.
roundup-server -p 80 -n 134.84.72.17 piano=/opt/trackers/classic

When I change the port to 8080, I am not able to reach the page with the
browser, probably because 8080 is blocked by firewall configuration.

I am successfully able to run the tracker on localhost using the
roundup-server command.

Thanks for any help!






Hooray, mod_wsgi is working, mod_wsgi is working

-- 
Tonu Mikk
Developer | Disability Resource Center | disability.umn.edu
University of Minnesota | umn.edu
[email protected]
Pronouns: He/Him

--000000000000da8a7c0610b9c2ea
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hello,<div><br></div><div>I am trying to configure a web i=
nterface for a Roundup tracker using Apache 2.4, Python 3.9, mod_wsgi on th=
e RedHat 9 server. I am getting an error in the Apache error log=C2=A0</div=
><div>authz core:error client denied by server configuration: /opt/trackers=
/classic_wsgi.py . Seeking help in resolving this error. Here are my config=
uration details.</div><div><ul><li>I installed Roundup using the manual met=
hod -=C2=A0<a href=3D"https://www.roundup-tracker.org/docs/installation.htm=
l#installing-from-downloaded-source">https://www.roundup-tracker.org/docs/i=
nstallation.html#installing-from-downloaded-source</a> . Roundup is install=
ed into the system&#39;s Python tree and Roundup commands are available in =
/usr/bin .=C2=A0 I used this installation method as it seems to allow me to=
 use the Apache web server with mod_wsgi.=C2=A0 I was not able to use the m=
od_wsgi express command as it doesn&#39;t seem to be available in my system=
.</li><li>I created a tracker home in /opt/trackers/classic</li><li>I modif=
ied the config.ini file to make the tracker web to be <a href=3D"https://mu=
sic.drc.umn.edu/piano/">https://music.drc.umn.edu/piano/</a></li><li>I crea=
ted an Apache virtual config file with the following directives:<br>&lt;Vir=
tualHost *:80&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 ServerName <a href=3D"http=
://music.drc.umn.edu">music.drc.umn.edu</a><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
&lt;Directory /opt/trackers/classic&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 Require all granted<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 &lt;/Directory&gt;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 WSGIScriptAlias /test_ws=
gi /opt/trackers/classic/test_wsgi.py<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 WSGISc=
riptAlias /piano /opt/trackers/classic_wsgi.py<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 WSGIDaemonProcess classic.apache user=3Dtmikk group=3Dmytrackergrp thre=
ads=3D25<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 WSGIProcessGroup classic.apache<br>=
&lt;/VirtualHost&gt;<br></li><li>I created a file (classic_wsgi.py) in the =
tracker&#39;s home directory with the following directives:<br>from roundup=
.cgi.wsgi_handler import RequestDispatcher<br>tracker_home =3D &#39;/opt/tr=
ackers/classic&#39;<br>application =3D RequestDispatcher(tracker_home)<br><=
/li><li>I created a group called mytrackergrp:<br>mytrackergrp:*:1002:tmikk=
,apache,daemon,mail<br></li><li>The permissions on the tracker directory<br=
>drwxrwxrwx. 7 tmikk mytrackergrp 4096 Feb =C2=A06 08:21 classic</li><li>Pe=
rmissions for the files in the tracker directory:<br>drwxrwxrwx. 7 tmikk my=
trackergrp =C2=A04096 Feb =C2=A06 08:21 .<br>drwxrwxrwx. 3 root =C2=A0root =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A021 Jan 23 08:48 ..<br>-rwxrwxrwx. =
1 tmikk mytrackergrp =C2=A0 140 Jan 23 08:50 classic_wsgi.py<br>-rwxrwxrwx.=
 1 tmikk mytrackergrp 39654 Feb =C2=A06 10:34 config.ini<br>drwxrwsrwx. 2 t=
mikk mytrackergrp =C2=A0 =C2=A016 Jan 23 08:48 db<br>drwxrwxrwx. 3 tmikk my=
trackergrp =C2=A0 137 Jan 23 08:48 detectors<br>drwxrwxrwx. 2 tmikk mytrack=
ergrp =C2=A0 =C2=A024 Jan 23 08:48 extensions<br>drwxrwxrwx. 2 tmikk mytrac=
kergrp =C2=A04096 Jan 23 08:48 html<br>-rwxrwxrwx. 1 tmikk mytrackergrp =C2=
=A01070 Jan 23 08:48 initial_data.py<br>drwxrwxrwx. 2 tmikk mytrackergrp =
=C2=A0 =C2=A070 Jan 23 08:48 __pycache__<br>-rwxrwxrwx. 1 tmikk mytrackergr=
p =C2=A07598 Jan 23 08:48 schema.py<br>-rwxrwxrwx. 1 tmikk mytrackergrp =C2=
=A0 351 Jan 23 08:48 TEMPLATE-INFO.txt<br>-rw-r-----. 1 tmikk mytrackergrp =
=C2=A0 295 Jan 25 08:30 test_wsgi.py</li></ul><div>I also created a test mo=
d_wsgi file in the /opt/trackers/classic directory called test_wsgi with th=
e following content:<br><br>def application(environ, start_response):<br>=
=C2=A0 =C2=A0 status =3D &#39;200 OK&#39;<br>=C2=A0 =C2=A0 output =3D b&#39=
;Hooray, mod_wsgi is working&#39;<br><br>=C2=A0 =C2=A0 response_headers =3D=
 [(&#39;Content-type&#39;, &#39;text/plain&#39;),<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (&#39;Conten=
t-Length&#39;, str(len(output)))]<br>=C2=A0 =C2=A0 start_response(status, r=
esponse_headers)<br><br>=C2=A0 =C2=A0 return [output]<br></div><div><br></d=
iv><div>When I access <a href=3D"http://music.drc.umn.edu/test_wsgi/">http:=
//music.drc.umn.edu/test_wsgi/</a> using a browser I am able to see that th=
e wsgi is working. It presents a message &quot;Hooray, mod_wsgi is working&=
quot;.</div><div>When I try to access <a href=3D"http://music.drc.umn.edu/p=
iano">http://music.drc.umn.edu/piano</a> in the browser, I get a message &q=
uot;Forbidden You don&#39;t have permission to access this resource.&quot; =
And I see the following entry in the /var/log/httpd/error_log:</div><div>[T=
ue Feb 06 11:04:21.164299 2024] [authz_core:error] [pid 3091514:tid 3091575=
] [client <a href=3D"http://10.20.27.232:57914">10.20.27.232:57914</a>] AH0=
1630: client denied by server configuration: /opt/trackers/classic_wsgi.py =
.<br></div><div><br></div><div>Searching for this error led me to results t=
hat talk about Apache permissions. I don&#39;t know if that is it as the vi=
rtual conf file includes the &quot;Require all granted&quot; for /opt/track=
ers/classic directory.=C2=A0=C2=A0</div><div><br></div><div>The RedHat serv=
er comes with SELinux enabled. I have set the SELinux to &quot;permissive&q=
uot; and that makes no difference.=C2=A0</div><div><br></div><div>When I tr=
y to run the roundup server from the command line, I get an error message t=
hat the port 80 is already in use.</div><div>roundup-server -p 80 -n 134.84=
.72.17 piano=3D/opt/trackers/classic<br></div><div><br></div><div>When I ch=
ange the port to 8080, I am not able to reach the page with the browser, pr=
obably because 8080 is blocked by firewall configuration.=C2=A0</div><div><=
br></div><div>I am successfully able to run the tracker on localhost using =
the roundup-server command.=C2=A0</div><div><br></div><div>Thanks for any h=
elp!</div><div><br></div><div><br></div><div><br></div><div><br></div><div>=
<br></div><div><span style=3D"color:rgb(255,255,255)">=C2=A0</span></div><d=
iv><span style=3D"color:rgb(255,255,255)">Hooray, mod_wsgi is working</span=
><span style=3D"color:rgb(255,255,255)">, mod_wsgi is working</span><br></d=
iv><div><br></div><span class=3D"gmail_signature_prefix">-- </span><br><div=
 dir=3D"ltr" class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><=
div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><span st=
yle=3D"border-collapse:collapse;font-family:arial,sans-serif;font-size:13px=
"><font color=3D"#666666"><div>Tonu Mikk</div><div>Developer | Disability R=
esource Center | <a href=3D"https://disability.umn.edu" target=3D"_blank">d=
isability.umn.edu</a></div><div>University of Minnesota | <a href=3D"http:/=
/umn.edu" target=3D"_blank">umn.edu</a>=C2=A0</div><div><a href=3D"mailto:t=
[email protected]" target=3D"_blank">[email protected]</a>=C2=A0</div><div>Pronouns:=
 He/Him</div></font></span></div></div></div></div></div></div></div>

--000000000000da8a7c0610b9c2ea--


--===============5892146045030672800==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============5892146045030672800==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Roundup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/roundup-users

--===============5892146045030672800==--