Documentation ¶
Index ¶
- Constants
- Variables
- func CheckChallengeOnAllNS(token string, fqdn string, globalTimeout time.Duration, ...)
- func CheckTimeoutValues(_ *cobra.Command, _ []string)
- func CleanChallenge(client *NETVSClient, fqdn string, token string, debugPrintf DebugPrintfFunc) error
- func CommonDNSWaitFlags(rootCmd *cobra.Command)
- func CommonGlobalFlags(appName string, rootCmd *cobra.Command)
- func CommonViperSetup(commands ...*cobra.Command)
- func CreateCertificateFQDN(ta Transaction, fqdn string)
- func CreateChallengeFQDN(ta Transaction, fqdn string)
- func CreateChallengeRecord(ta Transaction, fqdn string, token string)
- func CreateFQDN(ta Transaction, fqdn string, fqdnType string, description string)
- func DebugPrintVersion(printfFunc DebugPrintfFunc, version string)
- func DeleteChallengeRecord(ta Transaction, fqdn string, token string)
- func DeployChallenge(client *NETVSClient, fqdn string, token string, debugPrintf DebugPrintfFunc) error
- func FinalizeViperSetup(rootCmd *cobra.Command)
- func GetInformation(ta Transaction, fqdn string, token string)
- func HandleChallengePrefix(fqdn string, remove bool, debugPrintf DebugPrintfFunc) string
- func InstallDebugHandler() (string, chan string, error)
- func NameserverHasChallenge(nameserver, fqdn, challenge string) bool
- func NameserversForFQDN(domain string) ([]string, error)
- func ReaderToString(r io.Reader) string
- type AuthorizationError
- type ClientConfig
- type DebugPrintfFunc
- type DnsFqdn
- type DnsRecord
- type GetSessionToken
- type InternalServerError
- type InvalidRequest
- type NETVSClient
- type NETVSConfig
- type NETVSCredentialINI
- type NETVSCredentialSection
- type NetVSActionFunc
- type OtherUnexpectedResponseError
- type TAResult
- type TAStatement
- type TAStatementDataMap
- type Transaction
- type TransactionEntry
- type TransactionList
- type UnexpectedNonTerminalTypeError
Constants ¶
const ( DNSWaitTimeoutMin = time.Second * 5 DNSWaitBetweenMin = time.Second * 1 )
const ( FormatNSHasChallenge = "✅ [%s] Challenge is available on %s (after %s)" FormatExecutionInfo = "✨ Running hook %s, version %s" FormatAPITokenSource = "✨ Using NETVS API token from %s" FormatClientFromIni = "✨ Using config file %s" FormatWaitingForChallenges = "✨ Waiting for %d parallel nameserver checks" FormatNewGoroutineForFQDN = "✨ [%s] Started new goroutine to check DNS challenge on %s" FormatNSList = "✨ [%s] has nameservers %s" FormatGenericInfo = "✨ [%s] %s" FormatNewAcmeTxtInfo = "✨ [%s] Creating new TXT record _acme-challenge.%s: %s" FormatChallengeCleanedUp = "👍 [%s] Removed challenge %s" FormatDNSChecksDone = "👍 [%s] Nameserver checks are done" FormatDNSWaitAfterChecksWaiting = "✨ Waiting %s after successful DNS checks" FormatConfigfileCantOpen = "👎 Unable to open config file %s, skipping file: %s" FormatCommandNotImplemented = "👎 operation »%s« is not implemented in this plugin" FormatEmptyDomain = "💀 CERTBOT_DOMAIN is empty" FormatConfigfileNoneFound = "💀 Unable to find a suitable config file" FormatConfigfileParseError = "💀 Unable to parse config file %s: %s" FormatUnknownEndpoint = "💀 Unknown endpoint %s" FormatMissingCommand = "💀 Missing command. See --help for details." FormatEmptyValidation = "💀 [%s] CERTBOT_VALIDATION is empty" FormatDNSCheckTimeout = "💀 [%s] DNS check on nameserver »%s« timed out after %s" FormatChallengeDeployment = "💀 [%s] Error deploying challenge. API error: »%s«" FormatUnableToFindNS = "💀 [%s] Error looking up nameserver for domain %s: %s" FormatChallengeCleanup = "💀 [%s] Error removing challenge. API error: »%s«" FormatNoNSforDomain = "💀 [%s] Unable to find any nameserver for domain %s" FormatDurationTooSmall = "💀 Duration value for %s is too small (%s < %s). Did you omit a time unit?" FormatNSDoesNotHaveChallenge = "🔧️ [%s] Challenge is NOT yet available on %s" FormatNETVSClientCreated = "🚀 NETVS client created (baseURI: »%s«, apiVersion: »%s«)" FormatHasChallengePrefix = "⁉️ Domain »%s« has prefix »_acme-challenge.«. Please check the way you're calling acme4netvs." FormatChallengePrefixRemoved = "️💥 Removed prefix »_acme-challenge.« from domain »%s«. Please fix the way you're calling acme4netvs if possible." )
const ( CommonTextHelp = `` /* 255-byte string literal not displayed */ CommonTextLatestRelease = ` Visit https://www.ca.kit.edu/p/software/acme4netvs to get the latest release. ` )
const ( DefaultAPIVersion = "3.2" URITemplate = `https://%s/api/%s/wapi/transaction/execute` BASEURITEST = "www-net-test.scc.kit.edu" BASEURIPROD = "www-net.scc.kit.edu" BASEURIDEVEL = "www-net-devel.scc.kit.edu" )
Variables ¶
var (
ErrorNoNameserverFound = errors.New("unable to find nameserver for domain")
)
Functions ¶
func CheckChallengeOnAllNS ¶
func CheckTimeoutValues ¶
func CleanChallenge ¶
func CleanChallenge(client *NETVSClient, fqdn string, token string, debugPrintf DebugPrintfFunc) error
func CommonDNSWaitFlags ¶
func CommonGlobalFlags ¶
func CommonViperSetup ¶
func CreateCertificateFQDN ¶
func CreateCertificateFQDN(ta Transaction, fqdn string)
CreateCertificateFQDN creates Transaction which creates the FQDN we want a certificate for
func CreateChallengeFQDN ¶
func CreateChallengeFQDN(ta Transaction, fqdn string)
CreateChallengeFQDN creates Transaction which creates the "_acme-challenge." FQDN
func CreateChallengeRecord ¶
func CreateChallengeRecord(ta Transaction, fqdn string, token string)
CreateChallengeRecord creates Transaction which creates the "_acme-challenge." TXT record
func CreateFQDN ¶
func CreateFQDN(ta Transaction, fqdn string, fqdnType string, description string)
CreateFQDN creates Transaction for a generic FQDN creation
func DebugPrintVersion ¶
func DebugPrintVersion(printfFunc DebugPrintfFunc, version string)
func DeleteChallengeRecord ¶
func DeleteChallengeRecord(ta Transaction, fqdn string, token string)
DeleteChallengeRecord creates Transaction which deletes the "_acme-challenge." TXT record
func DeployChallenge ¶
func DeployChallenge(client *NETVSClient, fqdn string, token string, debugPrintf DebugPrintfFunc) error
func FinalizeViperSetup ¶
func GetInformation ¶
func GetInformation(ta Transaction, fqdn string, token string)
GetInformation creates a Transaction to get all information required for challenge response record creation
func HandleChallengePrefix ¶
func HandleChallengePrefix(fqdn string, remove bool, debugPrintf DebugPrintfFunc) string
func InstallDebugHandler ¶
func NameserverHasChallenge ¶
func NameserversForFQDN ¶
func ReaderToString ¶
Types ¶
type AuthorizationError ¶
type AuthorizationError error
type ClientConfig ¶
type DebugPrintfFunc ¶
func MakeDebugFunc ¶
func MakeDebugFunc(enable bool, writer io.Writer) DebugPrintfFunc
type DnsFqdn ¶
type DnsFqdn struct { Description string `mapstructure:"description"` Gpk string `mapstructure:"gpk"` HasRr bool `mapstructure:"has_rr"` IsDhcp bool `mapstructure:"is_dhcp"` IsEmptyNonterminal bool `mapstructure:"is_empty_nonterminal"` IsHost bool `mapstructure:"is_host"` IsNonterminal bool `mapstructure:"is_nonterminal"` IsOwn bool `mapstructure:"is_own"` IsWildcard bool `mapstructure:"is_wildcard"` Label string `mapstructure:"label"` ParentValue string `mapstructure:"parent_value"` RadType uint `mapstructure:"rad_type"` RrChainTargetBcdList []string `mapstructure:"rr_chain_target_bcd_list"` RrChainTargetIsOwn bool `mapstructure:"rr_chain_target_is_own"` SubFqdnCount uint `mapstructure:"sub_fqdn_count"` Type string `mapstructure:"type"` Value string `mapstructure:"value"` ValueIDNA string `mapstructure:"value_idna"` Zone string `mapstructure:"zone"` }
type DnsRecord ¶
type DnsRecord struct { Data string `mapstructure:"data"` Fqdn string `mapstructure:"fqdn"` FqdnDescription string `mapstructure:"fqdn_description"` FqdnType string `mapstructure:"fqdn_type"` Gpk string `mapstructure:"gpk"` HostIsNws bool `mapstructure:"host_is_nws"` IsOwn bool `mapstructure:"is_own"` TargetBcdList []string `mapstructure:"target_bcd_list"` TargetDataUnref string `mapstructure:"target_data_unref"` TargetFqdn string `mapstructure:"target_fqdn"` TargetFqdnType string `mapstructure:"target_fqdn_type"` TargetIpaddr string `mapstructure:"target_ipaddr"` TargetIsReverseUnique bool `mapstructure:"target_is_reverse_unique"` TargetIsSingleton bool `mapstructure:"target_is_singleton"` TTL int `mapstructure:"ttl"` TTLResetDate string `mapstructure:"ttl_reset_date"` TTLResetDays string `mapstructure:"ttl_reset_days"` TTLZoneDefault int `mapstructure:"ttl_zone_default"` Type string `mapstructure:"type"` Zone string `mapstructure:"zone"` }
type GetSessionToken ¶
type GetSessionToken func() string
GetSessionToken returns a string containing a session token
type InternalServerError ¶
type InternalServerError error
type InvalidRequest ¶
type InvalidRequest error
type NETVSClient ¶
type NETVSClient struct { NETVSConfig Client *http.Client }
func BuildLocalNetVSClient ¶
func BuildLocalNetVSClient(debugPrintf DebugPrintfFunc) *NETVSClient
func NewNETVSClient ¶
func NewNETVSClient(config *NETVSConfig) *NETVSClient
NewNETVSClient creates a new NETVSClient that automatically adds authentication headers
func (*NETVSClient) ExecuteTA ¶
func (c *NETVSClient) ExecuteTA(t Transaction) (TAResult, error)
type NETVSConfig ¶
type NETVSConfig struct { BaseURI string APIVersion string SessionToken GetSessionToken }
func CmdConfigFromAPIToken ¶
func CmdConfigFromAPIToken(apiToken string, debugPrintf DebugPrintfFunc) (*NETVSConfig, error)
func CmdParseAllNETVSConfigs ¶
func CmdParseAllNETVSConfigs(debugPrintf DebugPrintfFunc) (*NETVSConfig, error)
func CmdParseNETVSConfig ¶
func CmdParseNETVSConfig(cfgPath string) (*NETVSConfig, error)
type NETVSCredentialINI ¶
type NETVSCredentialINI struct { Endpoint string Sections map[string]NETVSCredentialSection }
func ParseNETVSCredentialsINI ¶
func ParseNETVSCredentialsINI(inicontents io.Reader) (*NETVSCredentialINI, error)
func (*NETVSCredentialINI) GetSections ¶
func (c *NETVSCredentialINI) GetSections() []string
func (*NETVSCredentialINI) ToNETVSConfig ¶
func (c *NETVSCredentialINI) ToNETVSConfig(endpoint, apiVersion string) *NETVSConfig
type NETVSCredentialSection ¶
type NetVSActionFunc ¶
type NetVSActionFunc func(client *NETVSClient, fqdn string, token string, debugPrintf DebugPrintfFunc) error
type OtherUnexpectedResponseError ¶
type OtherUnexpectedResponseError error
type TAStatement ¶
type TAStatement struct { Name string `json:"name"` Old TAStatementDataMap `json:"old,omitempty"` New TAStatementDataMap `json:"new,omitempty"` }
TAStatement represents a single transaction statement
func (TAStatement) AsPart ¶
func (taStatement TAStatement) AsPart() string
type TAStatementDataMap ¶
type TAStatementDataMap map[string]interface{}
TAStatementDataMap is a typed map for members Old and New of TAStatement
type Transaction ¶
type Transaction interface { // AsRequestBody returns the complete transaction as a string for the request body AsRequestBody() io.Reader // AddEntries appends transaction entries AddEntries(request ...TransactionEntry) // NumEntries returns the number of entries NumEntries() int }
type TransactionEntry ¶
type TransactionEntry interface { // AsPart returns a single request as json object for the transaction body AsPart() string }
type TransactionList ¶
type TransactionList []TransactionEntry
TransactionList holds the list of statements in a transaction. It implements the Transaction interface.
func NewTARequestBody ¶
func NewTARequestBody() *TransactionList
NewTARequestBody creates an empty transactionList
func (*TransactionList) AddEntries ¶
func (body *TransactionList) AddEntries(request ...TransactionEntry)
func (*TransactionList) AsRequestBody ¶
func (body *TransactionList) AsRequestBody() io.Reader
func (*TransactionList) NumEntries ¶
func (body *TransactionList) NumEntries() int
type UnexpectedNonTerminalTypeError ¶
type UnexpectedNonTerminalTypeError error