forked from TrueCloudLab/certificates
Add gibberish test key bytes to Helm tests
This commit is contained in:
parent
3262ffd43b
commit
459bfc4c4f
6 changed files with 35 additions and 16 deletions
|
@ -129,6 +129,10 @@ func TestPKI_WriteHelmTemplate(t *testing.T) {
|
||||||
// and `p.GenerateIntermediateCertificate`.
|
// and `p.GenerateIntermediateCertificate`.
|
||||||
setFiles(t, p)
|
setFiles(t, p)
|
||||||
|
|
||||||
|
// setSSHSigningKeys sets predefined SSH user and host certificate and key bytes.
|
||||||
|
// This replaces the logic in `p.GenerateSSHSigningKeys`
|
||||||
|
setSSHSigningKeys(t, p)
|
||||||
|
|
||||||
w := &bytes.Buffer{}
|
w := &bytes.Buffer{}
|
||||||
if err := p.WriteHelmTemplate(w); (err != nil) != tt.wantErr {
|
if err := p.WriteHelmTemplate(w); (err != nil) != tt.wantErr {
|
||||||
t.Errorf("PKI.WriteHelmTemplate() error = %v, wantErr %v", err, tt.wantErr)
|
t.Errorf("PKI.WriteHelmTemplate() error = %v, wantErr %v", err, tt.wantErr)
|
||||||
|
@ -197,6 +201,21 @@ func setKeyPair(t *testing.T, p *PKI) {
|
||||||
|
|
||||||
// setFiles sets some static, gibberish intermediate and root CA certificate bytes.
|
// setFiles sets some static, gibberish intermediate and root CA certificate bytes.
|
||||||
func setFiles(t *testing.T, p *PKI) {
|
func setFiles(t *testing.T, p *PKI) {
|
||||||
p.Files["/home/step/certs/root_ca.crt"] = encodeCertificate(&x509.Certificate{Raw: []byte("these are just some fake root CA cert bytes")})
|
p.Files[p.Root[0]] = encodeCertificate(&x509.Certificate{Raw: []byte("these are just some fake root CA cert bytes")})
|
||||||
p.Files["/home/step/certs/intermediate_ca.crt"] = encodeCertificate(&x509.Certificate{Raw: []byte("these are just some fake intermediate CA cert bytes")})
|
p.Files[p.RootKey[0]] = []byte("these are just some fake root CA key bytes")
|
||||||
|
p.Files[p.Intermediate] = encodeCertificate(&x509.Certificate{Raw: []byte("these are just some fake intermediate CA cert bytes")})
|
||||||
|
p.Files[p.IntermediateKey] = []byte("these are just some fake intermediate CA key bytes")
|
||||||
|
}
|
||||||
|
|
||||||
|
// setSSHSigningKeys sets some static, gibberish ssh user and host CA certificate and key bytes.
|
||||||
|
func setSSHSigningKeys(t *testing.T, p *PKI) {
|
||||||
|
|
||||||
|
if !p.options.enableSSH {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
p.Files[p.Ssh.HostKey] = []byte("fake ssh host key bytes")
|
||||||
|
p.Files[p.Ssh.HostPublicKey] = []byte("fake ssh host cert bytes")
|
||||||
|
p.Files[p.Ssh.UserKey] = []byte("fake ssh user key bytes")
|
||||||
|
p.Files[p.Ssh.UserPublicKey] = []byte("fake ssh user cert bytes")
|
||||||
}
|
}
|
||||||
|
|
4
pki/testdata/helm/simple.yml
vendored
4
pki/testdata/helm/simple.yml
vendored
|
@ -64,11 +64,11 @@ inject:
|
||||||
x509:
|
x509:
|
||||||
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
||||||
intermediate_ca_key: |
|
intermediate_ca_key: |
|
||||||
|
these are just some fake intermediate CA key bytes
|
||||||
|
|
||||||
# root_ca_key contains the contents of your encrypted root CA key
|
# root_ca_key contains the contents of your encrypted root CA key
|
||||||
# Note that this value can be omitted without impacting the functionality of step-certificates
|
# Note that this value can be omitted without impacting the functionality of step-certificates
|
||||||
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
||||||
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
||||||
root_ca_key: |
|
root_ca_key: |
|
||||||
|
these are just some fake root CA key bytes
|
||||||
|
|
4
pki/testdata/helm/with-acme.yml
vendored
4
pki/testdata/helm/with-acme.yml
vendored
|
@ -65,11 +65,11 @@ inject:
|
||||||
x509:
|
x509:
|
||||||
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
||||||
intermediate_ca_key: |
|
intermediate_ca_key: |
|
||||||
|
these are just some fake intermediate CA key bytes
|
||||||
|
|
||||||
# root_ca_key contains the contents of your encrypted root CA key
|
# root_ca_key contains the contents of your encrypted root CA key
|
||||||
# Note that this value can be omitted without impacting the functionality of step-certificates
|
# Note that this value can be omitted without impacting the functionality of step-certificates
|
||||||
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
||||||
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
||||||
root_ca_key: |
|
root_ca_key: |
|
||||||
|
these are just some fake root CA key bytes
|
||||||
|
|
4
pki/testdata/helm/with-admin.yml
vendored
4
pki/testdata/helm/with-admin.yml
vendored
|
@ -64,11 +64,11 @@ inject:
|
||||||
x509:
|
x509:
|
||||||
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
||||||
intermediate_ca_key: |
|
intermediate_ca_key: |
|
||||||
|
these are just some fake intermediate CA key bytes
|
||||||
|
|
||||||
# root_ca_key contains the contents of your encrypted root CA key
|
# root_ca_key contains the contents of your encrypted root CA key
|
||||||
# Note that this value can be omitted without impacting the functionality of step-certificates
|
# Note that this value can be omitted without impacting the functionality of step-certificates
|
||||||
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
||||||
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
||||||
root_ca_key: |
|
root_ca_key: |
|
||||||
|
these are just some fake root CA key bytes
|
||||||
|
|
4
pki/testdata/helm/with-provisioner.yml
vendored
4
pki/testdata/helm/with-provisioner.yml
vendored
|
@ -64,11 +64,11 @@ inject:
|
||||||
x509:
|
x509:
|
||||||
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
||||||
intermediate_ca_key: |
|
intermediate_ca_key: |
|
||||||
|
these are just some fake intermediate CA key bytes
|
||||||
|
|
||||||
# root_ca_key contains the contents of your encrypted root CA key
|
# root_ca_key contains the contents of your encrypted root CA key
|
||||||
# Note that this value can be omitted without impacting the functionality of step-certificates
|
# Note that this value can be omitted without impacting the functionality of step-certificates
|
||||||
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
||||||
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
||||||
root_ca_key: |
|
root_ca_key: |
|
||||||
|
these are just some fake root CA key bytes
|
||||||
|
|
12
pki/testdata/helm/with-ssh.yml
vendored
12
pki/testdata/helm/with-ssh.yml
vendored
|
@ -56,10 +56,10 @@ inject:
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
|
||||||
# ssh_host_ca contains the text of the public ssh key for the SSH root CA
|
# ssh_host_ca contains the text of the public ssh key for the SSH root CA
|
||||||
ssh_host_ca:
|
ssh_host_ca: fake ssh host cert bytes
|
||||||
|
|
||||||
# ssh_user_ca contains the text of the public ssh key for the SSH root CA
|
# ssh_user_ca contains the text of the public ssh key for the SSH root CA
|
||||||
ssh_user_ca:
|
ssh_user_ca: fake ssh user cert bytes
|
||||||
|
|
||||||
# Secrets contains the root and intermediate keys and optionally the SSH
|
# Secrets contains the root and intermediate keys and optionally the SSH
|
||||||
# private keys
|
# private keys
|
||||||
|
@ -72,19 +72,19 @@ inject:
|
||||||
x509:
|
x509:
|
||||||
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
# intermediate_ca_key contains the contents of your encrypted intermediate CA key
|
||||||
intermediate_ca_key: |
|
intermediate_ca_key: |
|
||||||
|
these are just some fake intermediate CA key bytes
|
||||||
|
|
||||||
# root_ca_key contains the contents of your encrypted root CA key
|
# root_ca_key contains the contents of your encrypted root CA key
|
||||||
# Note that this value can be omitted without impacting the functionality of step-certificates
|
# Note that this value can be omitted without impacting the functionality of step-certificates
|
||||||
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
# If supplied, this should be encrypted using a unique password that is not used for encrypting
|
||||||
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
# the intermediate_ca_key, ssh.host_ca_key or ssh.user_ca_key.
|
||||||
root_ca_key: |
|
root_ca_key: |
|
||||||
|
these are just some fake root CA key bytes
|
||||||
ssh:
|
ssh:
|
||||||
# ssh_host_ca_key contains the contents of your encrypted SSH Host CA key
|
# ssh_host_ca_key contains the contents of your encrypted SSH Host CA key
|
||||||
host_ca_key: |
|
host_ca_key: |
|
||||||
|
fake ssh host key bytes
|
||||||
|
|
||||||
# ssh_user_ca_key contains the contents of your encrypted SSH User CA key
|
# ssh_user_ca_key contains the contents of your encrypted SSH User CA key
|
||||||
user_ca_key: |
|
user_ca_key: |
|
||||||
|
fake ssh user key bytes
|
||||||
|
|
Loading…
Reference in a new issue