forked from stolostron/multicluster-observability-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACM-10269] Stamp CSR's organization units with the hash of the CA bu…
…ndle (stolostron#1464) * Stamp the observability addon CSR with the hash of the CA Signed-off-by: Douglas Camata <[email protected]> * Stamp all CSR with the hash of the CA Signed-off-by: Douglas Camata <[email protected]> * Adds certs test helpers Signed-off-by: Douglas Camata <[email protected]> * Go mod tidy Signed-off-by: Douglas Camata <[email protected]> * Add missing copyright notice Signed-off-by: Douglas Camata <[email protected]> --------- Signed-off-by: Douglas Camata <[email protected]> Signed-off-by: Periklis Tsirakidis <[email protected]>
- Loading branch information
1 parent
375b31f
commit fc06fb1
Showing
5 changed files
with
115 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
operators/multiclusterobservability/pkg/certificates/test_helpers.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) Red Hat, Inc. | ||
// Copyright Contributors to the Open Cluster Management project | ||
// Licensed under the Apache License 2.0 | ||
|
||
package certificates | ||
|
||
import ( | ||
"bytes" | ||
"time" | ||
|
||
"github.com/openshift/library-go/pkg/crypto" | ||
) | ||
|
||
func NewSigningCertKeyPair(signerName string, validity time.Duration) (certData, keyData []byte, err error) { | ||
ca, err := crypto.MakeSelfSignedCAConfigForDuration(signerName, validity) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
certBytes := &bytes.Buffer{} | ||
keyBytes := &bytes.Buffer{} | ||
if err := ca.WriteCertConfig(certBytes, keyBytes); err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
return certBytes.Bytes(), keyBytes.Bytes(), nil | ||
} |