Skip to content

Commit c2ad7c2

Browse files
Jan Lieskovskypskopek
authored andcommitted
[CIAM-535] [KEYCLOAK-18574] Refactor the Red Hat Single Sign-On for OpenShift
images to start using Wildfly / JBoss EAP Galleon based Maven repository instead of a formerly used server Zip archive. Update to RH-SSO 7.5.0 Signed-off-by: Jan Lieskovsky <[email protected]>
1 parent 5fe5116 commit c2ad7c2

File tree

311 files changed

+16456
-5664
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

311 files changed

+16456
-5664
lines changed

README.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# Red Hat Single Sign-On Continuous Delivery 7.5 OpenShift container image
2-
3-
NOTE: Extends link:https://github.com/jboss-container-images/redhat-sso-7-image[Red Hat Single Sign-On container image]
1+
# Red Hat Single Sign-On 7.5 for OpenJDK / OpenJ9 on OpenShift container images
42

53
# License
64

README.adoc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Application Templates for Red Hat Single Sign-On 7.5 OpenShift container image
1+
= Application Templates for Red Hat Single Sign-On 7.5 on OpenShift container images
22

33
This project contains OpenShift v3 / v4 application templates which support applications based on JBoss Middleware products.
44
Source can be found https://github.com/jboss-container-images/redhat-sso-7-openshift-image/tree/sso75-cpaas-dev[here].

image.yaml

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ schema_version: 1
22

33
## Both name and description are overridden, see overrides/*
44
name: "rh-sso-7/sso75-openshift-rhel8"
5-
description: "Red Hat Single Sign-On 7.5 OpenShift container image, based on the Red Hat Universal Base Image 8 Minimal container image"
5+
description: "Red Hat Single Sign-On 7.5 for OpenShift container image, based on the Red Hat Universal Base Image 8 Minimal container image"
66

77
version: "7.5"
88
from: "registry.redhat.io/ubi8/ubi-minimal"
@@ -25,6 +25,7 @@ labels:
2525
value: "sso,sso75,keycloak"
2626
- name: "io.openshift.s2i.scripts-url"
2727
value: "image:///usr/local/s2i"
28+
2829
envs:
2930
- name: "JBOSS_PRODUCT"
3031
value: *product
@@ -66,45 +67,51 @@ envs:
6667
- name: "SCRIPT_DEBUG"
6768
description: "If set to true, ensurses that the bash scripts are executed with the -x option, printing the commands and their arguments as they are executed."
6869
example: "true"
70+
6971
ports:
7072
- value: 8443
73+
7174
modules:
7275
repositories:
76+
- name: cct_module
77+
git:
78+
url: https://github.com/jboss-openshift/cct_module.git
79+
ref: 0.45.2
80+
7381
- name: jboss-eap-modules
7482
git:
7583
url: https://github.com/jboss-container-images/jboss-eap-modules.git
76-
ref: EAP_740_CR1
84+
ref: EAP_740_CR3
7785

7886
- name: jboss-eap-image
7987
git:
8088
url: https://github.com/jboss-container-images/jboss-eap-7-image.git
81-
ref: EAP_740_CR1
89+
ref: EAP_740_CR3
8290

83-
- name: cct_module
91+
- name: wildfly-cekit-modules
8492
git:
85-
url: https://github.com/jboss-openshift/cct_module.git
86-
ref: 0.41.4
93+
url: https://github.com/wildfly/wildfly-cekit-modules.git
94+
ref: 0.24.0
8795

8896
- name: sso-modules
8997
path: modules
9098

9199
install:
92-
- name: bz-1769831
93-
version: '1.0'
100+
# Install JDK runtime
94101
- name: sso-jdk
95102
version: &jdk_version '11'
103+
# Perform all actions required by Wildfly / JBoss EAP Galleon Maven build
104+
# See 'used-eap-modules-list.txt' for overview of used JBoss EAP modules,
105+
# and the order they need to be called in
96106
- name: eap
97107
version: '1.0'
98108

99-
# RH-SSO product specific modules from modules/ path in this repository
100-
- name: sso
109+
## RH-SSO product specific modules from modules/ path in this repository
101110
- name: keycloak.openshift.clients
102111
version: '1.0'
103112
- name: sso.config.launch.setup.75
104113
- name: sso.db.drivers
105114
version: '1.0'
106-
- name: sso.python
107-
version: '3'
108115

109116
# Other common modules from the main CE cct_module repository
110117
- name: openshift-layer
@@ -114,19 +121,17 @@ modules:
114121
- name: sso-pre-launch-checks
115122

116123
# This needs to be the very last, after all updates to standalone-openshift.xml have been done. See eg. https://access.redhat.com/solutions/3402171 for use
117-
- name: os-eap-extensions
118124
- name: sso-cli-extensions
119125

126+
# Actions performed by the 'sso-rm-openjdk' module shouldn't be needed for RHEL-8 UBI Minimal
127+
# derived images already. But it's kept & called here for any case, so RPMs belonging to
128+
# counterpart JVM aren't left in the image by an accident
120129
- name: sso-rm-openjdk
121130
version: *jdk_version
131+
122132
packages:
123133
manager: microdnf
124134
content_sets_file: content_sets.yaml
125-
install:
126-
# "find" executable is required by various CCT & SSO modules
127-
- findutils
128-
# "which" tool is handy for debugging issues / troubleshooting
129-
- which
130135

131136
run:
132137
cmd:

modules/eap/module.yaml

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,26 @@ version: '1.0'
55

66
modules:
77
install:
8-
### Image :: Standalone ####
9-
- name: eap-73-latest
10-
11-
### Image :: OpenShift ####
12-
# Order of the modules installation below matters!!! DO NOT CHANGE it unless
13-
# you first verified the image with changed order still works correctly
14-
# Common modules from the main CE cct_module repository
15-
- name: dynamic-resources
16-
- name: jboss.container.eap.s2i.bash
17-
- name: jboss.container.java.jvm.bash
18-
- name: jboss.container.jolokia.bash
19-
- name: jboss.container.wildfly.standalone-conf.java
20-
- name: jboss.container.wildfly.standalone-conf.jolokia
21-
- name: os-eap7-ping
22-
- name: jboss.container.java.jvm.bash
23-
- name: os-eap-launch
24-
- name: os-eap7-launch
25-
- name: os-eap-datasource
26-
version: '1.0'
27-
- name: jboss.eap.cd.logging
28-
- name: jboss.eap.config.jgroups
29-
- name: jboss.eap.config.elytron
30-
- name: os-eap-probes
31-
version: '3.0'
32-
- name: jboss.container.maven.35.bash
33-
version: '3.5'
34-
- name: os-eap-hawkular
35-
- name: os-eap-deployment-scanner
8+
- name: setup.eap.modules
9+
version: "1.0"
3610

3711
execute:
3812
- script: install-eap-one-offs.sh
3913

