rackerlabs / genestack

Where Flex cloud brings infrastructures to where you are.
https://docs.rackspacecloud.com/
Apache License 2.0
29 stars 32 forks source link

create-secrets.sh generates secrets with newline characters in base64 encoded secret data #340

Closed puni4220 closed 4 months ago

puni4220 commented 4 months ago

Describe the bug creating secrets with create-secrets.sh generates /etc/genestack/secrets.yaml It is seen that for secrets with character length more than 32 characters the base64 encoded data has a newline (\n) character due to which secret creation fails

To Reproduce Steps to reproduce the behavior:

  1. run the create-secrets.sh script from /opt/genstack/bin/ directory
  2. the generated file /etc/genestack/secrets.yaml contains base64 encoded data with newline '(\n)' characters

Expected behavior The generated secrets.yaml file should not contain newline (\n) characters for encoded secrets

Example

root@uac-k8m1:~# cat /etc/genestack/secrets.yaml
...
apiVersion: v1
kind: Secret
metadata:
  name: glance-rabbitmq-password
  namespace: openstack
type: Opaque
data:
  username: Z2xhbmNl
  password: MURLU2hpSGpOeWNaRUZkdkxkSWxhZTJWYlFuMEhEaEp2WlA4dkdONGN5RmZpWkk0b0JXVGpKMFVJ
Y1A1WlNzeA==

There should be "tr -d '\n'" to remove newline characters when the secret is encoded:

apiVersion: v1
kind: Secret
metadata:
  name: keystone-rabbitmq-password
  namespace: openstack
type: Opaque
data:
  username: $(echo -n "keystone" | base64)
  password: $(echo -n $keystone_rabbitmq_password | base64 | tr -d '\n')

Server (please complete the following information):

puni4220 commented 4 months ago

PR raised for this issue https://github.com/rackerlabs/genestack/pull/341

puni4220 commented 4 months ago

Closing this issue as the PR is merged