zowe-cli icon indicating copy to clipboard operation
zowe-cli copied to clipboard

Zowe 'config secure' fails to recognize secure properties in a global base profile

Open gejohnston opened this issue 2 years ago • 3 comments

The 'config secure' command does not recognize secure properties in the base profile from a global team config file, unless you are in the ZOWE_CLI_HOME directory.

Built from code in master as of 5/23/2022. Run on Windows.

Here is the behavior that I see:

C:\ourstuff\runtime\temp
-> ls

C:\ourstuff\runtime\temp
-> zowe config list --locations --root
C:\Users\MyUserId\.zowe\zowe.config.json

C:\ourstuff\runtime\temp
-> zowe config secure
No secure properties found in your config

C:\ourstuff\runtime\temp
-> cd C:\Users\MyUserId\.zowe

C:\Users\MyUserId\.zowe
-> zowe config secure
Enter profiles.base_secure_pass.properties.user - blank to skip:
Enter profiles.base_secure_pass.properties.password - blank to skip:

C:\Users\MyUserId\.zowe
-> zowe zos-files list data-set "SYS1.PARMLIB*"
SYS1.PARMLIB
SYS1.PARMLIB.ARCHIVE
SYS1.PARMLIB.OLD
SYS1.PARMLIBN

C:\Users\MyUserId\.zowe

This is the config file from the ZOWE_CLI_HOME directory (with sensitive names replaced):

{
    "$schema": "/Users/MyUserId/.zowe/zowe.schema.json",
    "profiles": {
        "base_secure_pass": {
            "type": "base",
            "properties": {
                "rejectUnauthorized": false
            },
            "secure": [
                "user",
                "password"
            ]
        },
        "MyHost": {
            "type": "zosmf",
            "properties": {
                "host": "MyHost.corp.site.com",
                "port": 443,
                "responseFormatHeader": true
            }
        }
    },
    "defaults": {
        "base": "base_secure_pass",
        "zosmf": "MyHost"
    },
    "autoStore": true
}

gejohnston avatar May 23 '22 22:05 gejohnston

Hi same problem here, and does also not work in the ZOWE_CLI_HOME Folder: file is the imperative.log file in zowe installdir folder imperative\logs\impoerative.log (set user and password):

