Skip to content

Commit

Permalink
Also use ipv4
Browse files Browse the repository at this point in the history
  • Loading branch information
johanbrandhorst committed Aug 22, 2021
1 parent 0a5d15b commit 0b4cf6d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions issuers/cfssl/cfssl_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var (
)

var _ = BeforeSuite(func() {
cert, key, err := generateCertAndKey("localhost", net.IPv6zero)
cert, key, err := generateCertAndKey("localhost", net.IPv4(0, 0, 0, 0), net.IPv6zero)
Expect(err).To(Succeed())

ctx := context.Background()
Expand Down Expand Up @@ -234,7 +234,7 @@ var _ = AfterSuite(func() {
}
})

func generateCertAndKey(SAN string, IPSAN net.IP) ([]byte, []byte, error) {
func generateCertAndKey(SAN string, IPSAN ...net.IP) ([]byte, []byte, error) {
priv, err := rsa.GenerateKey(rand.Reader, 2048)
if err != nil {
return nil, nil, err
Expand All @@ -257,7 +257,7 @@ func generateCertAndKey(SAN string, IPSAN net.IP) ([]byte, []byte, error) {
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
BasicConstraintsValid: true,
DNSNames: []string{SAN},
IPAddresses: []net.IP{IPSAN},
IPAddresses: IPSAN,
}
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, priv.Public(), priv)
if err != nil {
Expand Down

0 comments on commit 0b4cf6d

Please sign in to comment.