14+
# Important:
15+
# ----------
16+
#
4017
# All EAP one-offs artifacts must be prefixed with "eap-one-off-" prefix and suffixed with in ".zip".
4118
# Ensure that only one-offs for the INSTALLED version of EAP are present, and comment all of them
4219
# that are obsoleted.
20+
#
21+
# For an example of proper / intended usage, see the "jbeap-18807.zip" example below.
22+
#
4323
# artifacts:
4424
#
4525
# KEYCLOAK-13487 "jbeap-18807.zip" is obsolete in EAP-7.3.1 / RH-SSO 7.5.1, deprecate it
4626
#
4727
# - md5: 1b6036cfcde2cf1dc05c2eb6eca228ff
4828
# name: jbeap-18807.zip
4929
# target: eap-one-off-jbeap-18807.zip
50-
# url: http://$DOWNLOAD_SERVER/devel/candidates/JBSSO/JBSSO-7.5.0.CR2/jbeap-18807.zip
30+
# url: http://$DOWNLOAD_SERVER/devel/candidates/JBSSO/JBSSO-7.5.0.CR2/jbeap-18807.zip
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
function preConfigure() {
4+
preconfigure_extensions
5+
}
6+
7+
# if a delayedpostconfigure.sh file exists call postconfigure.sh
8+
# The delayedpostconfigure.sh will be called after CLI execution.
9+
function postConfigure() {
10+
if [ -f "${JBOSS_HOME}/extensions/delayedpostconfigure.sh" ]; then
11+
postconfigure_extensions
12+
fi
13+
}
14+
15+
# if a delayedpostconfigure.sh file exists call it, otherwise fallback on postconfigure.sh
16+
function delayedPostConfigure() {
17+
if [ -f "${JBOSS_HOME}/extensions/delayedpostconfigure.sh" ]; then
18+
${JBOSS_HOME}/extensions/delayedpostconfigure.sh
19+
else
20+
postconfigure_extensions
21+
fi
22+
}
23+
24+
function preconfigure_extensions(){
25+
if [ -f "${JBOSS_HOME}/extensions/preconfigure.sh" ]; then
26+
${JBOSS_HOME}/extensions/preconfigure.sh
27+
fi
28+
}
29+
30+
function postconfigure_extensions(){
31+
if [ -f "${JBOSS_HOME}/extensions/postconfigure.sh" ]; then
32+
${JBOSS_HOME}/extensions/postconfigure.sh
33+
fi
34+
}
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
#!/bin/sh
2+
# only processes a single environment as the placeholder is not preserved
3+
4+
source $JBOSS_HOME/bin/launch/logging.sh
5+
6+
function prepareEnv() {
7+
unset HTTPS_NAME
8+
unset HTTPS_PASSWORD
9+
unset HTTPS_KEYSTORE_DIR
10+
unset HTTPS_KEYSTORE
11+
unset HTTPS_KEYSTORE_TYPE
12+
}
13+
14+
function configure() {
15+
configure_https
16+
}
17+
18+
function configureEnv() {
19+
configure
20+
}
21+
22+
function configure_https() {
23+
if [ "${CONFIGURE_ELYTRON_SSL}" = "true" ]; then
24+
log_info "Using Elytron for SSL configuration."
25+
return
26+
fi
27+
28+
local sslConfMode
29+
getConfigurationMode "<!-- ##SSL## -->" "sslConfMode"
30+
31+
local httpsConfMode
32+
getConfigurationMode "<!-- ##HTTPS_CONNECTOR## -->" "httpsConfMode"
33+
34+
35+
if [ -n "${HTTPS_PASSWORD}" -a -n "${HTTPS_KEYSTORE_DIR}" -a -n "${HTTPS_KEYSTORE}" ]; then
36+
37+
if [ "${sslConfMode}" = "xml" ]; then
38+
configureSslXml
39+
elif [ "${sslConfMode}" = "cli" ]; then
40+
configureSslCli
41+
fi
42+
43+
if [ "${httpsConfMode}" = "xml" ]; then
44+
configureHttpsXml
45+
elif [ "${httpsConfMode}" = "cli" ]; then
46+
configureHttpsCli
47+
fi
48+
49+
elif [ -n "${HTTPS_PASSWORD}" -o -n "${HTTPS_KEYSTORE_DIR}" -o -n "${HTTPS_KEYSTORE}" ]; then
50+
log_warning "Partial HTTPS configuration, the https connector WILL NOT be configured."
51+
52+
if [ "${sslConfMode}" = xml ]; then
53+
sed -i "s|<!-- ##SSL## -->|<!-- No SSL configuration discovered -->|" $CONFIG_FILE
54+
fi
55+
56+
if [ "${httpsConfMode}" = xml ]; then
57+
sed -i "s|<!-- ##HTTPS_CONNECTOR## -->|<!-- No HTTPS configuration discovered -->|" $CONFIG_FILE
58+
fi
59+
fi
60+
}
61+
62+
function configureSslXml() {
63+
if [ -n "$HTTPS_KEYSTORE_TYPE" ]; then
64+
keystore_provider="provider=\"${HTTPS_KEYSTORE_TYPE}\""
65+
fi
66+
ssl="<server-identities>\n\
67+
<ssl>\n\
68+
<keystore ${keystore_provider} path=\"${HTTPS_KEYSTORE_DIR}/${HTTPS_KEYSTORE}\" keystore-password=\"${HTTPS_PASSWORD}\"/>\n\
69+
</ssl>\n\
70+
</server-identities>"
71+
72+
sed -i "s|<!-- ##SSL## -->|${ssl}|" $CONFIG_FILE
73+
}
74+
75+
function configureSslCli() {
76+
local app_realm_resource="/core-service=management/security-realm=ApplicationRealm"
77+
local ssl_resource="${app_realm_resource}/server-identity=ssl"
78+
local ssl_add="$ssl_resource:add(keystore-path=\"${HTTPS_KEYSTORE_DIR}/${HTTPS_KEYSTORE}\", keystore-password=\"${HTTPS_PASSWORD}\""
79+
if [ -n "$HTTPS_KEYSTORE_TYPE" ]; then
80+
ssl_add="${ssl_add}, keystore-provider=\"${HTTPS_KEYSTORE_TYPE}\""
81+
fi
82+
ssl_add="${ssl_add})"
83+
84+
cat << EOF >> ${CLI_SCRIPT_FILE}
85+
if (outcome != success) of ${app_realm_resource}:read-resource
86+
echo You have set the HTTPS_PASSWORD, HTTPS_KEYSTORE_DIR and HTTPS_KEYSTORE to add the ssl server-identity. Fix your configuration to contain the ${app_realm_resource} resource for this to happen. >> \${error_file}
87+
exit
88+
end-if
89+
if (outcome == success) of ${ssl_resource}:read-resource
90+
echo You have set the HTTPS_PASSWORD, HTTPS_KEYSTORE_DIR and HTTPS_KEYSTORE to add the ssl server-identity. But this already exists in the base configuration. Fix your configuration. >> \${error_file}
91+
exit
92+
end-if
93+
${ssl_add}
94+
EOF
95+
}
96+
97+
function configureHttpsXml() {
98+
https_connector="<https-listener name=\"https\" socket-binding=\"https\" security-realm=\"ApplicationRealm\" proxy-address-forwarding=\"true\"/>"
99+
sed -i "s|<!-- ##HTTPS_CONNECTOR## -->|${https_connector}|" $CONFIG_FILE
100+
}
101+
102+
function configureHttpsCli() {
103+
# No subsystem is an error
104+
local xpath="\"//*[local-name()='subsystem' and starts-with(namespace-uri(), 'urn:jboss:domain:undertow:')]\""
105+
local ssRet
106+
testXpathExpression "${xpath}" "ssRet"
107+
if [ "${ssRet}" -ne 0 ]; then
108+
echo "You have set HTTPS_PASSWORD, HTTPS_KEYSTORE_DIR and HTTPS_KEYSTORE to add an undertow https-listener. Fix your configuration to contain the undertow subsystem for this to happen." >> "${CONFIG_ERROR_FILE}"
109+
return
110+
fi
111+
112+
# Not having any servers is an error
113+
local serverNamesRet
114+
# We grab the <server name="..."> attributes, and will use them later
115+
local xpath="\"//*[local-name()='subsystem' and starts-with(namespace-uri(), 'urn:jboss:domain:undertow:')]/*[local-name()='server']/@name\""
116+
testXpathExpression "${xpath}" "serverNamesRet"
117+
if [ "${serverNamesRet}" -ne 0 ]; then
118+
echo "You have set HTTPS_PASSWORD, HTTPS_KEYSTORE_DIR and HTTPS_KEYSTORE to add an undertow https-listener. Fix your configuration to contain at least one server in the undertow subsystem for this to happen." >> ${CONFIG_ERROR_FILE}
119+
return
120+
fi
121+
122+
# Existing https-listener(s) is an error
123+
local httpsListenersRet
124+
local xpath="\"//*[local-name()='subsystem' and starts-with(namespace-uri(), 'urn:jboss:domain:undertow:')]/*[local-name()='server']/*[local-name()='https-listener']/@name\""
125+
testXpathExpression "${xpath}" "httpsListenersRet"
126+
if [ "${httpsListenersRet}" -eq 0 ]; then
127+
echo "You have set HTTPS_PASSWORD, HTTPS_KEYSTORE_DIR and HTTPS_KEYSTORE to add https-listeners to your undertow servers, however at least one of these already contains an https-listener. Fix your configuration." >> "${CONFIG_ERROR_FILE}"
128+
return
129+
fi
130+
131+
cat << EOF >> ${CLI_SCRIPT_FILE}
132+
for serverName in /subsystem=undertow:read-children-names(child-type=server)
133+
/subsystem=undertow/server=\$serverName/https-listener=https:add(security-realm=ApplicationRealm, socket-binding=https, proxy-address-forwarding=true)
134+
done
135+
EOF
136+
137+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<secure-deployment name="##KEYCLOAK_DEPLOYMENT##"><realm>##KEYCLOAK_REALM##</realm><resource>##KEYCLOAK_CLIENT##</resource><auth-server-url>##KEYCLOAK_URL##</auth-server-url><enable-basic-auth>true</enable-basic-auth><credential name="secret">##KEYCLOAK_SECRET##</credential><enable-cors>##KEYCLOAK_ENABLE_CORS##</enable-cors><bearer-only>##KEYCLOAK_BEARER_ONLY##</bearer-only>##KEYCLOAK_PRINCIPAL_ATTRIBUTE##</secure-deployment>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<subsystem xmlns="urn:jboss:domain:keycloak:1.1"><realm name="##KEYCLOAK_REALM##"><!-- ##KEYCLOAK_PUBLIC_KEY## --><auth-server-url>##KEYCLOAK_URL##</auth-server-url><register-node-at-startup>true</register-node-at-startup><register-node-period>600</register-node-period><ssl-required>external</ssl-required><disable-trust-manager>##KEYCLOAK_DISABLE_TRUST_MANAGER##</disable-trust-manager><!-- ##KEYCLOAK_TRUSTSTORE## --><allow-any-hostname>false</allow-any-hostname></realm>##KEYCLOAK_DEPLOYMENT_SUBSYSTEM##</subsystem>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<secure-deployment name="##KEYCLOAK_DEPLOYMENT##">##KEYCLOAK_SAML_SP##</secure-deployment>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<subsystem xmlns="urn:jboss:domain:keycloak-saml:1.1">##KEYCLOAK_DEPLOYMENT_SUBSYSTEM##</subsystem>

0 commit comments

Comments
 (0)