Remove unused TLS public key
The certificate is used in stead of a discrete public key. The generated public key was never actually used. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -38,7 +38,6 @@ func Test_Keys(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.FileExists(t, path.Join(keystorePath, "warewulf.key"))
|
||||
assert.FileExists(t, path.Join(keystorePath, "warewulf.crt"))
|
||||
assert.FileExists(t, path.Join(keystorePath, "warewulf.rsa.pub"))
|
||||
})
|
||||
|
||||
t.Run("keys exist check", func(t *testing.T) {
|
||||
|
||||
@@ -26,7 +26,6 @@ func GenTLSKeys() error {
|
||||
|
||||
keyFile := path.Join(keystore, "warewulf.key")
|
||||
certFile := path.Join(keystore, "warewulf.crt")
|
||||
pubFile := path.Join(keystore, "warewulf.rsa.pub")
|
||||
wwlog.Verbose("Generating new x509 keys in %s", keystore)
|
||||
priv, err := rsa.GenerateKey(rand.Reader, 4096)
|
||||
if err != nil {
|
||||
@@ -87,18 +86,5 @@ func GenTLSKeys() error {
|
||||
return fmt.Errorf("failed to write data to cert file: %w", err)
|
||||
}
|
||||
|
||||
pubBytes, err := x509.MarshalPKIXPublicKey(&priv.PublicKey)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal public key: %w", err)
|
||||
}
|
||||
pubOut, err := os.OpenFile(pubFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to open public key file for writing: %w", err)
|
||||
}
|
||||
defer pubOut.Close()
|
||||
if err := pem.Encode(pubOut, &pem.Block{Type: "PUBLIC KEY", Bytes: pubBytes}); err != nil {
|
||||
return fmt.Errorf("failed to write data to public key file: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user