[2022/06/23 10:50:45.077] [ERROR] [CommandProcessor.js:942] Handler for command "set" failed.
[2022/06/23 10:50:45.079] [ERROR] [CommandProcessor.js:945] Diagnostic information:
Platform: 'win32', Architecture: 'x64', Process.argv: 'C:\MYPATH\nodejs\node.exe C:\MYPATH\nodejs\node_modules\@zowe\cli\lib\main.js config set --global-config --secure profiles.base.properties.user MYUSER'
Node versions: '{
  "node": "16.15.1",
  "v8": "9.4.146.24-node.21",
  "uv": "1.43.0",
  "zlib": "1.2.11",
  "brotli": "1.0.9",
  "ares": "1.18.1",
  "modules": "93",
  "nghttp2": "1.47.0",
  "napi": "8",
  "llhttp": "6.0.4",
  "openssl": "1.1.1o+quic",
  "cldr": "40.0",
  "icu": "70.1",
  "tz": "2021a3",
  "unicode": "14.0",
  "ngtcp2": "0.1.0-DEV",
  "nghttp3": "0.1.0-DEV"
}'Environmental variables: '{
  "ALLUSERSPROFILE": "C:\\ProgramData",
  "APPDATA": "C:\\Users\\MYUSER\\AppData\\Roaming",
  "HOST_DEBUGGER": "C:\\path1\\tools\\zosexplorer",
  "IBM_DB_HOME": "C:\\path1\\tools\\zowe\\odbc_cli",
  "JAVA_HOME": "C:\\path1\\java\\jdk1.8.0",
  "LIB": "C:\\path1\\tools\\zowe\\odbc_cli\\bin;C:\\path1\\tools\\zowe\\odbc_cli\\bin\\icc64;C:\\path1\\tools\\zowe\\odbc_cli\\lib;undefined",
  "LOCALAPPDATA": "C:\\Users\\MYUSER\\AppData\\Local",
  "NUMBER_OF_PROCESSORS": "8",
  "OneDrive": "C:\\Users\\MYUSER\\OneDrive",
  "OS": "Windows_NT",
  "Path": "C:\\path1\\tools\\zowe\\odbc_cli\\bin;C:\\path1\\tools\\zowe\\odbc_cli\\bin\\amd64.VC12.CRT;C:\\path1\\tools\\zowe\\odbc_cli\\bin\\icc64;C:\\path1\\tools\\zowe\\odbc_cli\\lib;C:\\path1\\tools\\nodejs;",
  "PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC",
  "PROMPT": "$P$G",
  "PSModulePath": "C:\\Program Files (x86)\\PowerShell Community Extensions\\Pscx3\\;C:\\Program Files\\WindowsPowerShell\\Modules;,
  "PUBLIC": "C:\\Users\\Public",
  "PYTHON3": "C:\\path1\\python-3.8.6-embed-amd64",
  "SESSIONNAME": "Console",
  "SystemDrive": "C:",
  "SystemRoot": "C:\\WINDOWS",
  "USERNAME": "MYUSER",
  "ZOWE_CLI_HOME": "C:\\path1\\tools\\zowe"
}'
[2022/06/23 10:50:45.080] [ERROR] [CommandProcessor.js:953] Handler for set rejected by thrown ImperativeError.
[2022/06/23 10:50:45.089] [ERROR] [CommandYargs.js:148] Error in command set
[2022/06/23 10:50:45.091] [ERROR] [CommandYargs.js:149] [
  {
    success: false,
    exitCode: 1,
    message: 'Unable to securely save credentials.',
    stdout: <Buffer >,
    stderr: <Buffer 43 6f 6d 6d 61 6e 64 20 45 72 72 6f 72 3a 0a 55 6e 61 62 6c 65 20 74 6f 20 73 65 63 75 72 65 6c 79 20 73 61 76 65 20 63 72 65 64 65 6e 74 69 61 6c 73 ... 275 more bytes>,
    data: {},
    error: {
      msg: 'Unable to securely save credentials.',
      additionalDetails: 'Possible Solutions:\n' +
        ' - Reinstall Zowe CLI. On Linux systems, also make sure to install the prerequisites listed in Zowe CLI documentation.\n' +
        ' - Ensure Zowe CLI can access secure credential storage. Zowe CLI needs access to the OS to securely save credentials.'
    }
  }
]

grafik

C:\Users\MYUSER>zowe --version
7.2.4

C:\MYPATH\zowe>node --version
v16.15.1

C:\MYPATH\zowe>npm --version
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.11.0

We can't update the password, which is really annoying, because we can't use zowe anymore (when we need to update the password).

Thanks!

kraabrsg avatar Jun 23 '22 10:06 kraabrsg

Hey @kraabrsg, As mentioned in slack, I wasn't able to reproduce the same problem on Windows. Did you see any installation errors when updating to @zowe/[email protected] ?

zFernand0 avatar Jun 23 '22 19:06 zFernand0

Hey @zFernand0 we updated with our custom installer (this updates npm/nodejs, vscode itself, and our custom vscode extension).

Zowe updates from 7.2.2 to 7.2.4

There is a updater protocol:

**Updating Zowe Config Init (init --global-config --prompt false)**

Saved config template to C:\MYPATH\zowe\zowe.config.json
Finished

**Updating Zowe User (set --global-config --secure profiles.base.properties.user {user} ) **
Command Error:
Unable to securely save credentials.
Error Details:
Possible Solutions:
- Reinstall Zowe CLI. On Linux systems, also make sure to install the prerequisites listed in Zowe CLI documentation.
- Ensure Zowe CLI can access secure credential storage. Zowe CLI needs access to the OS to securely save credentials.
Finished

the npm cache log shows nothing interesting:


