cert

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CERTCmd = &cobra.Command{
	Use:   "cert",
	Short: "CERT commands",
	Long:  `Manipulate CERTs`,
}
View Source
var CreateCERTCmd = &cobra.Command{
	Use:   "loadorcreate",
	Short: "Create a new CERT and save in a secret",
	Long:  `Create a new CERT and save in a secret`,
	Run: func(cmd *cobra.Command, args []string) {
		myca := new(pki.CA)
		myca.SetupCA()

		if caname == "" {
			caname = utils.GetEnv("CA_SECRET_NAME", "micropki-ca")
		}
		if certname == "" {
			certname = utils.GetEnv("CERT_SECRET_NAME", "micropki-cert")
		}
		caNamespace, err := vars.ValidateNamespace(caNamespace)
		if err != nil {
			panic(err.Error())
		}
		namespace, err := vars.ValidateNamespace(namespace)
		if err != nil {
			panic(err.Error())
		}
		err = myca.LoadFromSecret(caname, caNamespace)
		if err != nil {
			panic("Secret CA can't be loaded")
		}
		mycert := new(pki.CERT)
		mycert.SetupCERT(false, strings.Split(fqdns, ","), commonname)
		err = mycert.LoadFromSecret(certname, namespace)
		if err != nil {
			err = mycert.NewCERT(caname, caNamespace)
			if err != nil {
				panic(err.Error())
			}
			err = mycert.SaveToSecret(certname, namespace)
			if err != nil {
				panic(err.Error())
			}
		}

	}}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL