Skip to content

Commit

Permalink
adding auth hash to log
Browse files Browse the repository at this point in the history
  • Loading branch information
misteriaud committed Feb 7, 2025
1 parent ddefa07 commit 9226d51
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/api/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
package util

import (
"bytes"
"context"
"crypto/sha256"
"crypto/subtle"
"crypto/tls"
"crypto/x509"
Expand Down Expand Up @@ -118,6 +120,17 @@ func CreateAndSetAuthToken(config model.Reader) error {
return fmt.Errorf("error while creating or fetching IPC cert: %w", err)
}

h := sha256.New()

_, err = h.Write(bytes.Join([][]byte{[]byte(token), ipccert, ipckey}, []byte{}))
if err != nil {
log.Errorf("error while hashing authtoken, cert and key: %v", err)
}

bs := h.Sum(nil)

log.Infof("auth hash: %x", bs)

certPool := x509.NewCertPool()
if ok := certPool.AppendCertsFromPEM(ipccert); !ok {
return fmt.Errorf("Unable to generate certPool from PERM IPC cert")
Expand Down

0 comments on commit 9226d51

Please sign in to comment.