zowe / zowe-cli-scs-plugin

The secure credential store plugin for Zowe CLI, leveraging keytar and the OS keychain to securely access and store sensitive user credentials normally stored in CLI profiles.
Eclipse Public License 2.0
8 stars 3 forks source link

source-credential-store-for-zowe-cli.tgz Supporting the Latest Version of Node #50

Closed connorpekovic closed 1 year ago

connorpekovic commented 3 years ago

source-credential-store-for-zowe-cli.tgz is dependent on Node v12, but that version had known security vulnerabilities. Can we get source-credential-store-for-zowe-cli.tgz to work against the latest version of Node?

t1m0thyj commented 3 years ago

@connorpekovic Where did you download secure-credential-store-for-zowe-cli.tgz from?

We have updated the Secure Credential Store plugin to support Node.js 14. The newest version is included in the "Zowe 1.24.0 CLI Core" bundle that can be downloaded here: https://www.zowe.org/download.html

If the newest version still fails to install, please provide the output of the failing zowe plugins install command so that we can further assist with diagnosing the issue.

connorpekovic commented 3 years ago

Oh ok! My company uses a popular repository manager, so maybe something prohibited me from getting the latest version. Sorry for raising an issue, I will try again with the latest version of Zowe CLI Core on my company workstation!

BJostmeyer commented 2 years ago

Hi - I cannot install the secure credential store, too. I am running Windows and followed the installation instruction to get latest nodes LTS version as well as Zowe CLI on my machine. I was able to install Zowe CLI - after they fixed an issue.

However - now I want to install the secure credential store - since I require it for my plugin (system-automation) and fail with problem below:

It can not find: C:\Users\BerndJostmeyer\node_modules\@zowe\cli\lib\main.js - the directory ...\@zowe does not contain "cli" ?!?

I have installed: image

I am stuck - since mid october the node LTS version changed to 16.13 - and nothing seems to work anymore. I recently developed and shipped a new plugin for the Zowe CLI, however customer start complain to me, that they cannot install... - and it turns out, me neither...

I need help.

Below the messages that I get when trying to install the plugin:

zowe plugins install @zowe/secure-credential-store-for-zowe-cli Plug-ins within the Imperative CLI Framework can legitimately gain control of the zowe CLI application during the execution of every command. Install 3rd party plug-ins at your own risk.

Imperative's plugin installation program handles @zowe peer dependencies. You can safely ignore NPM warnings about missing @zowe peer dependencies.

Registry = https://registry.npmjs.org/


npm ERR! code 1 npm ERR! path C:\Users\BerndJostmeyer.zowe\plugins\installed\node_modules\@zowe\secure-credential-store-for-zowe-cli npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c zowe config set CredentialManager @zowe/secure-credential-store-for-zowe-cli && echo "The Secure Credential Store has been successfully installed. The CLI will now use the Node Keytar module to encrypt your local credentials. CLI Profiles that you have created will need to be updated because their credentials are stored in plain text and not accessible from the credential manager. Refer to the available options in the help text to update profiles 'zowe scs update -h'." 1>&2 npm ERR! node:internal/modules/cjs/loader:936 npm ERR! throw err; npm ERR! ^ npm ERR! npm ERR! Error: Cannot find module 'C:\Users\BerndJostmeyer\node_modules\@zowe\cli\lib\main.js' npm ERR! at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15) npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:778:27) npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) npm ERR! at node:internal/main/run_main_module:17:47 { npm ERR! code: 'MODULE_NOT_FOUND', npm ERR! requireStack: [] npm ERR! }

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\BerndJostmeyer\AppData\Local\npm-cache_logs\2021-11-11T14_32_43_985Z-debug.log Command Error: Install Failed

kraabrsg commented 2 years ago

Hi, having similar problems here:

1.) just download the binaries from https://nodejs.org/en/download/ (Latest LTS Version: 16.13.2 (includes npm 8.1.2)) -> C:\yyyy\zowe_cli 2.) set a PATH variable to C:\xxxx\zowe_nodejsnpm 3.) download the tgz files for zowe cli + plugins (1.26) 4.) as we use powershell -> setting path: Set-Location -Path "$($mypath)" # see 1.) 5.)the .npmr in users folder looks like this:

prefix=C:\yyyyy\Zowe_CLI

#proxy=http://myproxy:0/
#https-proxy=http://myproxy:0/
#strict-ssl=false
#sslVerify=false
#cafile=C:\yyyyy\Zowe_CLI\zerts.crt

