Clean up cert function

Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
Kristoffer Dalby 2022-11-10 08:02:40 +00:00 committed by Juan Font
parent 9bc6ac0f35
commit 69440058bb
1 changed files with 1 additions and 10 deletions

View File

@ -362,6 +362,7 @@ func (t *HeadscaleInContainer) WriteFile(path string, data []byte) error {
return integrationutil.WriteFileToContainer(t.pool, t.container, path, data) return integrationutil.WriteFileToContainer(t.pool, t.container, path, data)
} }
//nolint
func createCertificate() ([]byte, []byte, error) { func createCertificate() ([]byte, []byte, error) {
// From: // From:
// https://shaneutt.com/blog/golang-ca-and-signed-cert-go/ // https://shaneutt.com/blog/golang-ca-and-signed-cert-go/
@ -389,11 +390,6 @@ func createCertificate() ([]byte, []byte, error) {
return nil, nil, err return nil, nil, err
} }
// caBytes, err := x509.CreateCertificate(rand.Reader, ca, ca, &caPrivKey.PublicKey, caPrivKey)
// if err != nil {
// return nil, err
// }
cert := &x509.Certificate{ cert := &x509.Certificate{
SerialNumber: big.NewInt(1658), SerialNumber: big.NewInt(1658),
Subject: pkix.Name{ Subject: pkix.Name{
@ -445,10 +441,5 @@ func createCertificate() ([]byte, []byte, error) {
return nil, nil, err return nil, nil, err
} }
// serverCert, err := tls.X509KeyPair(certPEM.Bytes(), certPrivKeyPEM.Bytes())
// if err != nil {
// return nil, err
// }
return certPEM.Bytes(), certPrivKeyPEM.Bytes(), nil return certPEM.Bytes(), certPrivKeyPEM.Bytes(), nil
} }