Documentation
¶
Overview ¶
Package sshkey implements a Packer data source that generates and caches SSH keys.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Datasource ¶
type Datasource struct {
// contains filtered or unexported fields
}
Datasource is the Packer data source that generates or loads an SSH key pair.
func (*Datasource) ConfigSpec ¶
func (d *Datasource) ConfigSpec() hcldec.ObjectSpec
ConfigSpec returns the HCL object spec for the data source inputs.
func (*Datasource) Configure ¶
func (d *Datasource) Configure(raws ...any) error
Configure decodes HCL config into the datasource and applies defaults.
func (*Datasource) Execute ¶
func (d *Datasource) Execute() (cty.Value, error)
Execute generates a new key or loads an existing one from the Packer cache.
func (*Datasource) OutputSpec ¶
func (d *Datasource) OutputSpec() hcldec.ObjectSpec
OutputSpec returns the HCL object spec for the data source outputs.
type DatasourceOutput ¶
type DatasourceOutput struct {
PrivateKeyPath string `mapstructure:"private_key_path"`
PublicKey string `mapstructure:"public_key"`
}
DatasourceOutput is the value the data source exposes to downstream Packer config.
func (*DatasourceOutput) FlatMapstructure ¶
func (*DatasourceOutput) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }
FlatMapstructure returns a new FlatDatasourceOutput. FlatDatasourceOutput is an auto-generated flat version of DatasourceOutput. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.
type ED25519Key ¶
type ED25519Key struct {
// contains filtered or unexported fields
}
ED25519Key wraps an Ed25519 private key and implements the SSHKey interface.
func (*ED25519Key) FromPEM ¶
func (k *ED25519Key) FromPEM(bytes []byte) error
FromPEM parses a PEM-encoded PKCS#8 private key and asserts it is Ed25519.
func (*ED25519Key) Generate ¶
func (k *ED25519Key) Generate() error
Generate creates a new Ed25519 key pair using the system CSPRNG.
func (*ED25519Key) Public ¶
func (k *ED25519Key) Public() (string, error)
Public returns the OpenSSH-format authorised-keys string for the Ed25519 key.
func (*ED25519Key) ToPEM ¶
func (k *ED25519Key) ToPEM() ([]byte, error)
ToPEM serialises the Ed25519 private key as a PEM-encoded PKCS#8 block.
type FlatConfig ¶
type FlatConfig struct {
Name *string `mapstructure:"name" cty:"name" hcl:"name"`
Type *string `mapstructure:"type" cty:"type" hcl:"type"`
}
FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
type FlatDatasourceOutput ¶
type FlatDatasourceOutput struct {
PrivateKeyPath *string `mapstructure:"private_key_path" cty:"private_key_path" hcl:"private_key_path"`
PublicKey *string `mapstructure:"public_key" cty:"public_key" hcl:"public_key"`
}
FlatDatasourceOutput is an auto-generated flat version of DatasourceOutput. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.
func (*FlatDatasourceOutput) HCL2Spec ¶
func (*FlatDatasourceOutput) HCL2Spec() map[string]hcldec.Spec
HCL2Spec returns the hcl spec of a DatasourceOutput. This spec is used by HCL to read the fields of DatasourceOutput. The decoded values from this spec will then be applied to a FlatDatasourceOutput.
type RSAKey ¶
type RSAKey struct {
// contains filtered or unexported fields
}
RSAKey wraps an RSA private key and implements the SSHKey interface.