Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultSignaturePath(binaryPath string) string
- func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)
- func ParsePublicKey(hexKey string) (ed25519.PublicKey, error)
- func SignBinary(binaryPath, outputSigPath string, privateKey ed25519.PrivateKey) error
- func VerifyBinary(binaryPath, signaturePath string, trustedKeys []ed25519.PublicKey) error
- type Verifier
Constants ¶
const GoatKitPublicKey = "fa81e60073ee6f3e5825c575c18a7c2556f2abf2640dcf0e296a98fe4eb60fa6"
GoatKitPublicKey is the GoatKit publisher key. It signs the first-party plugins and the plugins bundled with GoatFlow, and is always trusted.
Variables ¶
var ErrUntrusted = errors.New("plugin signature check failed")
ErrUntrusted marks plugin code refused because it is unsigned or not signed by a trusted key.
Functions ¶
func DefaultSignaturePath ¶
DefaultSignaturePath returns the default signature file path for a binary. For binary "/path/to/plugin", returns "/path/to/plugin.sig"
func GenerateKeyPair ¶
func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)
GenerateKeyPair generates a new ed25519 key pair for plugin signing.
func ParsePublicKey ¶ added in v0.11.0
ParsePublicKey decodes a hex ed25519 public key.
func SignBinary ¶
func SignBinary(binaryPath, outputSigPath string, privateKey ed25519.PrivateKey) error
SignBinary creates a signature file for a plugin binary. The signature file will be created at outputSigPath and contains the ed25519 signature of the binary's SHA-256 hash.
Types ¶
type Verifier ¶ added in v0.11.0
type Verifier struct {
// Required: a plugin binary (gRPC executable or WASM module) must carry a
// .sig file from a trusted key, and a marketplace package must be signed.
Required bool
// Keys are the trusted publisher keys.
Keys []ed25519.PublicKey
}
Verifier decides whether plugin code may be installed and run.
func VerifierFromEnv ¶ added in v0.11.0
VerifierFromEnv returns the configured verifier. Signatures are required unless GOATFLOW_REQUIRE_SIGNATURES is "0" or "false". The trusted keys are the GoatKit key plus GOATFLOW_TRUSTED_KEYS (comma-separated hex) and GOATFLOW_TRUSTED_KEYS_FILE (one hex key per line, # comments); an invalid key is an error rather than being skipped.