Documentation ¶
Index ¶
Constants ¶
View Source
const ConfigTemplateText = `` /* 1692-byte string literal not displayed */
FIXME[P2]: Factor out subject config as a text/template macro. FIXME[P1]: keyType
Variables ¶
View Source
var Command = &cli.Command{ Name: "issue", Usage: "Issue a new certificate or renew an existing certificate. Generates private key if needed.", Flags: append(structflags.MustPopulateFlagsFromStruct(Config{}), &cli.BoolFlag{ Name: "dump-template", Usage: "dump configuration template yaml without making actual changes", }, ), Action: func(c *cli.Context) error { env := wcli.GlobalEnvironment slog := env.Logger.Sugar() profile, err := env.Profile() if err != nil { return err } issuecfg, err := issue.DefaultConfig(env) if err != nil && !c.Bool("dump-template") { slog.Debugf("Errors encountered while constructing default config: %v", err) } cfg := &Config{ Issue: issuecfg, } if c.Bool("dump-template") { if err := frontend.DumpTemplate(ConfigTemplateText, cfg); err != nil { return err } return nil } if err := structflags.PopulateStructFromCliContext(cfg, c); err != nil { return err } if err := setup.EnsureCA(env, nil, profile); err != nil { return err } var priv crypto.PrivateKey priv, cfg.PrivateKeyPath, err = ReadOrGenerateKey(env, cfg.Issue.KeyType, cfg.PrivateKeyPath) if err != nil { return fmt.Errorf("Failed to acquire private key: %w", err) } pub, err := wcrypto.ExtractPublicKey(priv) if err != nil { return err } cfg.CertPath, err = PromptCertPath(env, cfg.PrivateKeyPath, cfg.CertPath) if err != nil { return fmt.Errorf("Failed to acquire certificate file path: %w", err) } if err := frontend.EditStructWithVerifier( env.Frontend, ConfigTemplateText, cfg, frontend.CallVerifyMethod); err != nil { return err } certDer, err := issue.Run(env, pub, cfg.Issue) if err != nil { return err } if err := storage.WriteCertificateDerFile(cfg.CertPath, certDer); err != nil { return err } return nil }, }
View Source
var ErrCertKeyPathConflict = errors.New("Specified path conflicts with private key output path.")
Functions ¶
func PromptCertPath ¶
func PromptCertPath(env *wcli.Environment, privPath, certPath string) (string, error)
func ReadOrGenerateKey ¶
func ReadOrGenerateKey(env *wcli.Environment, ktype wcrypto.KeyType, privPath string) (crypto.PrivateKey, string, error)
Types ¶
Click to show internal directories.
Click to hide internal directories.