6.)$temp = npm set config cafile "$($mypath)\zerts.crt" our proxy needs an ssl termination 7.)$temp = CMD /C set NODE_TLS_REJECT_UNAUTHORIZED=0 8.)$temp = npm install -g zowe-cli.tgz 9.)$temp = npm install -g prebuild-install 10.) $temp = npm install -g secure-credential-store-for-zowe-cli.tgz

Resulting in:

npm ERR! code 1
npm ERR! path C:\yyyyyy\zowe_cli\node_modules\@zowe\secure-credential-store-for-zowe-cli\node_modules\cpu-features
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@16.13.2 | win32 | x64
npm ERR! gyp info find Python using Python version 3.7.8 found at "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/win-x86/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/win-x64/node.lib
npm ERR! gyp http GET https://nodejs.org/download/release/v16.13.2/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/SHASUMS256.txt
npm ERR! gyp http 404 https://nodejs.org/download/release/v16.13.2/win-arm64/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/win-x86/node.lib
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.13.2/win-x64/node.lib
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16        
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14        
npm ERR! gyp ERR! stack     at C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16       
npm ERR! gyp ERR! stack     at C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\yyyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\yyyyyy\\zowe_nodejsnpm\\node.exe" "C:\\yyyyyy\\zowe_nodejsnpm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\yyyyyy\zowe_cli\node_modules\@zowe\secure-credential-store-for-zowe-cli\node_modules\cpu-features
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok

Working with NPM 6.14.9...

Also mentioned in the "zowe-install" slack channel: https://app.slack.com/client/T1BAJVCTY/CM5ES0EJJ?selected_team_id=T1BAJVCTY

Thanks!

t1m0thyj commented 2 years ago

@kraabrsg To install the Secure Credential Store plug-in into Zowe CLI, npm install -g won't work. Could you try the following command instead of #10? zowe plugins install secure-credential-store-for-zowe-cli.tgz

kraabrsg commented 2 years ago

hi @t1m0thyj , yes step 10 was an error. Thanks for the hint, unfortunatly after that, i noticed that the cli was not installed correctly.... (zowe -v gave nothing in return).

The further error was in Nr. 5.) the prefix must be C:\xxxx\zowe_nodejsnpm (where npm/nodejs combi is installed)

Thanks!

connorpekovic commented 2 years ago

What worked for me was using npm install @zowe/secure-credential-store-for-zowe-cli@4.1.5 or whatever LTS version is then zowe plugins install secure-credential-store-for-zowe-cli.tgz

kraabrsg commented 2 years ago

Hi @t1m0thyj and @connorpekovic i am still stuck with this... My first try was unfortunatly wrong, i installed the cli into the user directory (forgot to add Variable ZOWE_CLI_HOME).

What i did:

corrected Nr. 5 back to "prefix=C:\yyyyy\Zowe_CLI"
changed Nr.9 to $temp = npm config set prefix "C:\yyyyy\zowe_nodejsnpm"
                           $temp =  npm install -g prebuild-install   
changed Nr. 10 to $temp = npm config set prefix "C:\yyyyy\zowe_cli"
                             $temp = zowe plugins install secure-credential-store-for-zowe-cli.tgz  

results in:

npm ERR! code 1
npm ERR! path C:\yyyyy\zowe_cli\.zowe\plugins\installed\node_modules\@zowe\secure-credential-store-for-zowe-cli
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c zowe config set CredentialManager @zowe/secure-credential-store-for-zowe-cli && echo "The Secure Credential Store has been successfully installed. The CLI will now use the Node Keytar module to encrypt your local credentials. CLI Profiles that you have created will need to be updated because their credentials are stored in plain text and not accessible from the credential manager. Refer to the available options in the help text to update profiles 'zowe scs update -h'." 1>&2

Using @connorpekovic suggestion leads to a similar error of "Visual Studio" as from above.

Is there a *.tgz package for offline installation (prebuild-install) available too?

Thanks!

t1m0thyj commented 2 years ago
npm ERR! code 1
npm ERR! path C:\yyyyy\zowe_cli\.zowe\plugins\installed\node_modules\@zowe\secure-credential-store-for-zowe-cli
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c zowe config set CredentialManager @zowe/secure-credential-store-for-zowe-cli && echo "The Secure Credential Store has been successfully installed. The CLI will now use the Node Keytar module to encrypt your local credentials. CLI Profiles that you have created will need to be updated because their credentials are stored in plain text and not accessible from the credential manager. Refer to the available options in the help text to update profiles 'zowe scs update -h'." 1>&2

