Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking committed Apr 28, 2024
1 parent 458ec53 commit 4676f70
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
6 changes: 5 additions & 1 deletion ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ type Ca struct {
}

func NewCa(Organization, OrganizationalUnit, CommonName string) *Ca {
var l []string
if OrganizationalUnit != "" {
l = []string{OrganizationalUnit}
}
c := &x509.Certificate{
Subject: pkix.Name{
Organization: []string{Organization},
OrganizationalUnit: []string{OrganizationalUnit},
OrganizationalUnit: l,
CommonName: CommonName,
},
NotBefore: time.Now(),
Expand Down
6 changes: 5 additions & 1 deletion cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ type Cert struct {
}

func NewCert(caPEM, caKeyPEM []byte, Organization, OrganizationalUnit string) *Cert {
var l []string
if OrganizationalUnit != "" {
l = []string{OrganizationalUnit}
}
c := &x509.Certificate{
Subject: pkix.Name{
Organization: []string{Organization},
OrganizationalUnit: []string{OrganizationalUnit},
OrganizationalUnit: l,
},
NotBefore: time.Date(2019, time.June, 1, 0, 0, 0, 0, time.UTC),
NotAfter: time.Now().AddDate(10, 0, 0),
Expand Down
Binary file added cli/mad/mad
Binary file not shown.
6 changes: 3 additions & 3 deletions cli/mad/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
func main() {
app := cli.NewApp()
app.Name = "Mad"
app.Version = "20240102"
app.Version = "20240428"
app.Usage = "Generate root CA and derivative certificate for any domains and any IPs"
app.Authors = []*cli.Author{
{
Expand Down Expand Up @@ -105,11 +105,11 @@ func main() {
},
&cli.StringSliceFlag{
Name: "ip",
Usage: "IP address. Repeated",
Usage: "IP address",
},
&cli.StringSliceFlag{
Name: "domain",
Usage: "Domain name. Repeated",
Usage: "Domain name",
},
},
Action: func(c *cli.Context) error {
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ go 1.16

require (
github.com/urfave/cli v1.22.5
github.com/urfave/cli/v2 v2.3.0 // indirect
github.com/urfave/cli/v2 v2.27.2 // indirect
gopkg.in/yaml.v2 v2.2.3 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/urfave/cli v1.22.5 h1:lNq9sAHXK2qfdI8W+GRItjCEkI+2oR4d+MEHy1CKXoU=
github.com/urfave/cli v1.22.5/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M=
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 comments on commit 4676f70

Please sign in to comment.