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

Add RuntimeState and keylogger to it #2487

Merged
merged 3 commits into from
Apr 11, 2022
Merged

Add RuntimeState and keylogger to it #2487

merged 3 commits into from
Apr 11, 2022

Conversation

mstoykov
Copy link
Contributor

@mstoykov mstoykov commented Apr 7, 2022

Based on #2485 (comment)
fixes #1043
Changelog entry (under new features):

Add the ability to dump SSL keys while making TLS connections, which than can be used to decrypt the whole traffic k6 generates. 

This is done through setting the `SSLKEYLOGFILE` to some file path that and running k6. This will populate the file with the keys, and then you can use Wireshark to capture the traffic , decrypt it and use that for debugging. 

You can look at how this is done with curl [here](https://daniel.haxx.se/blog/2018/01/15/inspect-curls-tls-traffic/).

@mstoykov mstoykov requested a review from na-- April 7, 2022 14:27
@mstoykov mstoykov mentioned this pull request Apr 7, 2022
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Something like this LGTM. I think you're not covering the case testTypeArchive branch in initializeFirstRunner(), so some further refactoring might be needed, but I like the general approach

@mstoykov
Copy link
Contributor Author

mstoykov commented Apr 7, 2022

I think you're not covering the case testTypeArchive branch in initializeFirstRunner(), so some further refactoring might be needed, but I like the general approach

Yeah, I also will remove the functions which don't take teh state, but didn't want to do any more changes than needed to actually get a PoC

@mstoykov mstoykov force-pushed the sslkeyLogger2 branch 2 times, most recently from 5f8266b to 46babf0 Compare April 8, 2022 07:50
@mstoykov mstoykov marked this pull request as ready for review April 8, 2022 08:17
@github-actions github-actions bot requested review from na-- and oleiade April 8, 2022 08:17
cmd/test_load.go Show resolved Hide resolved
cmd/run.go Outdated Show resolved Hide resolved
@mstoykov
Copy link
Contributor Author

mstoykov commented Apr 8, 2022

afero is striking again with it's strange bugs 🤦 I literally couldn't make OpenFile create a file with fs.OsFs with no version I tried and I htink that MemMapFs got fixed in one the very last releases :(. This actually tunred out to be me using a wrapped fs 🤦

Moving tlsconfig out of js.Runner seemed like way too big of a yak shave to start on it - given the amount of refactoring I already needed to do to make this possible at all -so for now i just skip tls checking.

@mstoykov mstoykov requested a review from na-- April 8, 2022 09:40
cmd/test_load.go Outdated Show resolved Hide resolved
cmd/test_load.go Outdated Show resolved Hide resolved
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM besides #2487 (review)

@mstoykov
Copy link
Contributor Author

mstoykov commented Apr 8, 2022

I also made this small unrelated change b710000 ... kind of wonder if I should make the require an assert as currently when something fails - there are no logs .. Or maybe by default it can also dump at least the stderr 🤷

@mstoykov mstoykov requested a review from na-- April 8, 2022 10:07
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🎉 ❤️

Copy link
Member

@oleiade oleiade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and approved on Windows! Great job, and super useful indeed! 🪟 🎉

@mstoykov mstoykov merged commit 5df3281 into master Apr 11, 2022
@mstoykov mstoykov deleted the sslkeyLogger2 branch April 11, 2022 13:43
@kkriegkxs
Copy link

Good stuff! Thanks @mstoykov
Also glad you went with the standard env var ;)

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.

Support dumping of crypto keys to an nss formated key log file
4 participants