@kraabrsg Assuming this is the complete error output, it looks like you've gotten past the prebuild-install issue 🙂 This new error means that the SCS plug-in has installed successfully until the very last step, where it invokes zowe to set itself as the default credential manager.

Could you provide more details about how you did Step 2 ("set a PATH variable to C:\xxxx\zowe_nodejsnpm")? Since the command that's failing is cmd.exe zowe, I'm wondering if zowe is found on your PATH in PowerShell, but missing from your PATH in Command Prompt.

Also, could you try launching a new Command Prompt (not PowerShell) and running the command which zowe? This should show whether cmd.exe is able to locate Zowe CLI.

Is there a *.tgz package for offline installation (prebuild-install) available too?

We already include prebuild-install package in the offline TGZ package for SCS, but due to a bug in npm@8 (https://github.com/npm/cli/issues/2659) you have to install it separately. Since you've already done this successfully, the new error is unrelated to prebuild-install.

schoko11 commented 2 years ago

hi @t1m0thyj

Could you provide more details about how you did Step 2 ("set a PATH variable to C:\xxxx\zowe_nodejsnpm")? Since the command that's failing is cmd.exe zowe, I'm wondering if zowe is found on your PATH in PowerShell, but missing from your PATH in Command Prompt. well just set variable PATH to this folder (user , set regkey HKCU\environment)

-> i am not sure how to check if PATH is foumd in powershell? (i think that's the problem not cmd) . I test with a powershell i start in vscodium (with m$ powershell extension)

Also, could you try launching a new Command Prompt (not PowerShell) and running the command which zowe? This should show whether cmd.exe is able to locate Zowe CLI.

will try that tomorrow... (this is my private github user, as to avoid confusion)

thanks!

t1m0thyj commented 2 years ago

Also, could you try launching a new Command Prompt (not PowerShell) and running the command which zowe? This should show whether cmd.exe is able to locate Zowe CLI.

@schoko11 When you test this, the command is "where zowe", not "which zowe". Sorry about that 🙂

kraabrsg commented 2 years ago

Hi @t1m0thyj

Steps 6 - 10 are done on CMD prompt zowe plugins install secure-credential-store-for-zowe-cli.tgz (step 10) yields to:

node:37536) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
npm ERR! code 1
npm ERR! path C:\yyyyy\zowe_cli\.zowe\plugins\installed\node_modules\@zowe\secure-credential-store-for-zowe-cli\node_modules\keytar
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c prebuild-install || npm run build
npm ERR! > keytar@7.7.0 build
npm ERR! > node-gyp rebuild
npm ERR! Der Befehl "prebuild-install" ist entweder falsch geschrieben oder
npm ERR! konnte nicht gefunden werden.
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@8.3.0
npm ERR! gyp info using node@16.13.2 | win32 | x64
npm ERR! gyp info find Python using Python version 3.7.8 found at "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\yyyyy\zowe_nodejsnpm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:404:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1064:16)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\yyyyy\\zowe_nodejsnpm\\node.exe" "C:\\yyyyy\\zowe_nodejsnpm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\yyyyy\zowe_cli\.zowe\plugins\installed\node_modules\@zowe\secure-credential-store-for-zowe-cli\node_modules\keytar
npm ERR! gyp ERR! node -v v16.13.2
npm ERR! gyp ERR! node-gyp -v v8.3.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\MYUSER\AppData\Local\npm-cache\_logs\2022-01-20T09_39_33_140Z-debug.log
Command Error:
Install Failed

C:\yyyyy\zowe_cli>where zowe
C:\yyyyy\zowe_cli\zowe
C:\yyyyy\zowe_cli\zowe.cmd

Could it be that here a systemvariable for PATH is used, somehow (the first variable points to "C:\Windows\System32").

Everything is in the zowe_cli folder, ZOWE_CLI_HOME points to: "C:\yyyyy\zowe_cli.zowe"

grafik

After closing the cmd and opening again "where zowe" does not find a path!

zFernand0 commented 1 year ago

The original issue was related to the SCS plug-in not working on certain versions of node. Since the creation of the issue, there have been a few enhancements and fixes to the plug-in and it should be node-version agnostic.


This issue has had no activity for 12 months. The issue also has less than 5 up-votes by the community. No action on this issue is targeted for the next 2 calendar quarters.