Repo Added
|
Build
115
Last
|
Files
28
|
Badge
README BADGES
|
github
feat: fork google/martian/v3/mitm to build expired certs To move forward with https://github.com/ooni/probe/issues/1803, I want to generate expired certificates. To this end, I have forked the mitm package to peek into internals and further customize certificate generation. I forked at https://github.com/google/martian/commit/19163e1b8. The diff between the original code and my code is the following: ```diff --- mitmx/mitm.go.orig 2023-09-06 10:42:30 +++ mitmx/mitmx.go 2023-09-06 10:46:28 @@ -12,10 +12,12 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package mitm provides tooling for MITMing TLS connections. It provides +// Package mitmx provides tooling for MITMing TLS connections. It provides // tooling to create CA certs and generate TLS configs that can be used to MITM // a TLS connection with a provided CA certificate. -package mitm +// +// This package is a fork of the mitm package in github.com/google/martian/v3. +package mitmx import ( "bytes" @@ -51,7 +53,6 @@ validity time.Duration org string h2Config *h2.Config - getCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error) roots *x509.CertPool skipVerify bool handshakeErrorCallback func(*http.Request, error) @@ -63,6 +64,12 @@ // NewAuthority creates a new CA certificate and associated // private key. func NewAuthority(name, organization string, validity time.Duration) (*x509.Certificate, *rsa.PrivateKey, error) { + return NewAuthorityWithTimeNow(name, organization, validity, time.Now) +} + +// NewAuthorityWithTimeNow is like NewAuthority but allows to customize the time.Now func +func NewAuthorityWithTimeNow( + name, organization string, validity time.Duration, timeNow func() time.Time) (*x509.Certificate, *rsa.PrivateKey, error) { priv, err := rsa.GenerateKey(rand.Reader, 20... (continued)
171 of 209 new or added lines in 3 files covered. (81.82%)
3 existing lines in 1 file now uncovered.2476 of 2987 relevant lines covered (82.89%)
0.88 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|