Skip to content

Commit 6156398

Browse files
authored
Merge pull request #359 from gnsuryan/main
Changes related to default outbound access and azure security fixes for admin offer
2 parents ca33c9b + 40a3ba2 commit 6156398

13 files changed

+416
-39
lines changed

weblogic-azure-vm/arm-oraclelinux-wls-admin/admin-ssl-post-deploy/src/main/scripts/configureCustomAdminSSL.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ function validateInput()
4848
echo_stderr "wlsDomainName is required. "
4949
fi
5050

51-
if [[ -z "$wlsUserName" || -z "$wlsPassword" ]]
51+
if [[ -z "$wlsUserName" || -z "$wlsShibboleth" ]]
5252
then
53-
echo_stderr "wlsUserName or wlsPassword is required. "
53+
echo_stderr "wlsUserName or wlsShibboleth is required. "
5454
exit 1
5555
fi
5656

@@ -107,7 +107,7 @@ function configureSSL()
107107
108108
isCustomSSLEnabled='${isCustomSSLEnabled}'
109109
110-
connect('$wlsUserName','$wlsPassword','t3://$wlsAdminURL')
110+
connect('$wlsUserName','$wlsShibboleth','t3://$wlsAdminURL')
111111
edit("$wlsServerName")
112112
startEdit()
113113
cd('/Servers/$wlsServerName')
@@ -291,7 +291,7 @@ args=("$@")
291291
ELEMENTS=${#args[@]}
292292

293293
#read arguments from stdin
294-
read adminVMName wlsDomainName wlsUserName wlsPassword oracleHome wlsDomainPath enableAAD wlsADSSLCer isCustomSSLEnabled customIdentityKeyStoreBase64String customIdentityKeyStorePassPhrase customIdentityKeyStoreType customTrustKeyStoreBase64String customTrustKeyStorePassPhrase customTrustKeyStoreType privateKeyAlias privateKeyPassPhrase
294+
read adminVMName wlsDomainName wlsUserName wlsShibboleth oracleHome wlsDomainPath enableAAD wlsADSSLCer isCustomSSLEnabled customIdentityKeyStoreBase64String customIdentityKeyStorePassPhrase customIdentityKeyStoreType customTrustKeyStoreBase64String customTrustKeyStorePassPhrase customTrustKeyStoreType privateKeyAlias privateKeyPassPhrase
295295

296296

297297
enableAAD="${enableAAD,,}"

weblogic-azure-vm/arm-oraclelinux-wls-admin/src/main/arm/mainTemplate.json

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@
177177
"type": "string",
178178
"defaultValue": "[newGuid()]"
179179
},
180+
"guidTag": {
181+
"type": "string",
182+
"defaultValue": "[newGuid()]"
183+
},
180184
"location": {
181185
"type": "string",
182186
"defaultValue": "[resourceGroup().location]",
@@ -368,12 +372,16 @@
368372
},
369373
"variables": {
370374
"const_globalResourceNameSuffix": "[uniqueString(parameters('guidValue'))]",
375+
"const_guidTag": "[uniqueString(parameters('guidTag'))]",
371376
"name_adminCustomSSLLinkedTemplateName": "adminTemplateForCustomSSL.json",
372377
"name_adminLinkedTemplateDeployment": "[concat('admin',if(parameters('enableCustomSSL'),'CustomSSL',''),'LinkedTemplate')]",
378+
"name_uamiForPostDeploymentScript" : "uamiForPostDeploymentScript",
373379
"name_adminLinkedTemplateName": "adminTemplate.json",
374380
"name_adminVM": "[concat(parameters('adminVMName'), variables('const_globalResourceNameSuffix'))]",
375381
"name_dbLinkedTemplate": "dbTemplate.json",
376382
"name_dnszonesLinkedTemplateName": "dnszonesTemplate.json",
383+
"name_postDeploymentUAMIRolesTemplate" : "postDeploymentUAMIRolesTemplate.json",
384+
"name_postDeploymentTemplate": "postDeploymentTemplate.json",
377385
"name_networkSecurityGroup": "[concat(parameters('dnsLabelPrefix'), '-nsg', variables('const_globalResourceNameSuffix'))]",
378386
"name_nsgLinkedTemplateName": "nsgNestedTemplate.json",
379387
// If adding a new resource, add the resource identifier to the array below
@@ -456,6 +464,9 @@
456464
"_globalResourceNameSuffix": {
457465
"value": "[variables('const_globalResourceNameSuffix')]"
458466
},
467+
"const_guidTag":{
468+
"value": "[variables('const_guidTag')]"
469+
},
459470
"adminPasswordOrKey": {
460471
"value": "[parameters('adminPasswordOrKey')]"
461472
},
@@ -556,6 +567,9 @@
556567
"_globalResourceNameSuffix": {
557568
"value": "[variables('const_globalResourceNameSuffix')]"
558569
},
570+
"const_guidTag":{
571+
"value": "[variables('const_guidTag')]"
572+
},
559573
"adminPasswordOrKey": {
560574
"value": "[parameters('adminPasswordOrKey')]"
561575
},
@@ -807,18 +821,95 @@
807821

808822
}
809823
}
810-
},
824+
},
811825
{
812826
"type": "Microsoft.Resources/deployments",
813827
"apiVersion": "${azure.apiVersionForDeployment}",
828+
"name": "[variables('name_uamiForPostDeploymentScript')]",
829+
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'existing')]",
814830
"tags": "[variables('obj_tagsByResources')['${identifier.resourcesDeployment}']]",
815-
"name": "${admin.end}",
816831
"dependsOn": [
817832
"[resourceId('Microsoft.Resources/deployments', variables('name_adminLinkedTemplateDeployment'))]",
818833
"[resourceId('Microsoft.Resources/deployments', 'networkSecurityLinkedTemplate')]",
819834
"[resourceId('Microsoft.Resources/deployments', 'dnszonesLinkedTemplate')]",
820835
"[resourceId('Microsoft.Resources/deployments', 'dbLinkedTemplate')]"
821836
],
837+
"properties": {
838+
"mode": "Incremental",
839+
"templateLink": {
840+
"uri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/', variables('name_postDeploymentUAMIRolesTemplate')))]",
841+
"contentVersion": "1.0.0.0"
842+
},
843+
"parameters": {
844+
"location": {
845+
"value": "[parameters('location')]"
846+
},
847+
"_globalResourceNameSuffix": {
848+
"value": "[variables('const_globalResourceNameSuffix')]"
849+
},
850+
"tagsByResource": {
851+
"value": "[variables('obj_tagsByResources')]"
852+
}
853+
}
854+
}
855+
},
856+
{
857+
"type": "Microsoft.Resources/deployments",
858+
"apiVersion": "${azure.apiVersionForDeployment}",
859+
"name": "postDeplyment",
860+
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'existing')]",
861+
"tags": "[variables('obj_tagsByResources')['${identifier.resourcesDeployment}']]",
862+
"dependsOn": [
863+
"[resourceId('Microsoft.Resources/deployments', variables('name_adminLinkedTemplateDeployment'))]",
864+
"[resourceId('Microsoft.Resources/deployments', 'networkSecurityLinkedTemplate')]",
865+
"[resourceId('Microsoft.Resources/deployments', 'dnszonesLinkedTemplate')]",
866+
"[resourceId('Microsoft.Resources/deployments', 'dbLinkedTemplate')]",
867+
"[resourceId('Microsoft.Resources/deployments', variables('name_uamiForPostDeploymentScript'))]"
868+
],
869+
"properties": {
870+
"mode": "Incremental",
871+
"templateLink": {
872+
"uri": "[uri(parameters('_artifactsLocation'), concat('nestedtemplates/', variables('name_postDeploymentTemplate')))]",
873+
"contentVersion": "1.0.0.0"
874+
},
875+
"parameters": {
876+
"location": {
877+
"value": "[parameters('location')]"
878+
},
879+
"_globalResourceNameSuffix": {
880+
"value": "[variables('const_globalResourceNameSuffix')]"
881+
},
882+
"tagsByResource": {
883+
"value": "[variables('obj_tagsByResources')]"
884+
},
885+
"const_guidTag":{
886+
"value": "[variables('const_guidTag')]"
887+
},
888+
"_artifactsLocation": {
889+
"value": "[parameters('_artifactsLocation')]"
890+
},
891+
"_artifactsLocationSasToken": {
892+
"value": "[parameters('_artifactsLocationSasToken')]"
893+
},
894+
"userAssignedIdentityResourceId":{
895+
"value": "[reference(variables('name_uamiForPostDeploymentScript'),'${azure.apiVersionForDeployment}').outputs.uamidForPostDeployment.value]"
896+
}
897+
}
898+
}
899+
},
900+
{
901+
"type": "Microsoft.Resources/deployments",
902+
"apiVersion": "${azure.apiVersionForDeployment}",
903+
"tags": "[variables('obj_tagsByResources')['${identifier.resourcesDeployment}']]",
904+
"name": "${admin.end}",
905+
"dependsOn": [
906+
"[resourceId('Microsoft.Resources/deployments', variables('name_adminLinkedTemplateDeployment'))]",
907+
"[resourceId('Microsoft.Resources/deployments', 'networkSecurityLinkedTemplate')]",
908+
"[resourceId('Microsoft.Resources/deployments', 'dnszonesLinkedTemplate')]",
909+
"[resourceId('Microsoft.Resources/deployments', 'dbLinkedTemplate')]",
910+
"[resourceId('Microsoft.Resources/deployments', variables('name_uamiForPostDeploymentScript'))]",
911+
"[resourceId('Microsoft.Resources/deployments', 'postDeplyment')]"
912+
],
822913
"properties": {
823914
"mode": "Incremental",
824915
"template": {

weblogic-azure-vm/arm-oraclelinux-wls-admin/src/main/arm/nestedtemplates/adminTemplate.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@
2626
"metadata": {
2727
"description": "A unique suffix that was specified during the deployment of the solution template."
2828
}
29+
},
30+
"const_guidTag" :{
31+
"type": "string",
32+
"metadata": {
33+
"description": "A unique tag for resources."
34+
}
2935
},
3036
"adminPasswordOrKey": {
3137
"type": "securestring",
@@ -406,8 +412,7 @@
406412
{
407413
"apiVersion": "${azure.apiVersionForPublicIPAddresses}",
408414
"type": "Microsoft.Network/publicIPAddresses",
409-
"tags": "[parameters('tagsByResource')['${identifier.publicIPAddresses}']]",
410-
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'new')]",
415+
"tags": "[if(equals(parameters('virtualNetworkNewOrExisting'), 'new'),parameters('tagsByResource')['${identifier.publicIPAddresses}'],if(empty(parameters('tagsByResource')['${identifier.publicIPAddresses}']),createObject(parameters('const_guidTag'),''),union(parameters('tagsByResource')['${identifier.publicIPAddresses}'],createObject(parameters('const_guidTag'),''))))]",
411416
"name": "[variables('name_publicIPAddress')]",
412417
"location": "[parameters('location')]",
413418
"properties": {
@@ -482,12 +487,19 @@
482487
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'existing')]",
483488
"name": "[variables('name_nic_without_pub_ip')]",
484489
"location": "[parameters('location')]",
490+
"dependsOn": [
491+
"[resourceId('Microsoft.Network/publicIPAddresses/', variables('name_publicIPAddress'))]",
492+
"[resourceId('Microsoft.Network/virtualNetworks/', variables('name_virtualNetwork'))]"
493+
],
485494
"properties": {
486495
"ipConfigurations": [
487496
{
488497
"name": "ipconfig1",
489498
"properties": {
490499
"privateIPAllocationMethod": "Dynamic",
500+
"publicIPAddress": {
501+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('name_publicIPAddress'))]"
502+
},
491503
"subnet": {
492504
"id": "[variables('ref_subnet')]"
493505
}

weblogic-azure-vm/arm-oraclelinux-wls-admin/src/main/arm/nestedtemplates/adminTemplateForCustomSSL.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"description": "A unique suffix that was specified during the deployment of the solution template."
2828
}
2929
},
30+
"const_guidTag" :{
31+
"type": "string",
32+
"metadata": {
33+
"description": "A unique tag for resources."
34+
}
35+
},
3036
"adminPasswordOrKey": {
3137
"type": "securestring",
3238
"metadata": {
@@ -478,8 +484,7 @@
478484
{
479485
"apiVersion": "${azure.apiVersionForPublicIPAddresses}",
480486
"type": "Microsoft.Network/publicIPAddresses",
481-
"tags": "[parameters('tagsByResource')['${identifier.publicIPAddresses}']]",
482-
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'new')]",
487+
"tags": "[if(equals(parameters('virtualNetworkNewOrExisting'), 'new'),parameters('tagsByResource')['${identifier.publicIPAddresses}'],if(empty(parameters('tagsByResource')['${identifier.publicIPAddresses}']),createObject(parameters('const_guidTag'),''),union(parameters('tagsByResource')['${identifier.publicIPAddresses}'],createObject(parameters('const_guidTag'),''))))]",
483488
"name": "[variables('name_publicIPAddress')]",
484489
"location": "[parameters('location')]",
485490
"properties": {
@@ -488,7 +493,7 @@
488493
"domainNameLabel": "[concat(toLower(parameters('dnsLabelPrefix')),'-',take(replace(parameters('guidValue'), '-', ''), 10),'-',toLower(parameters('wlsDomainName')))]"
489494
}
490495
}
491-
},
496+
},
492497
{
493498
"apiVersion": "${azure.apiVersionForVirtualNetworks}",
494499
"type": "Microsoft.Network/virtualNetworks",
@@ -554,12 +559,19 @@
554559
"condition": "[equals(parameters('virtualNetworkNewOrExisting'), 'existing')]",
555560
"name": "[variables('name_nic_without_pub_ip')]",
556561
"location": "[parameters('location')]",
562+
"dependsOn": [
563+
"[resourceId('Microsoft.Network/publicIPAddresses/', variables('name_publicIPAddress'))]",
564+
"[resourceId('Microsoft.Network/virtualNetworks/', variables('name_virtualNetwork'))]"
565+
],
557566
"properties": {
558567
"ipConfigurations": [
559568
{
560569
"name": "ipconfig1",
561570
"properties": {
562571
"privateIPAllocationMethod": "Dynamic",
572+
"publicIPAddress": {
573+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('name_publicIPAddress'))]"
574+
},
563575
"subnet": {
564576
"id": "[variables('ref_subnet')]"
565577
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"location": {
6+
"type": "string",
7+
"metadata": {
8+
"description": "Location for all resources."
9+
}
10+
},
11+
"_globalResourceNameSuffix": {
12+
"type": "string",
13+
"metadata": {
14+
"description": "A unique suffix that was specified during the deployment of the solution template."
15+
}
16+
},
17+
"tagsByResource": {
18+
"type": "object",
19+
"defaultValue": {},
20+
"metadata": {
21+
"description": "${label.tagsLabel}"
22+
}
23+
},
24+
"const_guidTag" :{
25+
"type": "string",
26+
"metadata": {
27+
"description": "A unique tag for resources."
28+
}
29+
},
30+
"_artifactsLocation": {
31+
"type": "string",
32+
"metadata": {
33+
"description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated."
34+
}
35+
},
36+
"_artifactsLocationAdminTemplate": {
37+
"defaultValue": "[if(contains(parameters('_artifactsLocation'), 'githubusercontent'), parameters('_artifactsLocation'), deployment().properties.templateLink.uri)]",
38+
"type": "string",
39+
"metadata": {
40+
"description": "If we are deploying from the command line, use the passed in _artifactsLocation, otherwise use the default."
41+
}
42+
},
43+
"_artifactsLocationSasToken": {
44+
"type": "securestring",
45+
"metadata": {
46+
"description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated. Use the defaultValue if the staging location is not secured."
47+
}
48+
},
49+
"userAssignedIdentityResourceId":{
50+
"type": "string",
51+
"metadata": {
52+
"Description": "UserAssigned Identity"
53+
}
54+
},
55+
"utcValue": {
56+
"type": "string",
57+
"defaultValue": "[utcNow()]"
58+
}
59+
},
60+
"variables": {
61+
"name_postDeploymentscriptFile": "postDeploymentScript.sh"
62+
},
63+
"resources": [
64+
{
65+
"type": "Microsoft.Resources/deploymentScripts",
66+
"apiVersion": "${azure.apiVersionForDeploymentScript}",
67+
"tags": "[parameters('tagsByResource')['${identifier.deploymentScripts}']]",
68+
"name": "[concat('postdeployscript-', parameters('_globalResourceNameSuffix'))]",
69+
"kind": "AzureCLI",
70+
"location": "[parameters('location')]",
71+
"identity": {
72+
"type": "UserAssigned",
73+
"userAssignedIdentities": {
74+
"[parameters('userAssignedIdentityResourceId')]": {}
75+
}
76+
},
77+
"properties": {
78+
"forceUpdateTag": "[parameters('utcValue')]",
79+
"azCliVersion": "2.9.1",
80+
"timeout": "PT30M",
81+
"cleanupPreference": "OnSuccess",
82+
"retentionInterval": "P1D",
83+
"primaryScriptUri": "[uri(parameters('_artifactsLocationAdminTemplate'), concat('../scripts/', variables('name_postDeploymentscriptFile'), parameters('_artifactsLocationSasToken')))]",
84+
"environmentVariables": [
85+
{
86+
"name": "MANAGED_IDENTITY_ID",
87+
"value": "[parameters('userAssignedIdentityResourceId')]"
88+
},
89+
{
90+
"name": "RESOURCE_GROUP_NAME",
91+
"value": "[resourceGroup().name]"
92+
},
93+
{
94+
"name": "GUID_TAG",
95+
"value": "[parameters('const_guidTag')]"
96+
}
97+
]
98+
}
99+
}
100+
],
101+
"outputs": {
102+
"userAssignedIdentityResource": {
103+
"type": "string",
104+
"value": "[parameters('userAssignedIdentityResourceId')]"
105+
}
106+
}
107+
}

0 commit comments

Comments
 (0)