-
Notifications
You must be signed in to change notification settings - Fork 9
ct-worker: Fix local testing #161
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
fa124ff
Add assert_eq between cert issuer name and the issuer subject name; t…
e023a70
Narrow down the failing test
3c1d113
Add comment explaining cert chain name checking
dd50692
Start making more dev logs
38c6fc3
Stricter bash flags for create-log script
351b95c
Add bindings for dev2026h2a
bb88b0e
Add bindings for dev2027h1a
0651df2
Add bindings for dev2027h2a
b6cd23f
Add note on .dev.vars in create-log.sh
53075bc
Add python script for local testing
30148a6
Make host in test script google.com
1d8da0c
Add docs to testing script
daab9e8
Update README with new local dev instructions
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,12 @@ | ||
| SIGNING_KEY_dev2025h1a="-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQguu9K86g+++gKa7ag\ntkPw5E3xPhTeSkj69l0VL06EeQGhRANCAAQLOWnBI0PojH8rWoAoitlJ+Ip6iQl4\nWycheJdCWsXF2NzbOLM5aFMGpz3Bwm5egkGCzrLbhGW7z9p3FAI0N08o\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2025h1a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEIHwiErJNKCNGZL+Osj+O8MqSMiwPP4kdcC4iTpojV9Od\n-----END PRIVATE KEY-----\n" | ||
| SIGNING_KEY_dev2025h2a="-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgR2CdNf+JR6afd0gb\n+lMSINqCqiLDb7L88lo1qhxBynOhRANCAARLjKsvuNqvDER1Jasmnfm55/vz1Rgu\nZr8XTHtt8GlbYpac3nK4MTleB44Ap5YzdGnJwJkXbFEYCnaIcUJrg+2o\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2025h2a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEINKYH1WadDgPJEXYzLx0OWzNoi4hRcpUnYpoWrTc7BDO\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2025h2a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEINKYH1WadDgPJEXYzLx0OWzNoi4hRcpUnYpoWrTc7BDO\n-----END PRIVATE KEY-----\n" | ||
| SIGNING_KEY_dev2026h1a="-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgMcpVNLWTILGapBcQ\n0e59OCX+MC3ik6S/o3EzrBvISi2hRANCAATuqQUZCcCoG0yQWPiXy11zQwhUCNjw\nQb7fWqyzNGBZSgeDeUXB1+F1J3x6Nv9wb+PWj91XRYKN5zMpBwoZXrfz\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2026h1a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEIGttRSMUB4BfaxIWodXTMiGqLnBMaNAmOdms0gVelXvn\n-----END PRIVATE KEY-----\n" | ||
| SIGNING_KEY_dev2026h2a="-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgt14ClEtNlyhyy8IQ\njYA1gV0KH35xcHbaJ5g5tU7TbGqhRANCAAR1lWiAPxLrYQ5OjAWIwaYRDckh2+GD\nS2pyO25lj/lWJg94IY2MY/CaRbrIuWGUWjBRJczMjDBkajeaFC//dpG9\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2026h2a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEIFBSB+nqtrOlOg5f3GiVYlt9Q1ni9s+ooqPBDyciEQzw\n-----END PRIVATE KEY-----\n" | ||
| SIGNING_KEY_dev2027h1a="-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQggM2mn5ZSIIMwO7XG\nn2t6qcJWBUCx2rO2F6nAdY6OdIahRANCAARQiB2uy0Xl37DU8SROPUaQugrkqwRI\nw3JFQfZql6u7y++P68b5mad7vQShq5Js0kZ0YPV6rRlVJ5elhe2NQ5Dp\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2027h1a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEINECRYfEk5MrjaJsb11e05m+5JPBI9u/sjLw8iWanaHI\n-----END PRIVATE KEY-----\n" | ||
| SIGNING_KEY_dev2027h2a="-----BEGIN PRIVATE KEY-----\nMIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgiFMQhVR1SyEE8Qba\nvsZGkNKESFww6dhLd+qtFkjIxeyhRANCAATnRzos2J2mVztHcgVDp0W95o4ENRsm\nAcvpTgLIgk4XB3RlmV4Ye1+I76n1tY4SJgOXccTDWfQVLUD8ilI2eC9f\n-----END PRIVATE KEY-----\n" | ||
| WITNESS_KEY_dev2027h2a="-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEIAFzi3DVqaBuo3Ms2aurLSzOdgXH2MY1ezNOUqTd33HQ\n-----END PRIVATE KEY-----\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import base64 | ||
| from datetime import datetime | ||
| import json | ||
| import urllib.request | ||
| import socket | ||
| import ssl | ||
| import sys | ||
|
|
||
| HOST = "www.google.com" | ||
|
|
||
| # Need >=3.13 to use conn.get_unverified_chain() | ||
| if sys.version_info < (3, 13, 0): | ||
| cur_version = f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}" | ||
| print("Error: This script requires Python 3.13 or newer. ") | ||
| print(f"Current version is {cur_version}") | ||
| exit(1) | ||
|
|
||
| # Make a connection to HOST | ||
| context = ssl.create_default_context() | ||
| conn = context.wrap_socket(socket.socket(socket.AF_INET), server_hostname=HOST) | ||
| conn.connect((HOST, 443)) | ||
|
|
||
| # Get the leaf cert. That's the not_after we use to decide which shard to submit to | ||
| parsed_cert = conn.getpeercert() | ||
| # Get the cert chain. This is what we'll submit | ||
| der_cert_chain = conn.get_unverified_chain() | ||
| b64_cert_chain = [str(base64.b64encode(c), encoding="utf-8") for c in der_cert_chain] | ||
|
|
||
| # Figure out the year and half-year that this not_after belongs to. Eg dev2026h2a is the second half | ||
| # of 2026 | ||
| not_after = datetime.strptime(parsed_cert["notAfter"], "%b %d %H:%M:%S %Y %Z") | ||
| not_after_year = not_after.year | ||
| not_after_half = 1 if not_after.month < 7 else 2 | ||
| log_name = f"dev{not_after_year}h{not_after_half}a" | ||
|
|
||
| # Make a POST request to localhost add-chain | ||
| payload = {"chain": b64_cert_chain} | ||
| url = f"http://localhost:8787/logs/{log_name}/ct/v1/add-chain" | ||
| request = urllib.request.Request( | ||
| url, | ||
| data=bytes(json.dumps(payload), encoding="utf-8"), | ||
| headers={'Content-Type': 'application/json'}, | ||
| method='POST' | ||
| ) | ||
| try: | ||
| urllib.request.urlopen(request, timeout=5) | ||
| except Exception as e: | ||
| print("Error: ", e) | ||
| sys.exit(1) | ||
|
|
||
| print(f"Successfully submitted to {url}") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.