Documentation

Overview

    Package tls contains code for TLS certificate generation and signing.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var (
    	DefaultLegitConfig = CertConfig{
    		Bits:               4096,
    		Country:            "US",
    		Locality:           "",
    		Organization:       "bettercap devteam",
    		OrganizationalUnit: "https://bettercap.org/",
    		CommonName:         "bettercap",
    	}
    	DefaultSpoofConfig = CertConfig{
    		Bits:               4096,
    		Country:            "US",
    		Locality:           "Scottsdale",
    		Organization:       "GoDaddy.com, Inc.",
    		OrganizationalUnit: "https://certs.godaddy.com/repository/",
    		CommonName:         "Go Daddy Secure Certificate Authority - G2",
    	}
    )

    Functions

    func CertConfigToModule

    func CertConfigToModule(prefix string, m *session.SessionModule, defaults CertConfig)

    func CreateCertificate

    func CreateCertificate(cfg CertConfig, ca bool) (error, *rsa.PrivateKey, []byte)

    func Generate

    func Generate(cfg CertConfig, certPath string, keyPath string, ca bool) error

    func SignCertificateForHost

    func SignCertificateForHost(ca *tls.Certificate, host string, port int) (cert *tls.Certificate, err error)

    Types

    type CertConfig

    type CertConfig struct {
    	Bits               int
    	Country            string
    	Locality           string
    	Organization       string
    	OrganizationalUnit string
    	CommonName         string
    }

    func CertConfigFromModule

    func CertConfigFromModule(prefix string, m session.SessionModule) (err error, cfg CertConfig)