Skip to content

Commit

Permalink
fix -init without cn
Browse files Browse the repository at this point in the history
  • Loading branch information
nothinux committed Mar 5, 2022
1 parent e4a3a27 commit 3bba86f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cmd/certify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"log"
"os"
"strings"
)

const usage = `Usage of certify:
Expand Down Expand Up @@ -43,7 +44,15 @@ func main() {
}
fmt.Println("CA private key file generated", caKeyPath)

if err := generateCA(pkey.PrivateKey, os.Args[2], caPath); err != nil {
var cn string

if len(os.Args) > 2 {
if strings.Contains(os.Args[2], "cn:") {
cn = os.Args[2]
}
}

if err := generateCA(pkey.PrivateKey, cn, caPath); err != nil {
log.Fatal(err)
}
fmt.Println("CA certificate file generated", caPath)
Expand Down

0 comments on commit 3bba86f

Please sign in to comment.