When i run the below shell script it is throwing the below error. I tried to troubleshoot it but i am unable to find where is the unexpected token. Any help would be appreciated.
ERROR:
ssl-certs.sh: command substitution: line 13: syntax error near unexpected token `('
ssl-certs.sh: command substitution: line 13: `openssl pkcs12 -in <(base64 -d <<<"${application_tls_p12}") -passin "pass:${application_tls_password}" -passout "pass:${application_tls_password}")'
Shell script:
#!/bin/bash
chmod +x /home/ssm-user/client/ssl.sh
cmcs_resp=$(/home/ssm-user/client/ssl.sh request-cert)
sudo /home/ssm-user/client/ssl.sh install-trusted-certs
application_tls_p12=$(jq --raw-output ".pkcs12" <<<"${cmcs_resp}")
application_tls_password=$(jq --raw-output ".password" <<<"${cmcs_resp}")
if ! openssl_response=$(openssl pkcs12 -in <(base64 -d <<<"${application_tls_p12}") \
-passin "pass:${application_tls_password}" \
-passout "pass:${application_tls_password}"); then
echo "ERROR: Failed to extract private key and certificate from CMCS credential"
echo "${openssl_response}"
fi
application_tls_private_key=$(sed -n \
-- '/^-----BEGIN ENCRYPTED PRIVATE KEY-----$/,/^-----END ENCRYPTED PRIVATE KEY-----$/p' \
<<<"${openssl_response}")
application_tls_cert=$(sed -n \
-- '/^-----BEGIN CERTIFICATE-----$/,/^-----END CERTIFICATE-----$/p' \
<<<"${openssl_response}")
echo "${application_tls_private_key}" >/application-cert.key
echo "${application_tls_password}" >/application-cert.pass
echo "${application_tls_cert}" >/application-cert.pem