ssl

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Certificate

type Certificate struct {
	ID               int                 `json:"id"`
	Name             string              `json:"name"`
	Status           CertificateStatus   `json:"status"`
	CommonName       string              `json:"common_name"`
	AlternativeNames []string            `json:"alternative_names"`
	ValidDays        int                 `json:"valid_days"`
	OrderedDate      connection.DateTime `json:"ordered_date"`
	RenewalDate      connection.DateTime `json:"renewal_date"`
}

Certificate represents an SSL certificate

type CertificateContent

type CertificateContent struct {
	Server       string `json:"server"`
	Intermediate string `json:"intermediate"`
}

CertificateContent represents the content of an SSL certificate

type CertificateNotFoundError

type CertificateNotFoundError struct {
	ID int
}

CertificateNotFoundError indicates a virtual machine was not found

func (*CertificateNotFoundError) Error

func (e *CertificateNotFoundError) Error() string

type CertificatePrivateKey

type CertificatePrivateKey struct {
	Key string `json:"key"`
}

CertificatePrivateKey represents an SSL certificate private key

type CertificateStatus

type CertificateStatus string
const (
	CertificateStatusCompleted      CertificateStatus = "Completed"
	CertificateStatusProcessing     CertificateStatus = "Processing"
	CertificateStatusExpired        CertificateStatus = "Expired"
	CertificateStatusExpiring       CertificateStatus = "Expiring"
	CertificateStatusPendingInstall CertificateStatus = "Pending Install"
)

func (CertificateStatus) String

func (s CertificateStatus) String() string

type CertificateValidation

type CertificateValidation struct {
	Domains   []string            `json:"domains"`
	ExpiresAt connection.DateTime `json:"expires_at"`
}

CertificateValidation represents the results of certificate validation

type RecommendationLevel

type RecommendationLevel string
const (
	RecommendationLevelLow    RecommendationLevel = "low"
	RecommendationLevelMedium RecommendationLevel = "medium"
	RecommendationLevelHigh   RecommendationLevel = "high"
)

func (RecommendationLevel) String

func (s RecommendationLevel) String() string

type Recommendations

type Recommendations struct {
	Level    RecommendationLevel `json:"level"`
	Messages []string            `json:"messages"`
}

Recommendations represents SSL recommendations

type Report

type Report struct {
	Certificate struct {
		Name               string              `json:"name"`
		ValidFrom          connection.DateTime `json:"valid_from"`
		ValidTo            connection.DateTime `json:"valid_to"`
		Issuer             string              `json:"issuer"`
		SerialNumber       string              `json:"serial_number"`
		SignatureAlgorithm string              `json:"signature_algorithm"`
		CoversDomain       bool                `json:"covers_domain"`
		DomainsSecured     []string            `json:"domains_secured"`
		MultiDomain        bool                `json:"multi_domain"`
		Wildcard           bool                `json:"wildcard"`
		Expiring           bool                `json:"expiring"`
		Expired            bool                `json:"expired"`
		SecureSha          bool                `json:"secure_sha"`
	} `json:"certificate"`
	Server struct {
		IP             string              `json:"ip"`
		Hostname       string              `json:"hostname"`
		Port           string              `json:"port"`
		CurrentTime    connection.DateTime `json:"current_time"`
		ServertTime    connection.DateTime `json:"server_time"`
		Software       string              `json:"software"`
		OpenSSLVersion string              `json:"openssl_version"`
		SSLVersions    struct {
			TLS struct {
				// contains filtered or unexported fields
			} `json:"tls"`
			SSL struct {
				// contains filtered or unexported fields
			} `json:"ssl"`
		} `json:"ssl_versions"`
	} `json:"server"`
	Vulnerabilities struct {
		Heartbleed bool `json:"heartbleed"`
		Poodle     bool `json:"poodle"`
	} `json:"vulnerabilities"`
	Findings []string `json:"findings"`
	Chain    struct {
		Certificates []struct {
			Name               string              `json:"name"`
			ValidFrom          connection.DateTime `json:"valid_from"`
			ValidTo            connection.DateTime `json:"valid_to"`
			Issuer             string              `json:"issuer"`
			SerialNumber       string              `json:"serial_number"`
			SignatureAlgorithm string              `json:"signature_algorithm"`
			ChainIntact        bool                `json:"chain_intact"`
			CertificateType    string              `json:"certificate_type"`
		} `json:"certificates"`
	} `json:"chain"`
	ChainIntact bool `json:"chain_intact"`
}

Report represents an SSL report

type SSLService

type SSLService interface {
	GetCertificates(parameters connection.APIRequestParameters) ([]Certificate, error)
	GetCertificatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Certificate], error)
	GetCertificate(certificateID int) (Certificate, error)
	GetCertificateContent(certificateID int) (CertificateContent, error)
	GetCertificatePrivateKey(certificateID int) (CertificatePrivateKey, error)
	GetReport(domainName string) (Report, error)
	GetRecommendations(domainName string) (Recommendations, error)
	ValidateCertificate(req ValidateRequest) (CertificateValidation, error)
}

SSLService is an interface for managing SSL certificates

type Service

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

Service implements SSLService for managing SSL certificates via the UKFast API

func NewService

func NewService(connection connection.Connection) *Service

NewService returns a new instance of SSLService

func (*Service) GetCertificate

func (s *Service) GetCertificate(certificateID int) (Certificate, error)

GetCertificate retrieves a single certificate by id

func (*Service) GetCertificateContent

func (s *Service) GetCertificateContent(certificateID int) (CertificateContent, error)

GetCertificateContent retrieves the content of an SSL certificate

func (*Service) GetCertificatePrivateKey

func (s *Service) GetCertificatePrivateKey(certificateID int) (CertificatePrivateKey, error)

GetCertificatePrivateKey retrieves an SSL certificate private key

func (*Service) GetCertificates

func (s *Service) GetCertificates(parameters connection.APIRequestParameters) ([]Certificate, error)

GetCertificates retrieves a list of certificates

func (*Service) GetCertificatesPaginated

func (s *Service) GetCertificatesPaginated(parameters connection.APIRequestParameters) (*connection.Paginated[Certificate], error)

GetCertificatesPaginated retrieves a paginated list of certificates

func (*Service) GetRecommendations

func (s *Service) GetRecommendations(domainName string) (Recommendations, error)

GetRecommendations retrieves SSL recommendations for a domain

func (*Service) GetReport

func (s *Service) GetReport(domainName string) (Report, error)

GetReport retrieves a single report by id

func (*Service) ValidateCertificate

func (s *Service) ValidateCertificate(req ValidateRequest) (CertificateValidation, error)

ValidateCertificate validates a certificate

type ValidateRequest

type ValidateRequest struct {
	Key         string `json:"key"`
	Certificate string `json:"certificate"`
	CABundle    string `json:"ca_bundle"`
}

ValidateRequest represents a request to validate a certificate

Jump to

Keyboard shortcuts

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