Skip to content

Commit 0448259

Browse files
authored
Merge pull request #362 from gnsuryan/main
Outbound Access and Azure Security Fixes for WLS on AKS Offer
2 parents 09708ef + b8d2418 commit 0448259

18 files changed

+113
-102
lines changed

weblogic-azure-aks/src/main/arm/scripts/buildWLSDockerImage.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ function echo_stderr() {
88
echo "$@" >&2
99
}
1010

11-
# read <azureACRPassword> and <ocrSSOPSW> from stdin
11+
# read <azureACRShibboleth> and <ocrSSOShibboleth> from stdin
1212
function read_sensitive_parameters_from_stdin() {
13-
read azureACRPassword ocrSSOPSW
13+
read azureACRShibboleth ocrSSOShibboleth
1414
}
1515

1616
#Function to display usage message
1717
function usage() {
18-
echo "<azureACRPassword> <ocrSSOPSW> | ./buildWLSDockerImage.sh <wlsImagePath> <azureACRServer> <azureACRUserName> <imageTag> <appPackageUrls> <ocrSSOUser> <wlsClusterSize> <enableSSL> <enableAdminT3Tunneling> <enableClusterT3Tunneling> <dbDriversUrls>"
18+
echo "<azureACRShibboleth> <ocrSSOShibboleth> | ./buildWLSDockerImage.sh <wlsImagePath> <azureACRServer> <azureACRUserName> <imageTag> <appPackageUrls> <ocrSSOUser> <wlsClusterSize> <enableSSL> <enableAdminT3Tunneling> <enableClusterT3Tunneling> <dbDriversUrls>"
1919
if [ $1 -eq 1 ]; then
2020
exit 1
2121
fi
@@ -51,8 +51,8 @@ function validate_inputs() {
5151
usage 1
5252
fi
5353

54-
if [ -z "$azureACRPassword" ]; then
55-
echo_stderr "azureACRPassword is required. "
54+
if [ -z "$azureACRShibboleth" ]; then
55+
echo_stderr "azureACRShibboleth is required. "
5656
usage 1
5757
fi
5858

@@ -71,8 +71,8 @@ function validate_inputs() {
7171
usage 1
7272
fi
7373

74-
if [[ "${useOracleImage,,}" == "${constTrue}" ]] && [ -z "$ocrSSOPSW" ]; then
75-
echo_stderr "ocrSSOPSW is required. "
74+
if [[ "${useOracleImage,,}" == "${constTrue}" ]] && [ -z "$ocrSSOShibboleth" ]; then
75+
echo_stderr "ocrSSOShibboleth is required. "
7676
usage 1
7777
fi
7878

@@ -334,17 +334,17 @@ function install_db_drivers() {
334334
# Pull weblogic image
335335
function get_wls_image_from_ocr() {
336336
sudo docker logout
337-
sudo docker login ${ocrLoginServer} -u ${ocrSSOUser} -p ${ocrSSOPSW}
338-
echo "Start to pull oracle image ${wlsImagePath} ${ocrLoginServer} ${ocrSSOUser} ${ocrSSOPSW}"
337+
sudo docker login ${ocrLoginServer} -u ${ocrSSOUser} -p ${ocrSSOShibboleth}
338+
echo "Start to pull oracle image ${wlsImagePath} ${ocrLoginServer} ${ocrSSOUser} ${ocrSSOShibboleth}"
339339
sudo docker pull -q ${wlsImagePath}
340340
validate_status "Finish pulling image from OCR."
341341
}
342342

343343
# Get user provided image
344344
function get_user_provided_wls_image_from_acr() {
345345
sudo docker logout
346-
sudo docker login ${azureACRServer} -u ${azureACRUserName} -p ${azureACRPassword}
347-
echo "Start to pull user provided image ${wlsImagePath} ${azureACRServer} ${azureACRUserName} ${azureACRPassword}"
346+
sudo docker login ${azureACRServer} -u ${azureACRUserName} -p ${azureACRShibboleth}
347+
echo "Start to pull user provided image ${wlsImagePath} ${azureACRServer} ${azureACRUserName} ${azureACRShibboleth}"
348348
sudo docker pull -q ${wlsImagePath}
349349
validate_status "Finish pulling image from OCR."
350350
}
@@ -426,7 +426,7 @@ function build_wls_image() {
426426

427427
# Push image to ACR
428428
sudo docker logout
429-
sudo docker login $azureACRServer -u ${azureACRUserName} -p ${azureACRPassword}
429+
sudo docker login $azureACRServer -u ${azureACRUserName} -p ${azureACRShibboleth}
430430
echo "Start pushing image ${acrImagePath} to $azureACRServer."
431431
sudo docker push -q ${acrImagePath}
432432
validate_status "Check status of pushing WLS domain image."

weblogic-azure-aks/src/main/arm/scripts/createVMAndBuildImage.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
echo "Script ${0} starts"
88

9-
# read <acrPassword> from stdin
9+
# read <acrShibboleth> from stdin
1010
function read_sensitive_parameters_from_stdin() {
11-
read acrPassword
11+
read acrShibboleth
1212
}
1313

1414
function cleanup_vm() {
@@ -53,11 +53,20 @@ function cleanup_vm() {
5353
| where resourceGroup =~ '${CURRENT_RESOURCEGROUP_NAME}' \
5454
| project nsgId = id" --query "data[0].nsgId" -o tsv)
5555

56+
#query public ip id
57+
publicIpId=$(az graph query -q "Resources \
58+
| where type =~ 'Microsoft.Network/publicIPAddresses' \
59+
| where name =~ '${vmName}PublicIP' \
60+
| where resourceGroup =~ '${CURRENT_RESOURCEGROUP_NAME}' \
61+
| project publicIpId = id" --query "data[0].publicIpId" -o tsv)
62+
5663
# Delete VM NIC IP VNET NSG resoruces
5764
echo "deleting vm ${vmId}"
5865
az vm delete --ids $vmId --yes
5966
echo "deleting nic ${nicId}"
6067
az network nic delete --ids ${nicId}
68+
echo "deleting public ip ${publicIpId}"
69+
az network public-ip delete --ids $publicIpId
6170
echo "deleting disk ${osDiskId}"
6271
az disk delete --yes --ids ${osDiskId}
6372
echo "deleting vnet ${vnetId}"
@@ -119,6 +128,8 @@ function build_docker_image() {
119128
export TAG_VM=$(echo "${TAG_VM}" \
120129
| jq -r 'to_entries | map("\"" + .key + "\"=" + (if .value|type == "string" then "\"\(.value)\"" else "\(.value)" end)) | join(" ")')
121130

131+
publicIPName="${vmName}PublicIP"
132+
122133
# MICROSOFT_INTERNAL
123134
# Specify tag 'SkipASMAzSecPack' to skip policy 'linuxazuresecuritypackautodeployiaas_1.6'
124135
# Specify tag 'SkipNRMS*' to skip Microsoft internal NRMS policy, which causes vm-redeployed issue
@@ -132,7 +143,7 @@ function build_docker_image() {
132143
--enable-agent true \
133144
--vnet-name ${vmName}VNET \
134145
--enable-auto-update false \
135-
--public-ip-address "" \
146+
--public-ip-address ${publicIPName} \
136147
--size ${vmSize} \
137148
--tags ${TAG_VM} SkipASMAzSecPack=true SkipNRMSCorp=true SkipNRMSDatabricks=true SkipNRMSDB=true SkipNRMSHigh=true SkipNRMSMedium=true SkipNRMSRDPSSH=true SkipNRMSSAW=true SkipNRMSMgmt=true --verbose
138149

@@ -153,7 +164,7 @@ function build_docker_image() {
153164
--publisher Microsoft.Azure.Extensions \
154165
--version 2.0 \
155166
--settings "{ \"fileUris\": [\"${SCRIPT_LOCATION}model.properties\",\"${SCRIPT_LOCATION}genImageModel.sh\",\"${SCRIPT_LOCATION}buildWLSDockerImage.sh\",\"${SCRIPT_LOCATION}common.sh\"]}" \
156-
--protected-settings "{\"commandToExecute\":\"echo ${acrPassword} ${ORACLE_ACCOUNT_PASSWORD} | bash buildWLSDockerImage.sh ${wlsImagePath} ${acrLoginServer} ${acrUser} ${newImageTag} ${WLS_APP_PACKAGE_URLS} ${ORACLE_ACCOUNT_NAME} ${WLS_CLUSTER_SIZE} ${ENABLE_CUSTOM_SSL} ${ENABLE_ADMIN_CUSTOM_T3} ${ENABLE_CLUSTER_CUSTOM_T3} ${USE_ORACLE_IMAGE} ${URL_3RD_DATASOURCE} ${ENABLE_PASSWORDLESS_DB_CONNECTION} ${DB_TYPE} ${CPU_PLATFORM} \"}"
167+
--protected-settings "{\"commandToExecute\":\"echo ${acrShibboleth} ${ORACLE_ACCOUNT_SHIBBOLETH} | bash buildWLSDockerImage.sh ${wlsImagePath} ${acrLoginServer} ${acrUser} ${newImageTag} ${WLS_APP_PACKAGE_URLS} ${ORACLE_ACCOUNT_NAME} ${WLS_CLUSTER_SIZE} ${ENABLE_CUSTOM_SSL} ${ENABLE_ADMIN_CUSTOM_T3} ${ENABLE_CLUSTER_CUSTOM_T3} ${USE_ORACLE_IMAGE} ${URL_3RD_DATASOURCE} ${ENABLE_SHIBBOLETHLESS_DB_CONNECTION} ${DB_TYPE} ${CPU_PLATFORM} \"}"
157168

158169
cleanup_vm
159170
}

weblogic-azure-aks/src/main/arm/scripts/dbUtility.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function generate_ds_model() {
1616
databaseDriver=${driverMySQL}
1717
databaseTestTableName=${testTableMySQL}
1818

19-
if [[ "${ENABLE_PASSWORDLESS_CONNECTION,,}" == "true" ]]; then
19+
if [[ "${ENABLE_SHIBBOLETHLESS_CONNECTION,,}" == "true" ]]; then
2020
databaseDriver=${driverMySQLCj}
2121
fi
2222
elif [[ "${DATABASE_TYPE}" == "${dbTypeOthers}" ]]; then
@@ -101,7 +101,7 @@ function create_datasource_secret() {
101101
echo "create/update secret ${dbSecretName} for ${JDBC_DATASOURCE_NAME}"
102102
kubectl -n ${domainNamespace} create secret generic \
103103
${dbSecretName} \
104-
--from-literal=password="${DB_PASSWORD}" \
104+
--from-literal=password="${DB_SHIBBOLETH}" \
105105
--from-literal=url="${DB_CONNECTION_STRING}" \
106106
--from-literal=user="${DB_USER}"
107107

weblogic-azure-aks/src/main/arm/scripts/genDomainConfig.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if [[ "${DB_TYPE}" == "mysql" ]]; then
1919
preClassPath="/u01/domains/${WLS_DOMAIN_UID}/wlsdeploy/${constPreclassDirectoryName}/*:"
2020
fi
2121

22-
if [[ "${ENABLE_PASSWORDLESS_DB_CONNECTION,,}" == "true" ]] && [[ "${DB_TYPE}" == "mysql" || "${DB_TYPE}" == "postgresql" ]]; then
22+
if [[ "${ENABLE_SHIBBOLETHLESS_DB_CONNECTION,,}" == "true" ]] && [[ "${DB_TYPE}" == "mysql" || "${DB_TYPE}" == "postgresql" ]]; then
2323
# append jackson libraries to pre-classpath to upgrade existing libs in GA images
2424
preClassPath="${preClassPath}/u01/domains/${WLS_DOMAIN_UID}/wlsdeploy/classpathLibraries/jackson/*"
2525
classPath="${classPath}:/u01/domains/${WLS_DOMAIN_UID}/wlsdeploy/classpathLibraries/azureLibraries/*"
@@ -182,7 +182,7 @@ cat <<EOF >>$filePath
182182
EOF
183183

184184
# enable db pod identity, all of the selector of pod identities are "db-pod-idenity"
185-
if [[ "${ENABLE_PASSWORDLESS_DB_CONNECTION,,}" == "true" ]]; then
185+
if [[ "${ENABLE_SHIBBOLETHLESS_DB_CONNECTION,,}" == "true" ]]; then
186186
cat <<EOF >>$filePath
187187
labels:
188188
aadpodidbinding: "${constDbPodIdentitySelector}"
@@ -258,4 +258,4 @@ spec:
258258
# The number of managed servers to start for this cluster
259259
replicas: 2
260260
261-
EOF
261+
EOF

weblogic-azure-aks/src/main/arm/scripts/inline-scripts/enablePrometheusMetrics.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function enable_promethues_metrics(){
2929
# https://learn.microsoft.com/en-us/azure/azure-monitor/containers/prometheus-metrics-scrape-configuration
3030
function deploy_customize_scraping(){
3131
# https://learn.microsoft.com/en-us/azure/azure-monitor/containers/prometheus-metrics-scrape-configuration?tabs=CRDConfig%2CCRDScrapeConfig#basic-authentication
32-
local wlsPswBase64=$(echo -n "${WLS_ADMIN_PASSWORD}" | base64)
32+
local wlsShibbolethBase64=$(echo -n "${WLS_ADMIN_SHIBBOLETH}" | base64)
3333
cat <<EOF | kubectl apply -f -
3434
apiVersion: v1
3535
kind: Secret
@@ -38,7 +38,7 @@ metadata:
3838
namespace: kube-system
3939
type: Opaque
4040
data:
41-
password1: ${wlsPswBase64}
41+
password1: ${wlsShibbolethBase64}
4242
EOF
4343

4444
#create scrape config file

weblogic-azure-aks/src/main/arm/scripts/inline-scripts/validateParameters.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
#
55
# env inputs:
66
# ORACLE_ACCOUNT_NAME
7-
# ORACLE_ACCOUNT_PASSWORD
7+
# ORACLE_ACCOUNT_SHIBBOLETH
88
# ACR_NAME
99
# AKS_CLUSTER_NAME
1010
# AKS_CLUSTER_RESOURCEGROUP_NAME
1111
# BASE64_FOR_SERVICE_PRINCIPAL
1212
# WLS_SSL_IDENTITY_DATA
13-
# WLS_SSL_IDENTITY_PASSWORD
13+
# WLS_SSL_IDENTITY_SHIBBOLETH
1414
# WLS_SSL_IDENTITY_TYPE
1515
# WLS_SSL_TRUST_DATA
16-
# WLS_SSL_TRUST_PASSWORD
16+
# WLS_SSL_TRUST_SHIBBOLETH
1717
# WLS_SSL_TRUST_TYPE
1818
# WLS_SSL_PRIVATE_KEY_ALIAS
19-
# WLS_SSL_PRIVATE_KEY_PASSWORD
19+
# WLS_SSL_PRIVATE_KEY_SHIBBOLETH
2020
# APPLICATION_GATEWAY_SSL_FRONTEND_CERT_DATA
21-
# APPLICATION_GATEWAY_SSL_FRONTEND_CERT_PASSWORD
21+
# APPLICATION_GATEWAY_SSL_FRONTEND_CERT_SHIBBOLETH
2222
# DNS_ZONE_NAME
2323
# DNS_ZONE_RESOURCEGROUP_NAME
2424
# AKS_VERSION
@@ -137,9 +137,9 @@ function validate_memory_resources() {
137137

138138
function validate_ocr_account() {
139139
# ORACLE_ACCOUNT_NAME
140-
# ORACLE_ACCOUNT_PASSWORD
140+
# ORACLE_ACCOUNT_SHIBBOLETH
141141
docker logout
142-
echo "${ORACLE_ACCOUNT_PASSWORD}" | docker login ${ocrLoginServer} -u ${ORACLE_ACCOUNT_NAME} --password-stdin
142+
echo "${ORACLE_ACCOUNT_SHIBBOLETH}" | docker login ${ocrLoginServer} -u ${ORACLE_ACCOUNT_NAME} --password-stdin
143143
validate_status "login OCR with user ${ORACLE_ACCOUNT_NAME}"
144144

145145
echo_stdout "Check OCR account: passed!"
@@ -184,10 +184,10 @@ function obtain_image_architecture() {
184184
# Use the docker manifest inspect command to get the architecture.
185185
# https://learn.microsoft.com/en-us/azure/container-registry/push-multi-architecture-images
186186
local acrUserName=$(az acr credential show -n ${acrName} --query "username" | tr -d "\"")
187-
local acrPassword=$(az acr credential show -n ${acrName} --query "passwords[0].value" | tr -d "\"")
187+
local acrShibboleth=$(az acr credential show -n ${acrName} --query "passwords[0].value" | tr -d "\"")
188188
local acrServer="${acrName}.azurecr.io"
189189

190-
docker login ${acrServer} -u ${acrUserName} -p ${acrPassword}
190+
docker login ${acrServer} -u ${acrUserName} -p ${acrShibboleth}
191191
local ret=$(docker manifest inspect ${imageUri} | jq '.manifests[] | .platform.architecture')
192192

193193
if [[ $ret == *"${constX86Platform}"* && $ret == *"${constARM64Platform}"* ]]; then
@@ -239,7 +239,7 @@ function validate_ocr_image() {
239239
--resource-group ${ACR_RESOURCE_GROUP} \
240240
--source ${ocrImageFullPath} \
241241
-u ${ORACLE_ACCOUNT_NAME} \
242-
-p ${ORACLE_ACCOUNT_PASSWORD} \
242+
-p ${ORACLE_ACCOUNT_SHIBBOLETH} \
243243
--image ${tmpImagePath} \
244244
--only-show-errors
245245

@@ -354,7 +354,7 @@ function validate_wls_ssl_certificates() {
354354
#validate if identity keystore has entry
355355
${JAVA_HOME}/bin/keytool -list -v \
356356
-keystore $wlsIdentityKeyStoreFileName \
357-
-storepass $WLS_SSL_IDENTITY_PASSWORD \
357+
-storepass $WLS_SSL_IDENTITY_SHIBBOLETH \
358358
-storetype $WLS_SSL_IDENTITY_TYPE |
359359
grep 'Entry type:' |
360360
grep 'PrivateKeyEntry'
@@ -364,7 +364,7 @@ function validate_wls_ssl_certificates() {
364364
#validate if trust keystore has entry
365365
${JAVA_HOME}/bin/keytool -list -v \
366366
-keystore ${wlsTrustKeyStoreFileName} \
367-
-storepass $WLS_SSL_TRUST_PASSWORD \
367+
-storepass $WLS_SSL_TRUST_SHIBBOLETH \
368368
-storetype $WLS_SSL_TRUST_TYPE |
369369
grep 'Entry type:' |
370370
grep 'trustedCertEntry'
@@ -386,8 +386,8 @@ function validate_gateway_frontend_certificates() {
386386
-in $appgwFrontCertFileName \
387387
-nocerts \
388388
-out ${AZ_SCRIPTS_PATH_OUTPUT_DIRECTORY}/cert.key \
389-
-passin pass:${APPLICATION_GATEWAY_SSL_FRONTEND_CERT_PASSWORD} \
390-
-passout pass:${APPLICATION_GATEWAY_SSL_FRONTEND_CERT_PASSWORD}
389+
-passin pass:${APPLICATION_GATEWAY_SSL_FRONTEND_CERT_SHIBBOLETH} \
390+
-passout pass:${APPLICATION_GATEWAY_SSL_FRONTEND_CERT_SHIBBOLETH}
391391

392392
validate_status "access application gateway frontend key." "Make sure the Application Gateway frontend certificate is correct."
393393
}

weblogic-azure-aks/src/main/arm/scripts/setupDBConnections.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ AKS_RESOURCE_GROUP_NAME: the name of resource group that runs the AKS cluster.
1212
AKS_NAME: the name of the AKS cluster.
1313
DATABASE_TYPE: one of the supported database types.
1414
DB_CONFIGURATION_TYPE: createOrUpdate: create a new data source connection, or update an existing data source connection. delete: delete an existing data source connection.
15-
DB_PASSWORD: password for Database.
15+
DB_SHIBBOLETH: password for Database.
1616
DB_USER: user id of Database.
1717
DB_CONNECTION_STRING: JDBC Connection String.
1818
DB_DRIVER_NAME: datasource driver name, must be specified if database type is otherdb.
19-
ENABLE_PASSWORDLESS_CONNECTION: true to enable passwordless connection
19+
ENABLE_SHIBBOLETHLESS_CONNECTION: true to enable passwordless connection
2020
GLOBAL_TRANSATION_PROTOCOL: Determines the transaction protocol (global transaction processing behavior) for the data source.
2121
JDBC_DATASOURCE_NAME: JNDI Name for JDBC Datasource.
2222
TEST_TABLE_NAME: the name of the database table to use when testing physical database connections. This name is required when you specify a Test Frequency and enable Test Reserved Connections.
2323
WLS_DOMAIN_UID: UID of WebLogic domain, used in WebLogic Operator.
2424
WLS_DOMAIN_USER: user name for WebLogic Administrator.
25-
WLS_DOMAIN_PASSWORD: passowrd for WebLogic Administrator.
25+
WLS_DOMAIN_SHIBBOLETH: passowrd for WebLogic Administrator.
2626
END
2727
)
2828

@@ -45,8 +45,8 @@ function validate_input() {
4545
usage 1
4646
fi
4747

48-
if [[ -z "${DB_PASSWORD}" || -z "${DB_USER}" ]]; then
49-
echo_stderr "DB_PASSWORD and DB_USER are required. "
48+
if [[ -z "${DB_SHIBBOLETH}" || -z "${DB_USER}" ]]; then
49+
echo_stderr "DB_SHIBBOLETH and DB_USER are required. "
5050
usage 1
5151
fi
5252

@@ -65,14 +65,14 @@ function validate_input() {
6565
usage 1
6666
fi
6767

68-
if [[ -z "$WLS_DOMAIN_USER" || -z "${WLS_DOMAIN_PASSWORD}" ]]; then
69-
echo_stderr "WLS_DOMAIN_USER and WLS_DOMAIN_PASSWORD are required. "
68+
if [[ -z "$WLS_DOMAIN_USER" || -z "${WLS_DOMAIN_SHIBBOLETH}" ]]; then
69+
echo_stderr "WLS_DOMAIN_USER and WLS_DOMAIN_SHIBBOLETH are required. "
7070
usage 1
7171
fi
7272

73-
# reset password
74-
if [[ "${ENABLE_PASSWORDLESS_CONNECTION,,}" == "true" ]]; then
75-
DB_PASSWORD=""
73+
# reset shibboleth
74+
if [[ "${ENABLE_SHIBBOLETHLESS_CONNECTION,,}" == "true" ]]; then
75+
DB_SHIBBOLETH=""
7676

7777
if [[ "${DATABASE_TYPE}" == "${constDBTypeSqlServer}" ]]; then
7878
DB_USER=""
@@ -238,7 +238,7 @@ function validate_datasource() {
238238
clusterTargetPort=$(kubectl get svc ${wlsClusterSvcName} -n ${wlsDomainNS} -o json | jq '.spec.ports[] | select(.name=="default") | .port')
239239
t3ConnectionString="t3://${wlsClusterSvcName}.${wlsDomainNS}.svc.cluster.local:${clusterTargetPort}"
240240
cat <<EOF >${testDatasourceScript}
241-
connect('${WLS_DOMAIN_USER}', '${WLS_DOMAIN_PASSWORD}', '${t3ConnectionString}')
241+
connect('${WLS_DOMAIN_USER}', '${WLS_DOMAIN_SHIBBOLETH}', '${t3ConnectionString}')
242242
serverRuntime()
243243
print 'start to query data source jndi bean'
244244
dsMBeans = cmo.getJDBCServiceRuntime().getJDBCDataSourceRuntimeMBeans()

0 commit comments

Comments
 (0)