Documentation
¶
Index ¶
Constants ¶
const ( // FileMode is the mode of an installed KRL, which is read-only as // nothing but [Verified.Install] should change it FileMode fs.FileMode = 0440 )
const Namespace = "krl@com.github.serverless-ssh-ca.andrewheberle"
Namespace is the SSHSIG namespace the CA signs KRLs with
Variables ¶
var ( // ErrInvalidSignature is returned when the signature on the KRL cannot be // decoded or does not verify with the CA public key ErrInvalidSignature = errors.New("krl signature verification failed") // ErrNoPublicKey is returned when no CA public key is provided to verify // the signature on the KRL with ErrNoPublicKey = errors.New("no public key provided for signature verification") // ErrOlderKRL is returned when the KRL is older than an existing KRL ErrOlderKRL = errors.New("krl is older than the existing krl") // ErrUnexpectedCA is returned when a certificate section of the KRL is not // for the CA, including sections that apply to any CA ErrUnexpectedCA = errors.New("encountered krl certificate section with unexpected CA") // ErrUnexpectedSection is returned when the KRL contains a section that // does not revoke certificates, such as one revoking explicit keys ErrUnexpectedSection = errors.New("encountered unexpected section type in krl") )
Functions ¶
This section is empty.
Types ¶
type CertificateType ¶ added in v0.23.1
type CertificateType string
CertificateType is the type of certificate a KRL revokes
const ( // User is the KRL for user certificates User CertificateType = "user" // Host is the KRL for host certificates Host CertificateType = "host" )
type Outcome ¶ added in v0.25.1
type Outcome int
Outcome is the result of a successful Verified.Install
const ( // Written means the KRL was written, replacing any older KRL Written Outcome = iota // Unchanged means the file already held the KRL with [FileMode], so it // was not written Unchanged // ReplacedUnparseable means the file held something that could not be // parsed as a KRL, so it was replaced ReplacedUnparseable )
type Verified ¶ added in v0.25.1
type Verified struct {
// contains filtered or unexported fields
}
Verified is a KRL whose signature has been verified with the CA public key and that only revokes certificates issued by that CA. It can only be obtained from Fetch.
func Fetch ¶ added in v0.25.1
func Fetch(ctx context.Context, server string, certificatetype CertificateType, pub ssh.PublicKey, opts ...api.ClientOption) (*Verified, error)
Fetch retrieves the KRL for certificatetype from server and verifies it with pub, which must be the public key of the CA. Requests use the client from httpclient.New unless opts sets another with api.WithHTTPClient.
func (*Verified) Generated ¶ added in v0.25.1
Generated returns the time the KRL was generated by the CA
func (*Verified) Install ¶ added in v0.25.1
Install atomically writes the KRL to path with FileMode. A KRL older than one already at path is never installed, so a previously issued KRL cannot un-revoke certificates; an error wrapping ErrOlderKRL is returned and the file is left alone. KRLs are compared by version and then by the date they were generated, as the CA does not increase the version for each KRL.