You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[CIAM-1394] Use a non-printable character - ASCII 31 (octal 037) unit
separator character as the sed substitute (s) command delimiter for each
existing call of "sed -i" and "sed -e" across the various container image
modules, where either the regexp or the replacement value is dynamically
generated (IOW it's not a fixed string) and it's based on / derived from
the value of some environment variable.
Do this to avoid clash of the sed substitute command delimiter with some
special character specified in env var value (e.g. in password), leading to:
* sed: -e expression #1, char <CHAR_POS>: unterminated `s' command
* sed: -e expression #1, char <CHAR_POS>: unknown option to 's'
type of errors
Signed-off-by: Jan Lieskovsky <[email protected]>
sed -i "s|##KEYCLOAK_REALM##|${SSO_REALM}|g""${CONFIG_FILE}"
601
+
# CIAM-1394 correction
602
+
sed -i "s${AUS}##KEYCLOAK_REALM##${AUS}${SSO_REALM}${AUS}g""${CONFIG_FILE}"
603
+
# EOF CIAM-1394 correction
594
604
595
605
if [ -n"$SSO_PUBLIC_KEY" ];then
596
-
sed -i "s|<!-- ##KEYCLOAK_PUBLIC_KEY## -->|<realm-public-key>${SSO_PUBLIC_KEY}</realm-public-key>|g""${CONFIG_FILE}"
606
+
# CIAM-1394 correction
607
+
sed -i "s${AUS}<!-- ##KEYCLOAK_PUBLIC_KEY## -->${AUS}<realm-public-key>${SSO_PUBLIC_KEY}</realm-public-key>${AUS}g""${CONFIG_FILE}"
608
+
# EOF CIAM-1394 correction
597
609
fi
598
610
599
611
if [ -n"$SSO_TRUSTSTORE" ] && [ -n"$SSO_TRUSTSTORE_DIR" ];then
600
-
sed -i "s|<!-- ##KEYCLOAK_TRUSTSTORE## -->|<truststore>${SSO_TRUSTSTORE_DIR}/${SSO_TRUSTSTORE}</truststore><truststore-password>${SSO_TRUSTSTORE_PASSWORD}</truststore-password>|g""${CONFIG_FILE}"
612
+
# CIAM-1394 correction
613
+
sed -i "s${AUS}<!-- ##KEYCLOAK_TRUSTSTORE## -->${AUS}<truststore>${SSO_TRUSTSTORE_DIR}/${SSO_TRUSTSTORE}</truststore><truststore-password>${SSO_TRUSTSTORE_PASSWORD}</truststore-password>${AUS}g""${CONFIG_FILE}"
614
+
# EOF CIAM-1394 correction
601
615
sed -i "s|##KEYCLOAK_DISABLE_TRUST_MANAGER##|false|g""${CONFIG_FILE}"
602
616
else
603
617
sed -i "s|##KEYCLOAK_DISABLE_TRUST_MANAGER##|true|g""${CONFIG_FILE}"
604
618
fi
605
619
606
-
sed -i "s|##KEYCLOAK_URL##|${SSO_URL}|g""${CONFIG_FILE}"
620
+
# CIAM-1394 correction
621
+
sed -i "s${AUS}##KEYCLOAK_URL##${AUS}${SSO_URL}${AUS}g""${CONFIG_FILE}"
622
+
# EOF CIAM-1394 correction
607
623
608
624
if [ -n"$SSO_SAML_CERTIFICATE_NAME" ];then
609
-
sed -i "s|##SSO_SAML_CERTIFICATE_NAME##|${SSO_SAML_CERTIFICATE_NAME}|g""${CONFIG_FILE}"
625
+
# CIAM-1394 correction
626
+
sed -i "s${AUS}##SSO_SAML_CERTIFICATE_NAME##${AUS}${SSO_SAML_CERTIFICATE_NAME}${AUS}g""${CONFIG_FILE}"
627
+
# EOF CIAM-1394 correction
610
628
fi
611
629
612
630
if [ -n"$SSO_SAML_KEYSTORE_PASSWORD" ];then
613
-
sed -i "s|##SSO_SAML_KEYSTORE_PASSWORD##|${SSO_SAML_KEYSTORE_PASSWORD}|g""${CONFIG_FILE}"
631
+
# CIAM-1394 correction
632
+
sed -i "s${AUS}##SSO_SAML_KEYSTORE_PASSWORD##${AUS}${SSO_SAML_KEYSTORE_PASSWORD}${AUS}g""${CONFIG_FILE}"
633
+
# EOF CIAM-1394 correction
614
634
fi
615
635
616
636
if [ -n"$SSO_SAML_KEYSTORE" ] && [ -n"$SSO_SAML_KEYSTORE_DIR" ];then
617
-
sed -i "s|##SSO_SAML_KEYSTORE##|${SSO_SAML_KEYSTORE_DIR}/${SSO_SAML_KEYSTORE}|g""${CONFIG_FILE}"
637
+
# CIAM-1394 correction
638
+
sed -i "s${AUS}##SSO_SAML_KEYSTORE##${AUS}${SSO_SAML_KEYSTORE_DIR}/${SSO_SAML_KEYSTORE}${AUS}g""${CONFIG_FILE}"
639
+
# EOF CIAM-1394 correction
618
640
fi
619
641
else
620
642
log_warning "Missing SSO_URL. Unable to properly configure SSO-enabled applications"
@@ -661,7 +683,9 @@ function explode_keycloak_deployments() {
661
683
662
684
if [ -f"${JBOSS_HOME}/standalone/deployments/${sso_deployment}/WEB-INF/web.xml" ];then
sed -i "s|${requested_auth_method}|${auth_method}|""${JBOSS_HOME}/standalone/deployments/${sso_deployment}/WEB-INF/web.xml"
686
+
# CIAM-1394 correction
687
+
sed -i "s${AUS}${requested_auth_method}${AUS}${auth_method}${AUS}""${JBOSS_HOME}/standalone/deployments/${sso_deployment}/WEB-INF/web.xml"
688
+
# EOF CIAM-1394 correction
665
689
fi
666
690
done
667
691
}
@@ -694,12 +718,16 @@ function configure_extension() {
694
718
}
695
719
696
720
functionconfigure_extensions_no_marker() {
697
-
sed -i "s|${EXTENSIONS_END_MARKER}|<extension module=\"org.keycloak.keycloak-adapter-subsystem\"/><extension module=\"org.keycloak.keycloak-saml-adapter-subsystem\"/>${EXTENSIONS_END_MARKER}|""${CONFIG_FILE}"
721
+
# CIAM-1394 correction
722
+
sed -i "s${AUS}${EXTENSIONS_END_MARKER}${AUS}<extension module=\"org.keycloak.keycloak-adapter-subsystem\"/><extension module=\"org.keycloak.keycloak-saml-adapter-subsystem\"/>${EXTENSIONS_END_MARKER}${AUS}""${CONFIG_FILE}"
723
+
# EOF CIAM-1394 correction
698
724
}
699
725
700
726
functionconfigure_security_domain() {
701
727
keycloak_security_domain=$(cat "${KEYCLOAK_SECURITY_DOMAIN_FILE}"| sed ':a;N;$!ba;s|\n|\\n|g')
702
-
sed -i "s|<!-- ##KEYCLOAK_SECURITY_DOMAIN## -->|${keycloak_security_domain%$'\n'}|""${CONFIG_FILE}"
728
+
# CIAM-1394 correction
729
+
sed -i "s${AUS}<!-- ##KEYCLOAK_SECURITY_DOMAIN## -->${AUS}${keycloak_security_domain%$'\n'}${AUS}""${CONFIG_FILE}"
730
+
# EOF CIAM-1394 correction
703
731
}
704
732
705
733
functionconfigure_subsystem() {
@@ -975,7 +1003,9 @@ function configure_subsystem() {
975
1003
976
1004
if [ -z"$is_cli" ];then
977
1005
if [ -n"$subsystem" ];then
978
-
sed -i "s|<!-- ${subsystem_marker} -->|${subsystem%$'\n'}|""${CONFIG_FILE}"
1006
+
# CIAM-1394 correction
1007
+
sed -i "s${AUS}<!-- ${subsystem_marker} -->${AUS}${subsystem%$'\n'}${AUS}""${CONFIG_FILE}"
0 commit comments