Skip to content

Commit

Permalink
chore: update to sha256 for session file (#2184)
Browse files Browse the repository at this point in the history
In general, vSphere is maving from SHA1 to SHA256-based TLS certificate thumbprints. This change allows the use of a SHA256 thumbprint when connecting to vCenter Server.

Support for SHA256 was added to `vmware/govmomi` v0.36.1.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam authored Apr 29, 2024
1 parent 5a4d2bd commit 1895bc1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions vsphere/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package vsphere

import (
"context"
"crypto/sha1"
"crypto/sha256"
"encoding/json"
"fmt"
"io"
Expand Down Expand Up @@ -325,7 +325,7 @@ func (c *Config) sessionFile() (string, error) {
// Key session file off of full URI and insecure setting.
// Hash key to get a predictable, canonical format.
key := fmt.Sprintf("%s#insecure=%t", u.String(), c.InsecureFlag)
name := fmt.Sprintf("%040x", sha1.Sum([]byte(key)))
name := fmt.Sprintf("%040x", sha256.Sum256([]byte(key)))
return name, nil
}

Expand Down

0 comments on commit 1895bc1

Please sign in to comment.