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

Support for SNI and dynamic certificate #98

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

htnhan
Copy link
Contributor

@htnhan htnhan commented Oct 3, 2018

  • Dynamically generate a certificate based on client request using
    Server Name Idicator
  • Sign the new certificate with either a static CA certificate, or
    with a newly generated CA
  • Add config options to specify a path to static CA certificate
  • *** NOTE ***: This version only works on windows platform

Nhan Huynh and others added 29 commits September 14, 2018 17:59
- Dynamically generate a certificate based on client request using
  Server Name Idicator
- Sign the new certificate with either a static CA certificate, or
  with a newly generated CA
- Add config options to specify a path to static CA certificate
- *** NOTE ***: This version only works on windows platform
Conflicts:
	fakenet/configs/default.ini
	fakenet/listeners/HTTPListener.py
@gaelmuller
Copy link

Great Pull Request 👍

Is there any specific reason this was not merged ?

I also don't understand why it is noted as working only on Windows. I tested it in a Linux multihost setup and it works great (with some minor fixes gaelmuller@549e89a)

@htnhan
Copy link
Contributor Author

htnhan commented Nov 10, 2019

@gaelmuller This works well on windows systems because we can use certutil to import our own root CA cert into Windows trust store. That will make SSL clients trust everything we sign. However, on Linux, there are a few issues:

  1. With multihost mode: You have to add your own cert into the client cert chain somehow. Current implementation allows you to configure a static cert which can be used to sign other certs as request coming in. This works as intended. Since it requires additional steps, I don't consider it "working out of the box" on linux.

  2. Within singlehost mode: I am not aware of a generic system wide tool to "trust" a signing cert. Also, I can't support most/all distribution, so I also don't consider this feature working out of the box.

@strictlymike
Copy link
Collaborator

This also lacked any fallback for when SNI can't access ssl.SSLContext due to Python version < 2.7.9 (which was still true for supported LTS releases of Ubuntu at the time this PR was considered). So, merging this branch would have broken some use cases of FakeNet on supported distros. The project still needs to migrate to Python3, which might resolve this specific issue.

- Replaced expired CA certificate
- Changed certificate sigining algorithm to SHA256
- Added extensions to generated X509 certificates to support
  interaction with latest browsers

Thanks to Nhan Huynh for implementing this feature :)
else:
ctx.sni_callback = self.sni_callback
ctx.load_cert_chain(certfile=self.ca_cert, keyfile=self.ca_key)
return ctx.wrap_socket(s, server_side=True)

Check failure

Code scanning / CodeQL

Use of insecure SSL/TLS version High

Insecure SSL/TLS protocol version TLSv1 allowed by
call to ssl.SSLContext
.
Insecure SSL/TLS protocol version TLSv1_1 allowed by
call to ssl.SSLContext
.
fakenet/listeners/ssl_utils/__init__.py Dismissed Show dismissed Hide dismissed
@tinajohnson
Copy link
Contributor

@htnhan Could you sign Google's CLA agreement? You can find it here: https://cla.developers.google.com/clas

Thanks, Nhan!

@htnhan
Copy link
Contributor Author

htnhan commented Dec 16, 2023

@htnhan Could you sign Google's CLA agreement? You can find it here: https://cla.developers.google.com/clas

Thanks, Nhan!

Signed.

Thank you @tinajohnson for merging this :)

@mr-tz
Copy link

mr-tz commented Jan 8, 2024

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants