Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block PyOpenSSL to prevent SELinux execmem in wsgi #1158

Closed
wants to merge 1 commit into from

Conversation

tiran
Copy link
Member

@tiran tiran commented Oct 17, 2017

Some dependencies like Dogtag's pki.client library and custodia use
python-requsts to make HTTPS connection. python-requests prefers
PyOpenSSL over Python's stdlib ssl module. PyOpenSSL is build on top
of python-cryptography which trigger a execmem SELinux violation
in the context of Apache HTTPD (httpd_execmem).

When requests is imported, it always tries to import pyopenssl glue
code from urllib3's contrib directory. The import of PyOpenSSL is
enough to trigger the SELinux denial.

Block any import of PyOpenSSL's SSL module in wsgi by raising an
ImportError. The block is compatible with new python-requests with
unbundled urllib3, too.

Fixes: https://pagure.io/freeipa/issue/5442
Fixes: RHBZ#1491508
Signed-off-by: Christian Heimes cheimes@redhat.com

@tiran tiran added the prioritized Pull Request has higher priority for PR-CI label Oct 17, 2017
@tiran tiran requested a review from rcritten October 17, 2017 07:45
@abbra
Copy link
Contributor

abbra commented Oct 17, 2017

Does this fix still allow python-requests to use system-wide CA trust store as maintained in /etc/pki/ca-trust in Fedora?

@abbra
Copy link
Contributor

abbra commented Oct 17, 2017

Answering to myself after a test -- yes, it seems to work just fine. LGTM.

@tiran
Copy link
Member Author

tiran commented Oct 17, 2017

The patch does not affect how requests loads CA certs.

@tiran
Copy link
Member Author

tiran commented Oct 17, 2017

The patch only affects the WSGI web server. It does not affect installer, ipa command and other CLI programs. They'll still use PyOpenSSL in case it's is installed.

Some dependencies like Dogtag's pki.client library and custodia use
python-requsts to make HTTPS connection. python-requests prefers
PyOpenSSL over Python's stdlib ssl module. PyOpenSSL is build on top
of python-cryptography which trigger a execmem SELinux violation
in the context of Apache HTTPD (httpd_execmem).

When requests is imported, it always tries to import pyopenssl glue
code from urllib3's contrib directory. The import of PyOpenSSL is
enough to trigger the SELinux denial.

Block any import of PyOpenSSL's SSL module in wsgi by raising an
ImportError. The block is compatible with new python-requests with
unbundled urllib3, too.

Fixes: https://pagure.io/freeipa/issue/5442
Fixes: RHBZ#1491508
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@stlaz stlaz added the re-run Trigger a new run of PR-CI label Oct 17, 2017
@freeipa-pr-ci freeipa-pr-ci removed the re-run Trigger a new run of PR-CI label Oct 17, 2017
@stlaz stlaz added the re-run Trigger a new run of PR-CI label Oct 17, 2017
@tkrizek tkrizek added ack Pull Request approved, can be merged and removed re-run Trigger a new run of PR-CI labels Oct 17, 2017
@tkrizek
Copy link
Contributor

tkrizek commented Oct 18, 2017

master:

  • dea059d Block PyOpenSSL to prevent SELinux execmem in wsgi

@tkrizek tkrizek added the pushed Pull Request has already been pushed label Oct 18, 2017
@tkrizek tkrizek closed this Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged prioritized Pull Request has higher priority for PR-CI pushed Pull Request has already been pushed
Projects
None yet
5 participants