0 verbose cli C:\MYPATH\nodejs\node.exe C:\MYPATH\nodejs\node_modules\npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 3ms
5 timing config:load:file:C:\MYPATH\nodejs\node_modules\npm\npmrc Completed in 4ms
6 timing config:load:builtin Completed in 5ms
7 warn config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8 timing config:load:cli Completed in 10ms
9 timing config:load:env Completed in 1ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\MYUSER\.npmrc Completed in 7ms
12 timing config:load:user Completed in 7ms
13 timing config:load:file:C:\MYPATH\zowe\plugins\installed\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 2ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config:load Completed in 33ms
19 timing npm:load:configload Completed in 33ms
20 timing npm:load:mkdirpcache Completed in 1ms
21 timing npm:load:mkdirplogs Completed in 1ms
22 verbose title npm install @zowe/zos-ftp-for-zowe-cli
23 verbose argv "install" "@zowe/zos-ftp-for-zowe-cli" "--prefix" "C:\\MYPATH\\zowe\\plugins\\installed" "--global" "--registry" "https://registry.npmjs.org/" "--legacy-peer-deps"
24 timing npm:load:setTitle Completed in 2ms
25 timing config:load:flatten Completed in 6ms
26 timing npm:load:display Completed in 8ms
27 verbose logfile logs-max:10 dir:C:\Users\MYUSER\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\MYUSER\AppData\Local\npm-cache\_logs\2022-06-23T08_50_27_368Z-debug-0.log
29 timing npm:load:logFile Completed in 12ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm:load Completed in 59ms
33 timing arborist:ctor Completed in 1ms
34 silly logfile start cleaning logs, removing 2 files
35 timing idealTree:init Completed in 13ms
36 timing idealTree:userRequests Completed in 6ms
37 silly idealTree buildDeps
38 silly fetch manifest @zowe/zos-ftp-for-zowe-cli@*
39 silly logfile done cleaning log files
40 http fetch GET 200 https://registry.npmjs.org/@zowe%2fzos-ftp-for-zowe-cli 674ms (cache updated)
41 silly placeDep ROOT @zowe/[email protected] OK for:  want: *
42 silly fetch manifest [email protected]
43 http fetch GET 200 https://registry.npmjs.org/zos-node-accessor 857ms (cache revalidated)
44 timing idealTree:#root Completed in 1556ms
45 timing idealTree:buildDeps Completed in 1558ms
46 timing idealTree:fixDepFlags Completed in 1ms
47 timing idealTree Completed in 1579ms
48 timing reify:loadTrees Completed in 1611ms
49 timing reify:diffTrees Completed in 2ms
50 silly reify mark retired [
50 silly reify   'C:\\MYPATH\\zowe\\plugins\\installed\\node_modules\\@zowe\\zos-ftp-for-zowe-cli'
50 silly reify ]
51 silly reify moves {
51 silly reify   'C:\\MYPATH\\zowe\\plugins\\installed\\node_modules\\@zowe\\zos-ftp-for-zowe-cli': 'C:\\MYPATH\\zowe\\plugins\\installed\\node_modules\\@zowe\\.zos-ftp-for-zowe-cli-a6T2IczY'
51 silly reify }
52 timing reify:retireShallow Completed in 11ms
53 timing reify:createSparse Completed in 2ms
54 silly tarball no local data for @zowe/zos-ftp-for-zowe-cli@https://registry.npmjs.org/@zowe/zos-ftp-for-zowe-cli/-/zos-ftp-for-zowe-cli-2.0.2.tgz. Extracting by manifest.
55 http fetch GET 200 https://registry.npmjs.org/@zowe/zos-ftp-for-zowe-cli/-/zos-ftp-for-zowe-cli-2.0.2.tgz 4756ms (cache miss)
56 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli Completed in 4766ms
57 timing arborist:ctor Completed in 0ms
58 timing reify:diffTrees Completed in 3ms
59 timing reify:createSparse Completed in 16ms
60 timing reify:loadShrinkwraps Completed in 4810ms
61 timing reify:loadBundles Completed in 0ms
62 silly audit bulk request {
62 silly audit   '@zowe/zos-ftp-for-zowe-cli': [ '2.0.2' ],
62 silly audit   'core-util-is': [ '1.0.3' ],
62 silly audit   ftp4: [ '0.3.13' ],
62 silly audit   'readable-stream': [ '1.1.14' ],
62 silly audit   string_decoder: [ '0.10.31' ],
62 silly audit   inherits: [ '2.0.4' ],
62 silly audit   isarray: [ '0.0.1' ],
62 silly audit   q: [ '1.4.1' ],
62 silly audit   xregexp: [ '2.0.0' ],
62 silly audit   'zos-node-accessor': [ '1.0.11' ],
62 silly audit   debug: [ '2.6.9' ],
62 silly audit   ms: [ '2.0.0' ]
62 silly audit }
63 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/zos-node-accessor/node_modules/ms Completed in 135ms
64 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/core-util-is Completed in 135ms
65 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/inherits Completed in 140ms
66 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/ftp4/node_modules/string_decoder Completed in 141ms
67 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/isarray Completed in 143ms
68 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/q Completed in 159ms
69 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/ftp4 Completed in 166ms
70 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/xregexp Completed in 172ms
71 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/zos-node-accessor Completed in 182ms
72 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/zos-node-accessor/node_modules/debug Completed in 187ms
73 timing reifyNode:node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/ftp4/node_modules/readable-stream Completed in 186ms
74 timing reify:unpack Completed in 188ms
75 timing reify:unretire Completed in 0ms
76 timing build:queue Completed in 2ms
77 timing build:deps Completed in 3ms
78 timing build Completed in 4ms
79 timing reify:build Completed in 4ms
80 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/advisories/bulk 418ms
81 timing auditReport:getReport Completed in 422ms
82 silly audit report {}
83 timing auditReport:init Completed in 0ms
84 timing reify:audit Completed in 425ms
85 timing reify:trash Completed in 240ms
86 timing reify Completed in 6891ms
87 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli
88 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/zos-node-accessor
89 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/zos-node-accessor/node_modules/debug
90 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/zos-node-accessor/node_modules/ms
91 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/q
92 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/xregexp
93 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/core-util-is
94 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/isarray
95 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/ftp4
96 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/ftp4/node_modules/readable-stream
97 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/ftp4/node_modules/string_decoder
98 silly CHANGE node_modules/@zowe/zos-ftp-for-zowe-cli/node_modules/inherits
99 timing command:install Completed in 6903ms
100 verbose exit 0
101 timing npm Completed in 7249ms
102 info ok

