You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
723 B

package main
import (
"fmt"
"log"
"os"
"git.neveris.one/gryffyn/genca/cert"
"git.neveris.one/gryffyn/genca/config"
)
func main() {
fmt.Println("Loading config...")
cfg := config.Cfg{
Outfile: "config.yml",
Config: &config.Config{},
}
err := cfg.Get()
if err != nil {
log.Fatalln(err)
}
cwd, err := os.Getwd()
ca := cert.CAFromConfig(*cfg.Config)
certs := cert.CertsFromConfig(*cfg.Config)
fmt.Println("Generating CA...")
err = ca.GenCert()
fmt.Println("Writing CA...")
err = ca.Write(cwd + "/ssl")
for _, cc := range certs {
fmt.Println("Generating cert '" + cc.Name + "'...")
err = cc.GenCert(&ca)
fmt.Println("Writing cert '" + cc.Name + "'...")
err = cc.Write(cwd + "/ssl")
}
}