Initial commit
This commit is contained in:
commit
612a19c01a
23 changed files with 2402 additions and 0 deletions
30
checker/rules_tls.go
Normal file
30
checker/rules_tls.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package checker
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
sdk "git.happydns.org/checker-sdk-go/checker"
|
||||
)
|
||||
|
||||
// tlsQualityRule folds findings from a downstream TLS checker (cert
|
||||
// chain, hostname match, expiry, …) onto SIP rule output, so they appear
|
||||
// on the SIP service page without users having to go look at the TLS
|
||||
// checker themselves.
|
||||
type tlsQualityRule struct{}
|
||||
|
||||
func (r *tlsQualityRule) Name() string { return "sip.tls_quality" }
|
||||
func (r *tlsQualityRule) Description() string {
|
||||
return "Folds the downstream TLS checker findings (certificate chain, hostname match, expiry) onto the SIP service."
|
||||
}
|
||||
|
||||
func (r *tlsQualityRule) Evaluate(ctx context.Context, obs sdk.ObservationGetter, _ sdk.CheckerOptions) []sdk.CheckState {
|
||||
related, _ := obs.GetRelated(ctx, TLSRelatedKey)
|
||||
if len(related) == 0 {
|
||||
return []sdk.CheckState{notTestedState("sip.tls_quality.skipped", "No related TLS observation available (no TLS checker downstream, or no probe yet).")}
|
||||
}
|
||||
issues := tlsIssuesFromRelated(related)
|
||||
if len(issues) == 0 {
|
||||
return []sdk.CheckState{passState("sip.tls_quality.ok", "Downstream TLS checker reports no issues on the SIP endpoints.")}
|
||||
}
|
||||
return statesFromIssues(issues)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue