Skip to content

Releases

Hardened the -C / --CredMgr credential-miss path so an unattended run can no longer silently prompt or hang

Choose a tag to compare

@MainframeDaze MainframeDaze released this 01 Jul 23:25
  • The STDIN fallback on a credential miss now happens ONLY when a human could actually answer. If not, we print a clear error and exit with a distinct reserved code, ERROR_NOT_FOUND (1168), so a calling CMD wrapper can tell "credential missing" apart from "wrong password" (rejected) and "ssh failed".
  • New --CredMgrStrict boolean flag (Args.credMgrStrict): automation passes this to force fail-fast; it NEVER touches STDIN on a miss.
  • Guardrail regardless of the flag: StdinIsInteractive() treats stdin as interactive ONLY if GetFileType()==FILE_TYPE_CHAR AND GetConsoleMode() succeeds. A redirected/piped/closed/detached stdin (scheduled task, service) is refused a prompt even without --CredMgrStrict.
  • Integration is flag-and-signal, NOT ExitProcess(): WritePass() runs on the PipeListener worker thread AFTER the child launches, so a hard exit there would skip main()'s console-restore and handle cleanup. Instead WritePass() sets ctx->credMgrFailed, signals ctx->events[0], and ProcessOutput() ENDs the listener loop; main()'s normal exit path restores the console and returns ERROR_NOT_FOUND.

Usage / operational notes for -C (also see help text):

  • Passwords stored in the credential MUST be ASCII-only. get_vault_pass() converts UTF-16 -> ANSI via CP_ACP; non-ASCII characters corrupt silently. (This is alongside the existing "no double-quote (") in passwords" rule.)
  • Leading/trailing spaces in a stored credential are written to the child verbatim and WILL break auth. Trim them when saving the credential.
  • Use the ATTACHED form -CTag (e.g. -CmyServer). The separated form "-C Tag" can swallow the next token. As with all sshpass options, every -option must precede the command: parsing stops at the first non-option token (ARGPARSE_STOP_AT_NON_OPTION).

Credential Manager support for logon PW. Extended VT100 options

Choose a tag to compare

@MainframeDaze MainframeDaze released this 04 Mar 03:53

This release contains two groups of changes. The first would've been v2.2.0, adding the -C / --CredMgr option. Unlike saving a password in an environment variable or a plaintext file, Windows credential manager encrypts its contents and ties the decryption to the logon of the active user. -C is followed by the Internet or network address name used for a Generic Windows Credential (the user id may be left blank or have random text; we do not use it). The password pulled is supplied for the logon password.

Because SSHpass supports other utilities like SCP.exe, we only save the password in CredMgr, and let the user define whatever CredMgr retrieval key they want. Trying to parse the rest of the SSHPass command line for the user ID and server name would be prone to failure, so those are not included in CredMgr. You must still put them on the command line.

This has been tested against pfSense with SSH and SCP, and ADM on an ASUSTOR NAS (with SSH only).

The testing on ADM led to the features in 2.2.1: enabling ENABLE_VIRTUAL_TERMINAL_PROCESSING on STDOUT, not just STDIN. ADM outputs more advanced VT100 sequences than, for instance, pfSense, and without this change, use of keys like Backspace resulted in Ctrl Character garbage all over the screen.

As I worked on this I realized that there also devices that might lack VT100 support through SSH, so I added the -n / --nonVT100 option. Using this leaves everything as plain text on input and output (and adds DISABLE_NEWLINE_AUTO_RETURN to the VT100 case, but turns it off for non-VT100 cases). I have tested this mode on Unifi AP/AC Pro with SSH. On these devices it is best to run CLS to clear the CMD window before launching, else you may find your cursor at the top of the screen...

This release clears Issue #1 - Support for Windows Credential Manager

Minor tweaks to v2.1.0

Choose a tag to compare

@MainframeDaze MainframeDaze released this 12 Feb 01:14

Modified CloseInputHandler() to return ERROR_NOT_READY if it does not see the InputHandler thread exit within the set delay time (4 seconds). Warn user that their Console Mode might be messed up. If you press Ctrl-C with -clocal set, we do our best to restore the console state.

Fixed Ctrl-C handling

Choose a tag to compare

@MainframeDaze MainframeDaze released this 09 Feb 23:54

Changed default behavior as suggested by @rollingmoai so that the default case is now to send Ctrl-C, Ctrl-Z etc on to the server for handling vs. letting the default Windows handler close SSHPass. Also added the -c / --ctrlc option to allow callers to specify local handling or server handling. In the local case, we now handle the ctrl-c within SSHPass in order to restore the original console settings, as opposed to letting Windows close the sshpass process without doing any "cleanup".

Additionally found that restoring the original console settings was not always happening; it was a race condition to see if the input thread would finish execution before the main thread exited. If the input thread did not finish, then the console mode was not properly restored. Tested under Windows 11 to ensure clean restore of state both with -clocal and -cserver.

Added error messages to main()

Choose a tag to compare

@MainframeDaze MainframeDaze released this 05 Feb 18:59

Now report errors if PipeListener event could not be created or if VT100 mode cannot be set. Both cases cause us to exit.

Fixed bugs found with CoPilot

Choose a tag to compare

@MainframeDaze MainframeDaze released this 05 Feb 00:44

Crunched codebase with CoPoilot, found several issues and fixed them. See Wiki or comments in SSHPass.CPP.

Add ENABLE_VIRTUAL_TERMINAL_INPUT

Choose a tag to compare

@MainframeDaze MainframeDaze released this 01 Dec 01:23

Updated InputHandlerThread() to set ENABLE_VIRTUAL_TERMINAL_INPUT as per original branch. If CreatePseudoConsoleAndPipes() fails, we not only print the error code, we also return it as our result. Difference between us and main branch is now use of Unicode in the main branch. We are still ASNI

v2.0.1-release

Choose a tag to compare

@MainframeDaze MainframeDaze released this 01 Dec 00:45

Removed "WFMO result" message and updated version number

Initial release

Initial release Pre-release
Pre-release

Choose a tag to compare

@MainframeDaze MainframeDaze released this 10 Oct 05:32
19857d1

Tested on 64-bit Windows [Version 10.0.26100.6584]. Works with SSH and SCP as shipped with Windows.