But it seems that from my previous posting i forgot to copy in important lines:


[2022/06/23 11:50:14.645] [WARN] [Imperative.js:445] Environmental setting for imperative log level ('ZOWE_IMPERATIVE_LOG_LEVEL') was blank.
[2022/06/23 11:50:14.647] [WARN] [Imperative.js:463] Environmental setting for app log level ('ZOWE_APP_LOG_LEVEL') was blank.
[2022/06/23 11:50:14.653] [WARN] [OverridesLoader.js:134] Secure vault not enabled. Reason: Failed to load Keytar module: **Cannot find module 'keytar'**
Require stack:
- C:\MYPATH\nodejs\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\security\src\DefaultCredentialManager.js
- C:\MYPATH\nodejs\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\security\src\CredentialManagerFactory.js
- C:\MYPATH\nodejs\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\security\index.js
- C:\MYPATH\nodejs\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\cmd\src\profiles\CliProfileManager.js
- C:\MYPATH\nodejs\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\cmd\index.js
- C:\MYPATH\nodejs\node_modules\@zowe\cli\node_modules\@zowe\imperative\lib\index.js
- C:\MYPATH\nodejs\node_modules\@zowe\cli\lib\main.js
[2022/06/23 11:50:15.881] [ERROR] [CommandProcessor.js:942] Handler for command "set" failed.
[2022/06/23 11:50:15.883] [ERROR] [CommandProcessor.js:945] Diagnostic information:

Hope this helps. (we don't use the default home folder...)

kraabrsg avatar Jun 24 '22 05:06 kraabrsg

The original error reported seems to be a user error.

You need to use the --global-config to influence the ~/.zowe` config JSON file.

zFernand0 avatar Dec 16 '22 19:12 zFernand0