Skip to content

Commit 8a3badc

Browse files
committed
Merge branch 'wktui-445' into 'main'
Adding discovery support for new WDT discover security features See merge request weblogic-cloud/weblogic-toolkit-ui!299
2 parents 7e5e445 + 987141b commit 8a3badc

13 files changed

+516
-89
lines changed

electron/app/js/wdtDiscovery.js

+43-20
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ async function _runDiscover(targetWindow, discoverConfig, online) {
4949
const discoverType = online ? 'online' : 'offline';
5050
logger.info(`start ${discoverType} discover: ${discoverConfig['oracleHome']}`);
5151

52+
let isRemote = false;
5253
let projectFile = discoverConfig['projectFile'];
5354
let projectDir = path.dirname(projectFile);
5455

@@ -66,46 +67,68 @@ async function _runDiscover(targetWindow, discoverConfig, online) {
6667
argList.push('-java_home');
6768
argList.push(discoverConfig['javaHome']);
6869

69-
addArgumentIfPresent(discoverConfig['domainHome'], '-domain_home', argList);
70-
7170
argList.push('-domain_type');
7271
argList.push(discoverConfig['domainType']);
7372

73+
argList.push('-model_file');
74+
argList.push(modelFile);
75+
argList.push('-variable_file');
76+
argList.push(propertiesFile);
77+
7478
if (online) {
7579
argList.push('-admin_url');
7680
argList.push(discoverConfig['adminUrl']);
7781
argList.push('-admin_user');
7882
argList.push(discoverConfig['adminUser']);
7983
argList.push('-admin_pass');
8084
argList.push(discoverConfig['adminPass']);
81-
}
8285

83-
addArgumentIfPresent(discoverConfig['sshHost'], '-ssh_host', argList);
84-
addArgumentIfPresent(discoverConfig['sshPort'], '-ssh_port', argList);
85-
addArgumentIfPresent(discoverConfig['sshUser'], '-ssh_user', argList);
86-
addArgumentIfPresent(discoverConfig['sshPassword'], '-ssh_pass', argList);
87-
addArgumentIfPresent(discoverConfig['sshPrivateKey'], '-ssh_private_key', argList);
88-
addArgumentIfPresent(discoverConfig['sshPrivateKeyPassphrase'], '-ssh_private_key_pass', argList);
86+
addArgumentIfPresent(discoverConfig['sshHost'], '-ssh_host', argList);
87+
addArgumentIfPresent(discoverConfig['sshPort'], '-ssh_port', argList);
88+
addArgumentIfPresent(discoverConfig['sshUser'], '-ssh_user', argList);
89+
addArgumentIfPresent(discoverConfig['sshPassword'], '-ssh_pass', argList);
90+
addArgumentIfPresent(discoverConfig['sshPrivateKey'], '-ssh_private_key', argList);
91+
addArgumentIfPresent(discoverConfig['sshPrivateKeyPassphrase'], '-ssh_private_key_pass', argList);
92+
93+
const useRemote = discoverConfig['isRemote'];
94+
if (!useRemote) {
95+
argList.push('-archive_file');
96+
argList.push(archiveFile);
97+
} else {
98+
isRemote = true;
99+
argList.push('-remote');
100+
}
101+
102+
if (discoverConfig['discoverPasswords']) {
103+
argList.push('-discover_passwords');
104+
}
105+
if (discoverConfig['discoverSecurityProviderData'] && discoverConfig['discoverSecurityProviderDataArgument']) {
106+
argList.push('-discover_security_provider_data');
107+
argList.push(discoverConfig['discoverSecurityProviderDataArgument']);
108+
}
109+
if (discoverConfig['discoverOPSSWallet'] && discoverConfig['discoverOPSSWalletPassphrase']) {
110+
argList.push('-discover_opss_wallet');
111+
argList.push('-opss_wallet_passphrase');
112+
argList.push(discoverConfig['discoverOPSSWalletPassphrase']);
113+
}
114+
addArgumentIfPresent(discoverConfig['discoverWdtPassphrase'], '-passphrase', argList);
115+
} else {
116+
// offline
117+
addArgumentIfPresent(discoverConfig['domainHome'], '-domain_home', argList);
89118

90-
const isRemote = discoverConfig['isRemote'];
91-
if (!isRemote) {
92119
argList.push('-archive_file');
93120
argList.push(archiveFile);
94121
}
95122

96-
argList.push('-model_file');
97-
argList.push(modelFile);
98-
argList.push('-variable_file');
99-
argList.push(propertiesFile);
100-
101-
if (isRemote) {
102-
argList.push('-remote');
103-
}
104-
105123
const env = {
106124
JAVA_HOME: process.env.JAVA_HOME || discoverConfig['javaHome']
107125
};
108126

127+
const additionalProperties = discoverConfig['additionalProperties'];
128+
if (additionalProperties && additionalProperties.length > 0) {
129+
env['WLSDEPLOY_PROPERTIES'] = additionalProperties;
130+
}
131+
109132
let resultsDirectory = null;
110133
let resultsFile = null;
111134
if (isRemote) {

electron/app/locales/en/webui.json

+26-1
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,12 @@
10971097
"discover-dialog-domain-type-label": "Domain Type",
10981098
"discover-dialog-wls-domain-type-label": "WebLogic Server",
10991099
"discover-dialog-restricted-jrf-domain-type-label": "Restricted JRF",
1100-
"discover-dialog-jrf-domain-type-label": "Fusion Middleware (JRF)",
1100+
"discover-dialog-jrf-domain-type-label": "Fusion Middleware Infrastructure (JRF)",
1101+
"discover-dialog-oam-domain-type-label": "Oracle Access Manager (OAM)",
1102+
"discover-dialog-oig-domain-type-label": "Oracle Identity Governance (OIG)",
11011103
"discover-dialog-domain-type-help": "Specifies the type of Oracle Fusion Middleware domain to be discovered.",
1104+
"discover-dialog-additional-properties-label": "Additional Properties",
1105+
"discover-dialog-additional-properties-help": "Additional Properties to pass to the WebLogic Deploy Tooling's Discover Domain Tool.",
11021106
"discover-dialog-admin-url-label": "Administration Server URL",
11031107
"discover-dialog-admin-url-help": "The URL of the Administration Server of the domain. Format should be similar to t3://wls.host:7001",
11041108
"discover-dialog-admin-user-label": "Administration Server User",
@@ -1133,6 +1137,23 @@
11331137
"discover-dialog-ssh-credential-type-password-label": "Use password",
11341138
"discover-dialog-ssh-credential-type-label": "SSH Credential Type",
11351139
"discover-dialog-ssh-credential-type-help": "Choose an option for specifying SSH credentials",
1140+
"discover-dialog-discover-security-features-title": "Security-Related Discovery Features",
1141+
"discover-dialog-discover-passwords-label": "Discover Passwords",
1142+
"discover-dialog-discover-passwords-help": "Discover passwords from the source domain and encrypt them using WDT encryption.",
1143+
"discover-dialog-discover-security-provider-data-label": "Discover Security Provider Data",
1144+
"discover-dialog-discover-security-provider-data-help": "Discover security provider data from the source domain and encrypt any passwords found using WDT encryption.",
1145+
"discover-dialog-discover-opss-wallet-label": "Discover OPSS Wallet",
1146+
"discover-dialog-discover-opss-wallet-help": "Discover OPSS encryption key from the source domain and encrypt it with the OPSS Wallet Passphrase.",
1147+
"discover-dialog-discover-opss-wallet-passphrase-label": "OPSS Wallet Passphrase",
1148+
"discover-dialog-discover-opss-wallet-passphrase-help": "The wallet passphrase to use when exporting the OPSS encryption key into a wallet.",
1149+
"discover-dialog-security-provider-type-all-label": "All Supported Providers",
1150+
"discover-dialog-security-provider-type-default-authenticator-label": "Default Authenticator",
1151+
"discover-dialog-security-provider-type-xacml-authorizer-label": "XACML Authorizer",
1152+
"discover-dialog-security-provider-type-xacml-role-mapper-label": "XACML Role Mapper",
1153+
"discover-dialog-security-provider-type-default-credential-mapper-label": "Default Credential Mapper",
1154+
"discover-dialog-security-provider-scope-label": "Providers to Discover",
1155+
"discover-dialog-discover-wdt-encryption-passphrase-label": "WDT Model Encryption Passphrase",
1156+
"discover-dialog-discover-wdt-encryption-passphrase-help": "The WDT model encryption passphrase that will be used to encrypt any discovered credentials.",
11361157

11371158
"discover-result-dialog-title": "Discover Domain Result",
11381159
"discover-result-dialog-archive-message": "The following files need to be collected from the remote system and placed in the archive file at the specified paths",
@@ -1494,6 +1515,8 @@
14941515
"wko-uninstaller-uninstall-failed-error-message":"Unable to uninstall WebLogic Kubernetes Operator {{operatorName}} from Kubernetes namespace {{operatorNamespace}}: {{error}}.",
14951516
"wko-uninstaller-uninstall-catch-all-error-message": "WebLogic Kubernetes Operator uninstall failed with an unexpected error: {{error}}",
14961517

1518+
"k8s-domain-definition-encrypted-credential-message": "Found secret {{secretName}} with WDT encrypted key {{secretKey}}",
1519+
"k8s-domain-deployer-update-admin-user-password-in-progress": "Updating Password for User {{adminUserName}}",
14971520
"k8s-domain-deployer-aborted-error-title": "Deploying WebLogic Domain to Kubernetes Aborted",
14981521
"k8s-domain-deployer-kubectl-exe-invalid-error-message": "Unable to deploy WebLogic Domain to Kubernetes because the Kubernetes client executable is invalid: {{error}}.",
14991522
"k8s-domain-deployer-helm-exe-invalid-error-message": "Unable to deploy WebLogic domain to Kubernetes because the Helm executable is invalid: {{error}}.",
@@ -1514,6 +1537,8 @@
15141537
"k8s-domain-deployer-create-wallet-password-secret-error-message": "Unable to deploy WebLogic domain to Kubernetes due to an error creating the OPSS wallet password secret {{secretName}} in the Kubernetes namespace {{namespace}}: {{error}}",
15151538
"k8s-domain-deployer-create-wl-secret-in-progress": "Creating secret {{secretName}} for WebLogic domain {{domainName}} in Kubernetes namespace {{namespace}}",
15161539
"k8s-domain-deployer-create-wl-secret-failed-error-message": "Failed to create WebLogic credentials secret {{secretName}} in Kubernetes namespace {{namespace}}: {{error}}",
1540+
"k8s-domain-deployer-create-wdt-secret-in-progress": "Creating secret {{secretName}} for WebLogic domain {{domainName}} in Kubernetes namespace {{namespace}}",
1541+
"k8s-domain-deployer-create-wdt-secret-failed-error-message": "Failed to create WebLogic credentials secret {{secretName}} in Kubernetes namespace {{namespace}}: {{error}}",
15171542
"k8s-domain-deployer-create-secrets-in-progress": "Creating secrets for WebLogic domain {{domainName}} in Kubernetes namespace {{namespace}}",
15181543
"k8s-domain-deployer-create-secret-failed-error-message": "Failed to create secret {{secretName}} in Kubernetes namespace {{namespace}}: {{error}}",
15191544
"k8s-domain-deployer-create-config-map-in-progress": "Creating Kubernetes config map for WebLogic domain {{domainName}} in Kubernetes namespace {{domainNamespace}}",

webui/package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"dependencies": {
1313
"@oracle/oraclejet": "~16.0.2",
1414
"@oracle/oraclejet-core-pack": "~16.0.2",
15-
"@oracle/wrc-jet-pack": "~2.4.8",
15+
"@oracle/wrc-jet-pack": "~2.4.10",
1616
"ace-builds": "^1.33.0",
1717
"i18next": "^23.11.2",
1818
"jquery": "^3.7.1",

webui/src/js/models/k8s-domain-definition.js

+22
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,28 @@ define(['knockout', 'utils/observable-properties', 'utils/common-utilities', 'ut
123123
}
124124
};
125125

126+
this.requiresWDTEncryptionPassphrase = ko.computed(() => {
127+
for (const secret of this.secrets.observable()) {
128+
for (const key of secret.keys) {
129+
if (key.value.toUpperCase().startsWith('{AES}')) {
130+
wktLogger.debug('k8s-domain-definition-encrypted-credential-message', { secretName: secret.name, secretKey: key.key });
131+
return true;
132+
}
133+
}
134+
}
135+
return false;
136+
}, this);
137+
138+
/** The name of the WDT encryption secret, if needed. */
139+
this.wdtEncryptionSecretName = ko.computed(() => {
140+
let wdtEncryptionSecret;
141+
142+
if (this.requiresWDTEncryptionPassphrase() && wdtModel.wdtPassphrase.observable()) {
143+
wdtEncryptionSecret = `${wdtModel.domainName()}-wdt-encryption-secret`;
144+
}
145+
return wdtEncryptionSecret;
146+
}, this);
147+
126148
this.replicas = props.createProperty(2);
127149
// TODO - can a WebLogic server really run with 64MB? If not, raise minimum limit...
128150
this.minimumHeapSize = props.createProperty('64m');

webui/src/js/models/wdt-model-definition.js

+33-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ define(['knockout', 'utils/observable-properties', 'js-yaml', 'utils/validation-
3232
/** The locations of the archive files. */
3333
this.archiveFiles = props.createArrayProperty();
3434

35+
/** Model encryption passphrase. */
36+
this.wdtPassphrase = props.createProperty();
37+
3538
/** The contents of the first model file. */
3639
this.modelContent = ko.observable('');
3740

@@ -163,10 +166,7 @@ define(['knockout', 'utils/observable-properties', 'js-yaml', 'utils/validation-
163166
// user:
164167
// Value: '@@SECRET:mydomain-jdbc-myds:username@@'
165168
//
166-
let secretKey = secretName;
167-
if (secretEnvVar) {
168-
secretKey = secretName.startsWith('-') ? `${secretEnvVar}${secretName}` : `${secretEnvVar}-${secretName}`;
169-
}
169+
const secretKey = this.getModelSecretKey(secretEnvVar, secretName);
170170

171171
let secretData;
172172
if (secretsMap.has(secretKey)) {
@@ -186,6 +186,35 @@ define(['knockout', 'utils/observable-properties', 'js-yaml', 'utils/validation-
186186
return [...secretsMap.values()];
187187
};
188188

189+
this.getModelSecretKey = (secretEnvVar, secretName) => {
190+
let secretKey = secretName;
191+
if (secretEnvVar) {
192+
secretKey = secretName.startsWith('-') ? `${secretEnvVar}${secretName}` : `${secretEnvVar}-${secretName}`;
193+
}
194+
return secretKey;
195+
};
196+
197+
this.getAdminUserTopologySecurityUserSecretKey = (userName) => {
198+
let result;
199+
try {
200+
const yaml = jsYaml.load(this.modelContent());
201+
202+
const modelValue = getElement(yaml, `topology.Security.User.${userName}.Password`);
203+
if (modelValue) {
204+
matches = modelValue.match(SECRET_PATTERN);
205+
if (matches) {
206+
const secretName = matches.groups.name;
207+
const secretEnvVar = matches.groups.envvar;
208+
209+
result = this.getModelSecretKey(secretEnvVar, secretName);
210+
}
211+
}
212+
} catch (e) {
213+
// unable to parse model, just return undefined
214+
}
215+
return result;
216+
};
217+
189218
/** Returns a property for editing the model properties */
190219
this.getModelPropertiesObject = function() {
191220
return this.internal.propertiesContent;

0 commit comments

Comments
 (0)