Skip to content

Commit

Permalink
rollback base64 -w 0 command to doesn't create end of lines
Browse files Browse the repository at this point in the history
  • Loading branch information
igor lopes committed Oct 10, 2022
1 parent 7f1d0d1 commit ff69101
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions admission-webhook/deploy/create-signed-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ fi

echo $SERVER_CSR

cat $SERVER_CSR | base64

# create server cert/key CSR and send to k8s API
CSR_CONTENTS=$(cat <<EOF
apiVersion: certificates.k8s.io/v1
Expand All @@ -120,7 +118,7 @@ metadata:
spec:
groups:
- system:authenticated
request: $(cat "$SERVER_CSR" | base64)
request: $(cat "$SERVER_CSR" | base64 -w 0)
signerName: beta.eks.amazonaws.com/app-serving
usages:
- digital signature
Expand All @@ -147,6 +145,6 @@ if ! $DRY_RUN; then
}
SERVER_CERT_CONTENTS=$(wait_for verify_cert_signed "after approving CSR $CSR_NAME, the signed certificate did not appear on the resource")

gen_server_cert() { echo "$SERVER_CERT_CONTENTS" | openssl base64 -d -A -out "$SERVER_CERT"; }
gen_server_cert() { echo "$SERVER_CERT_CONTENTS" | openssl base64 -w 0 -d -A -out "$SERVER_CERT"; }
gen_file gen_server_cert "$SERVER_CERT"
fi
6 changes: 3 additions & 3 deletions admission-webhook/deploy/deploy-gmsa-webhook.sh
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ main() {
# the TLS certificate might not have been generated yet if it's a dry run
local TLS_CERTIFICATE
if [ -r "$SERVER_CERT" ]; then
TLS_CERTIFICATE=$(cat "$SERVER_CERT" | base64)
TLS_CERTIFICATE=$(cat "$SERVER_CERT" | base64 -w 0)
elif $DRY_RUN; then
TLS_CERTIFICATE='TBD'
else
Expand All @@ -172,7 +172,7 @@ main() {

if [ -f "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" ]; then
info 'using pod based authentication'
BUNDLE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt | base64 | tr -d '\n')
BUNDLE=$(cat /var/run/secrets/kubernetes.io/serviceaccount/ca.crt | base64 -w 0 | tr -d '\n')
else
info 'using config file authentication'
BUNDLE=$($KUBECTL config view --raw --minify --flatten -o jsonpath='{.clusters[].cluster.certificate-authority-data}')
Expand All @@ -182,7 +182,7 @@ main() {
fatal_error "Not able to determine CA bundle for depoloyment"
fi

TLS_PRIVATE_KEY=$(cat "$SERVER_KEY" | base64) \
TLS_PRIVATE_KEY=$(cat "$SERVER_KEY" | base64 -w 0) \
TLS_CERTIFICATE="$TLS_CERTIFICATE" \
CA_BUNDLE="$BUNDLE" \
RBAC_ROLE_NAME="$NAMESPACE-$NAME-rbac-role" \
Expand Down

0 comments on commit ff69101

Please sign in to comment.