The z/OS USS SDK has a dependency on the ssh2 package. This package allows for more secure cryptographic ciphers to be used first on supporting hardware. In order to do this, the dependency attempts to build some native modules at install time.
If these modules cannot be built, the dependency will continue to function, without the optimal cipher list order. However, some error messaging may be visible. These errors can be safely ignored, if desired.
To consume the optimal cipher list and build the native modules, the following software is pre-requisite:
We recommend NodeJS be installed with Chocolatey, which includes most of the required tooling. An additional tool, CMake, will need to be installed in addition to Chocolatey.
Messages to be used as command responses for different scenarios
memberof
ZosUssMessages
allAuthMethodsFailed
allAuthMethodsFailed:object
Message indicating that the data set type is unsupported
message
message:string = "All configured authentication methods failed"
connectionRefused
connectionRefused:object
message
message:string = "Connection was refused"
expiredPassword
expiredPassword:object
message
message:string = "Your password has expired"
handshakeTimeout
handshakeTimeout:object
message
message:string = "Timed out while waiting for handshake"
hostKeyChanged
hostKeyChanged:object
message
message:string = "Host key verification failed. The SSH server's host key does not match the previously trusted " +"key. The server's host key may have changed, or the server may not be the one you " +"previously connected to. The connection was rejected before any credentials were sent."
hostKeyVerificationFailed
hostKeyVerificationFailed:object
message
message:string = "Host key verification failed. The SSH server's host key is not trusted, so the connection " +"was rejected before any credentials were sent."
pinnedHostKeyConnectFailed
pinnedHostKeyConnectFailed:object
message
message:string = "Connection failed before the host key could be verified. A pinned host key is configured for " +"this server, so the server may have changed its host key type."
unexpected
unexpected:object
message
message:string = "Connection failed because of an unexpected error"
z/OS USS Package
Contains APIs to interact with USS on z/OS (using the z/OS SSH service).
Installation Instructions
The z/OS USS SDK has a dependency on the ssh2 package. This package allows for more secure cryptographic ciphers to be used first on supporting hardware. In order to do this, the dependency attempts to build some native modules at install time.
If these modules cannot be built, the dependency will continue to function, without the optimal cipher list order. However, some error messaging may be visible. These errors can be safely ignored, if desired.
To consume the optimal cipher list and build the native modules, the following software is pre-requisite:
Windows
We recommend NodeJS be installed with Chocolatey, which includes most of the required tooling. An additional tool, CMake, will need to be installed in addition to Chocolatey.
Alternatively, install the following:
Unix
makegcc-c++,g++)MacOS
XCode Command Line ToolsAPI Examples
Check disk space on file system containing home directory
import { ProfileInfo } from "@zowe/imperative"; import { Shell, SshSession } from "@zowe/zos-uss-for-zowe-sdk"; (async () => { // Load connection info from default SSH profile const profInfo = new ProfileInfo("zowe"); await profInfo.readProfilesFromDisk(); const sshProfAttrs = profInfo.getDefaultProfile("ssh"); const sshMergedArgs = profInfo.mergeArgsForProfile(sshProfAttrs, { getSecureVals: true }); const session = new SshSession(ProfileInfo.initSessCfg(sshMergedArgs.knownArgs)); await Shell.executeSsh(session, "df .", (data: string) => { if (data.trim()) console.log(data); }); })().catch((err) => { console.error(err); process.exit(1); });Make a script executable
import { ProfileInfo } from "@zowe/imperative"; import { Shell, SshSession } from "@zowe/zos-uss-for-zowe-sdk"; (async () => { // Load connection info from default SSH profile const profInfo = new ProfileInfo("zowe"); await profInfo.readProfilesFromDisk(); const sshProfAttrs = profInfo.getDefaultProfile("ssh"); const sshMergedArgs = profInfo.mergeArgsForProfile(sshProfAttrs, { getSecureVals: true }); const session = new SshSession(ProfileInfo.initSessCfg(sshMergedArgs.knownArgs)); await Shell.executeSshCwd(session, "chmod +x test.sh", "/tmp", (data: string) => { if (data.trim()) throw new Error(data); }); })().catch((err) => { console.error(err); process.exit(1); });