Wow thanks for that information. There is another webapp using apache to handle requests so I think mod_ssl has to stay.
Do you know a way to recompile apache ssl module to match python's? For windows? I see lots of linux solutions for this. On Thursday, October 13, 2022 at 7:47:27 PM UTC-4 Graham Dumpleton wrote: > The problem is likely going to be that Apache SSL module is compiled > against a different SSL library version than Python and so when the Python > extension verifies things it sees a mismatch and fails. > > If you don't need to handler HTTPS requests in Apache, then ensure that > mod_ssl is not being loaded and try again. > > On 14 Oct 2022, at 10:44 am, Ryan McClellan <[email protected]> wrote: > > Thanks for your response, > > No, issue is not resolved. I closed the issue on github after reading you > direct people here for environment/setup issues. > I didn't encounter this issue when using a fresh apache install. > I'm integrating my code base into an existing system using 32bit Apache > (2.4.34). *Sadly, upgrading isn't an option right now.* I had to install > 32bit python to get mod_wsgi to play nice with apache. > Current stack looks like: Apache/2.4.34 (Win32) OpenSSL/1.1.0h PHP/7.2.8 > mod_wsgi/4.9.4 Python/3.9 > > Error says SSL Module not available: But using my py venv I can see ssl > exists. pyopenssl is also installed: > > C:\>wearable\env\Scripts\python.exe > Python 3.9.10 (tags/v3.9.10:f2f3f53, Jan 17 2022, 15:01:48) [MSC v.1929 32 > bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> import ssl > >>> print(ssl) > <module 'ssl' from 'C:\\Program Files (x86)\\Python39-32\\lib\\ssl.py'> > >>> > > Let me know if you have any ideas where this could be going wrong. > > On Thursday, October 13, 2022 at 6:40:40 PM UTC-4 Graham Dumpleton wrote: > >> Am assuming this has been resolved since you closed the issue you created. >> >> https://github.com/GrahamDumpleton/mod_wsgi/issues/800 >> >> Yes/No? >> >> Be aware that using Anaconda Python with mod_wsgi causes all sorts of >> problems with SSL library usage. >> >> On 14 Oct 2022, at 5:57 am, Ryan McClellan <[email protected]> wrote: >> >> *I have flask web app running on Apache using mod_wsgi. Web app is on a >> virtualhost using this config:* >> LoadFile "C:\Program Files (x86)\Python39-32\python39.dll" >> LoadModule wsgi_module >> "C:/wearable/env/Lib/site-packages/mod_wsgi/server/mod_wsgi.cp39-win32.pyd" >> WSGIPythonHome "C:/wearable/env" >> WSGIApplicationGroup %{GLOBAL} >> Listen 0.0.0.0:443 >> <VirtualHost _default_:443> >> SSLEngine on >> SSLCertificateFile "${SRVROOT}/conf/new_cert/ServerCertificate.crt" >> SSLCertificateKeyFile "${SRVROOT}/conf/new_cert/my_cert.key" >> SSLCertificateChainFile "${SRVROOT}/conf/new_cert/ChainBundle1.crt" >> <Directory C:/wearable/> >> Require all granted >> </Directory> >> WSGIScriptAlias / C:/wearable/start.wsgi >> </VirtualHost> >> >> *mod_wsgi/Apache is serving the web app on 443. Certificate looks good.* >> >> >> *The problem occurs when using a function that make HTTPS call to another >> server. I get SSL error.I'm able to manually run those same functions from >> the python virtual environment and everything works perfect. Seems like >> mod_wsgi isn't able to access SSL module.* >> >> *Any ideas on how I can alleviate this issue? Thanks, Ryan* >> >> *See following stack trace:* >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] Traceback (most recent call last):\r, >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File "C:\\wearable\\__init__.py", line 92, in >> <module>\r, >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] cc = >> CariumConnector(test_mode=read_bool(conf['TEST_MODE']), logger=logger, >> rbe=rbe, db=db)\r, >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File "C:\\wearable\\CariumConnector.py", line >> 58, in __init__\r, >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] self.kwargs = self.__login()\r, >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File "C:\\wearable\\CariumConnector.py", line >> 386, in __login\r, >> [Wed Oct 12 22:32:45.522680 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] result = >> requests.post(f"{self.API_HOST}/identity/v1/login/", >> data={'username': self.__carium_user,'password': self.__carium_pass})\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File >> "C:\\wearable\\env\\Lib\\site-packages\\requests\\api.py", line 115, in >> post\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] return request("post", url, data=data, >> json=json, **kwargs)\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File >> "C:\\wearable\\env\\Lib\\site-packages\\requests\\api.py", line 59, in >> request\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] return session.request(method=method, >> url=url, **kwargs)\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File >> "C:\\wearable\\env\\Lib\\site-packages\\requests\\sessions.py", line 587, >> in request\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] resp = self.send(prep, **send_kwargs)\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File >> "C:\\wearable\\env\\Lib\\site-packages\\requests\\sessions.py", line 701, >> in send\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] r = adapter.send(request, **kwargs)\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] File >> "C:\\wearable\\env\\Lib\\site-packages\\requests\\adapters.py", line 563, >> in send\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] raise SSLError(e, request=request)\r, >> [Wed Oct 12 22:32:45.523679 2022] [wsgi:error] [pid 58060:tid 1952] >> [client 10.252.57.4:53547] requests.exceptions.SSLError: >> HTTPSConnectionPool(host='api.carium.com', port=443): Max retries >> exceeded with url: /identity/v1/login/ (Caused by SSLError("Can't connect >> to HTTPS URL because the SSL module is not available."))\r, >> >> -- >> 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 view this discussion on the web visit >> https://groups.google.com/d/msgid/modwsgi/896292b3-d60c-4bda-a970-8c1f4fe016b0n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/modwsgi/896292b3-d60c-4bda-a970-8c1f4fe016b0n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> >> > -- > 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 view this discussion on the web visit > https://groups.google.com/d/msgid/modwsgi/2d96b5e0-0637-4d15-81d8-877e5ef2efd7n%40googlegroups.com > > <https://groups.google.com/d/msgid/modwsgi/2d96b5e0-0637-4d15-81d8-877e5ef2efd7n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/8530266f-47cd-45c7-b8fa-588d79f35316n%40googlegroups.com.
