-
-
Notifications
You must be signed in to change notification settings - Fork 618
SAN extension required for TLS interception certificate generation #261
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
SAN extension required for TLS interception certificate generation #261
Conversation
d1fe602 to
29c1560
Compare
29c1560 to
d3280ca
Compare
d3280ca to
144afdd
Compare
144afdd to
3f39714
Compare
|
@Benouare I think we must start to use While |
I agree, I will make the corrections. |
3f39714 to
88f3225
Compare
88f3225 to
e938b20
Compare
e938b20 to
feda6fa
Compare
|
So, I have made some changes. |
|
Sure thing, I'll take a look at it tonight and get back to you. Thank
you!!!
…On Sat, Jan 11, 2020, 3:58 PM Benouare ***@***.***> wrote:
So, I have made some changes.
I push the branch but it's not the final 'release' version of it : we need
to talk about it, and i would like your feedback.
I have to delete some part of the code to generate the certificates 'in
the good way'.
I tried to use the existants pki methods to generate certs, but that
doesnt work, so I do that.
About the test, I add some, but there is one that is not working anymore.
Dont get why...
Let me know what you think about it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#261?email_source=notifications&email_token=AAA6Y4IH5WODP3UTZGMIQRTQ5JMJTA5CNFSM4KFELVV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIWN2CY#issuecomment-573365515>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA6Y4KB4RK3PHQJX6SUWXLQ5JMJTANCNFSM4KFELVVQ>
.
|
|
Hi @Benouare , I am wondering why do we need new I am thinking of putting those 4 loc that you added under Also, let's separate out your PR's. Send out a separate one for |
I did'nt succeed to use the methods in the pki, to generate certs that can be used by ff/chrome & others. It's for that reason that I have put some new methods.
I don't get what you mean. The gen_web is currently used to replace the 'old' way to generate the certificate during the interception.
Get it. |
feda6fa to
38adf1c
Compare
I am trying to understand why can't we modify existing IIUC, only different is in terms of a few flags right? |
I didnt touch the existing methods to don't brake the app, but clearly, if we can modify methods and not creating new one, it's the best.
Get it, I will do that.
Exactly. The main thing is to sha256, and to add the SAN flag/propertie. |
38adf1c to
8c18410
Compare
8c18410 to
e9fb473
Compare
proxy/common/pki.py
Outdated
| temp_cert = os.path.join(tempfile.gettempdir(), uuid.uuid4().hex) | ||
| gen_web_public_key(temp_cert, signing_key_path, | ||
| f'/C=/ST=/L=/O=/OU=/CN={tld}') | ||
| sign_csr(csr_path, key_path, crt_path, temp_cert, serial, [tld]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, if i add a
os.remove(temp_cert)
The e2e test will fail : it looks like the temp_cert is already deleted, but I dont know by who.
It looks like the OS is cleaning the temp dir automatically, so I propose to dont put the os.remove.
I let u think about to drop it in other part of the code and let the OS manage those temp files.
283b596 to
0bc3cd9
Compare
0bc3cd9 to
60c3bc3
Compare
60c3bc3 to
1119bb9
Compare
1119bb9 to
b95fc84
Compare
| private_key_path: str, | ||
| private_key_password: str, | ||
| subject: str, | ||
| alt_subj_names: Optional[List[str]] = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. SAN is just needed during certificate signing, so my suggestion is to only change that part of the code. So there are 2 steps happening during interception:
- Generate a CSR for domain
- Sign CSR with CA
To generate a CSR we also need domain private key. This is what current code does, it generate an interim key (never saved on disk), pipes the output into CSR signing command.
We'll have to add a similar method where CSR can be generated without having to persist private key (e.g. gen_priv_key, then remove_passphrase, then gen_csr). You can also remove the need of remove_passphrase by not encrypting the private key in first place (i.e. don't use a password while generating one, this will require changes to gen_priv_key flags as it by default only generated encrypted private key). Note that, CSR generation is a one time step and valid till 365 days (current default sign validity).
Also, utilities in pki.py are not in anyway tied with its user. Idea is to simply have all PKI utilities at a central place for re-use. So, I think terms like "web_cert" shouldn't land in pki.py, just continue using standard terminology like private / public keys and signed certificates (for method names).
Hence we must also preserve DEFAULT_CONFIG for use when needed. We can make ways to take input custom config (e.g. SAN during signing), overriding default config.
I hope this background helps you refactor better :)
b95fc84 to
1238ec3
Compare
1238ec3 to
4146f35
Compare
4146f35 to
fc7c851
Compare
fc7c851 to
37e8c37
Compare
37e8c37 to
3104b45
Compare
|
@Benouare Thanks for your patience. These have been tough times specially with all the travel involved. Good news, I am back at a stable place and will soon jump into pending PR. Really appreciate it. I hope you are safe and sound in these hard times. Thank you!!! |
b513c0c to
104dac2
Compare
* Use keccak_256 instead of shake_256 (261-restrict-write-instruction) * Use WriteHolder (15=0x0F) instead of Write (0) (261-restrict-write-instruction) * WriteHolder index: 15 => 16 (261-restrict-write-instruction) * WriteHolder index: 16 => 17 (261-restrict-write-instruction) * WriteHolder index: 17 => 18 (261-restrict-write-instruction) * WriteHolder instruction creates bigger trx due to seed (261-restrict-write-instruction) * WriteHolder instruction creates bigger trx due to seed (261-restrict-write-instruction) * Comment unneeded logging (261-restrict-write-instruction) * bugfix (261-restrict-write-instruction) * Refactor WriteHolder from seed to nonce (261-restrict-write-instruction) * Exclude signer pubkey from seed generation (261-restrict-write-instruction) * Remove dead code (261-restrict-write-instruction)
Hi,
When using locally proxy.py, I saw that, with FF, everything looks good, but with Brave/Chrome that was not the case.
Thx of the console of chrome, it says that there is currently two issues on our certificates :
This PR, should solved this issue.
Regarding the code, the main problem was to generate on the fly certs with the SAN information.
I tried billions of time & differents solutions, but I was not able to make it on the fly.
Currently, I am generating and consuming a file, before to remove it. I think, it will make a lot of I/O access, and should be powerless...
So, I am waiting your comment to find the best solution.
Ressources :
https://www.fomfus.com/articles/how-to-generate-self-signed-certificates-with-san-subject-alternative-name
Edit :
The 'solution' was to put something like that in the signing process to add the SAN on the fly, but that's not working with python (but working well in direct shell)
But that doesnt work at all
Edit 2 : the base branch is the one for the #258, hope that's not a problem for you.