mitm

package
v3.0.0-...-fed3b74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2024 License: Apache-2.0 Imports: 15 Imported by: 7

Documentation

Overview

Package mitm 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.

Index

Constants

This section is empty.

Variables

View Source
var MaxSerialNumber = big.NewInt(0).SetBytes(bytes.Repeat([]byte{255}, 20))

MaxSerialNumber is the upper boundary that is used to create unique serial numbers for the certificate. This can be any unsigned integer up to 20 bytes (2^(8*20)-1).

Functions

func NewAuthority

func NewAuthority(name, organization string, validity time.Duration) (*x509.Certificate, *rsa.PrivateKey, error)

NewAuthority creates a new CA certificate and associated private key.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config is a set of configuration values that are used to build TLS configs capable of MITM.

func NewConfig

func NewConfig(ca *x509.Certificate, privateKey interface{}) (*Config, error)

NewConfig creates a MITM config using the CA certificate and private key to generate on-the-fly certificates.

func (*Config) H2Config

func (c *Config) H2Config() *h2.Config

H2Config returns the current HTTP/2 configuration.

func (*Config) HandshakeErrorCallback

func (c *Config) HandshakeErrorCallback(r *http.Request, err error)

HandshakeErrorCallback calls the handshakeErrorCallback function in this Config, if it is non-nil. Request is the connect request that this handshake is being executed through.

func (*Config) SetH2Config

func (c *Config) SetH2Config(h2Config *h2.Config)

SetH2Config configures processing of HTTP/2 streams.

func (*Config) SetHandshakeErrorCallback

func (c *Config) SetHandshakeErrorCallback(cb func(*http.Request, error))

SetHandshakeErrorCallback sets the handshakeErrorCallback function.

func (*Config) SetOrganization

func (c *Config) SetOrganization(org string)

SetOrganization sets the organization of the certificate.

func (*Config) SetValidity

func (c *Config) SetValidity(validity time.Duration)

SetValidity sets the validity window around the current time that the certificate is valid for.

func (*Config) SkipTLSVerify

func (c *Config) SkipTLSVerify(skip bool)

SkipTLSVerify skips the TLS certification verification check.

func (*Config) TLS

func (c *Config) TLS() *tls.Config

TLS returns a *tls.Config that will generate certificates on-the-fly using the SNI extension in the TLS ClientHello.

func (*Config) TLSForHost

func (c *Config) TLSForHost(hostname string) *tls.Config

TLSForHost returns a *tls.Config that will generate certificates on-the-fly using SNI from the connection, or fall back to the provided hostname.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL