The Glade 4.0

"Turn the lights down, the party just got wilder."
It is currently Sun Nov 24, 2024 2:16 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Mon Aug 11, 2014 4:19 pm 
Offline
Sensitive Ponytail Guy
User avatar

Joined: Fri Sep 04, 2009 10:18 pm
Posts: 2765
We have encountered issues at work with SSH Server software and are looking at switching to WinRM for remote management via PowerShell.

There's a catch, however, and it's something I didn't expect.
If I tunnel to a remote server via SSH, then launch a command-line program like WinSCP.com, my console switches from the shell prompt to the WinSCP prompt and my user experience becomes virtually indistinguishable from what I'd get if I had connected via remote desktop and then launched the program "directly". This is good. This is what I wanted, what I expected, and what makes my life easy.
If I tunnel to that same remove server via WinRM, then launch that same program, my PowerShell console displays the greeting text and the WinSCP prompt, then closes WinSCP and presents me with the session prompt. For some reason, no such program will remain "active" in that environment.

What I want:
Code:
PS E:\> Enter-PSSession Remote-Computer
[Remote-Computer]: PS C:\Users\Shelgeyr\Documents> & "C:\Program Files (x86)\WinSCP\WinSCP.com"
[Remote-Computer]: winscp>


What I get:
Code:
PS E:\> Enter-PSSession Remote-Computer
[Remote-Computer]: PS C:\Users\Shelgeyr\Documents> & "C:\Program Files (x86)\WinSCP\WinSCP.com"
[Remote-Computer]: winscp>
[Remote-Computer]: PS C:\Users\Shelgeyr\Documents>


Thankfully, WinSCP has published a .NET Assembly which allows me to work around this behavior.
Unfortunately, the same thing happens with Connect:Direct, and they have not published a .NET Assembly.

So when I attempt to use Connect:Direct via WinRM, I get this:
Code:
PS E:\> Enter-PSSession Remote-Computer
[Remote-Computer]: PS C:\Users\Shelgeyr\Documents> & "D:\Program Files (x86)\Sterling Commerce\Connect Direct v4.6.00\Common Utilities\Direct.exe"
8/11/2014 11:30:17 AM: Connect:Direct Command Line Interface Version 4.6.00 Build 019
(C) Copyright IBM Corp. 1983, 2011 All Rights Reserved.
*************************************************
Successfully connected to Connect_Direct_Node
Successfully disconnected from Connect_Direct_Node
[Remote-Computer]: PS C:\Users\Shelgeyr\Documents>


I'm busy working to discover a way to get around this, and am tempted to write my own damn .NET Assembly for in-house use, but I'm dying to know why WinRM can't seem to launch a usable, interactive session with a command-line application.
Anybody have insight?

_________________
Go back to zero, take a pill, and get well ~ Lemmy Kilmister


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 15, 2014 10:33 am 
Offline
Lean, Mean, Googling Machine
User avatar

Joined: Thu Sep 03, 2009 9:35 am
Posts: 2903
Location: Maze of twisty little passages, all alike
I don't know much about WinRM (didn't even know it existed, frankly), but from what I can tell, WinRM is not anything like an actual, general purpose remote terminal, and it certainly doesn't support arbitrary port forwarding like SSH does. Every application that you want to use with WinRM has to be explicitly modified to support communication over the WinRM protocol.

Quote:
Windows Remote Management (WinRM) is the Microsoft implementation of WS-Management Protocol, a standard Simple Object Access Protocol (SOAP)-based, firewall-friendly protocol that allows hardware and operating systems, from different vendors, to interoperate.

Alol. Remember kids: Microsoft's definition of "interoperability" between "different operating systems" explicitly means between "different versions of Windows" and between "different versions of Microsoft(TM) software".

Sorry, I don't really have a solution for you. It sounds like you'd not only need to write a WinRM listener, but you'd also have to modify the source code of Direct:Connect to use it. Which, is probably not trivial. Everything going through the WinRM pipe has to be XML-ified. It doesn't sound very amenable to transferring arbitrary binary files, though I'm sure it could be done.

Out of curiosity, what were the issues you were having with SSH and which SSH software were you using? I think you'd be better off figuring out how to solve your SSH problems than figuring out how to pound WinRM through a square hole. Or, failing that, just resign to using remote desktop for remote Windows administration.

_________________
Sail forth! steer for the deep waters only!
Reckless, O soul, exploring, I with thee, and thou with me;
For we are bound where mariner has not yet dared to go,
And we will risk the ship, ourselves and all.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Sep 15, 2014 3:43 pm 
Offline
Sensitive Ponytail Guy
User avatar

Joined: Fri Sep 04, 2009 10:18 pm
Posts: 2765
We were using CopSSH and after working well for a couple of days it said:
Code:
error: chown /dev/pty1 0 0 failed: No such file or directory
error: chmod /dev/pty1 0666 failed: No such file or directory


In response to our help ticket, ITeF!x said:
Quote:
Copssh does activate/deactivate access for existing users. Please do the following for a clean restart

* Uninstall Copssh
* Remove remnants of the installation directory
* Make sure that the service account is removed
* Install Copssh it again
* Start Contro Panel and verify if it is running
* Activate your users. Please remember that those user must exist
beforehand. Copssh doesn't create users for you - it just activates ssh
access for en axisting user.


Surprisingly enough, the complete wipe/clean re-install actually solved the problem ... for a couple of days.
After the second round of errors, we gave up. The software was installed on a Windows box and configured to present users with a cmd shell, not bash, so we can't figure out why the hell it's attempting to execute chown/chmod commands - let alone why it's attempting to execute them against non-existent files.

I did eventually figure out how to pass all the necessary arguments to Connect:Direct so it would do what I want it to.
This is a good thing, because RDP really isn't an option - this utility is for automated workflow management, not human users.
I am still, however, irked by not having interactive access.

_________________
Go back to zero, take a pill, and get well ~ Lemmy Kilmister


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Sep 16, 2014 11:41 am 
Offline
Lean, Mean, Googling Machine
User avatar

Joined: Thu Sep 03, 2009 9:35 am
Posts: 2903
Location: Maze of twisty little passages, all alike
Every Windows port of SSH that I can think of requires some kind of POSIX-like environment to function. It would just require far too much modification of the source code to be feasible any other way. The /dev/ptyXX nodes are the psuedo terminal devices that SSH (and other utilities like gnome-terminal, GNU screen, etc.) uses as a stand-in for the actual, physical terminal (/dev/ttyXX). These dev nodes may be created on-the-fly whenever the sshd daemon spawns a new terminal. It's trying to change ownership of the dev node to root:root and then grant +rw for user, group, and everyone on the dev node. Those are overly permissive for a Mac or *NIX system, but it's probably required to make things work on Windows. It sounds to me like the dev nodes aren't being created for some reason. I would guess that it's a Windows permission issue. Is the ssh daemon running with elevated privs? It probably needs to, even if it's running under an admin account.

It looks like CopSSH just utilizes cygwin and its sshd port under the hood. I would suggest cutting out the middle man. Uninstall CopSSH and try installing the latest greatest Cygwin directly. Tech issues notwithstanding, Cygwin is GPL'd. Unless you're packaging it in a closed-source product, there's absolutely no reason to pay someone licensing fees for the privilege of running Cygwin.

Edit: I just tested this on my own Cygwin install. I don't see any /dev/ptyXX devices until I launch a pseudo-terminal with screen. I don't have SSH running, so I can't test with that, but I'd assume it's the same.

This is the ownership/perms:
Code:
crw--w---- 1 NameRedacted None 136, 0 Sep 16 11:45 /dev/pty0


I'm not sure why CopSSH is trying to set root:root and 0666.

_________________
Sail forth! steer for the deep waters only!
Reckless, O soul, exploring, I with thee, and thou with me;
For we are bound where mariner has not yet dared to go,
And we will risk the ship, ourselves and all.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Sep 17, 2014 8:06 am 
Offline
Sensitive Ponytail Guy
User avatar

Joined: Fri Sep 04, 2009 10:18 pm
Posts: 2765
As it stands, the WinRM tunneling is working well and is enthusiastically endorsed by our IT Security department, whereas the SSH tunnel was something they were willing to tolerate but weren't terribly thrilled about. So it would appear my experimentation phase has ended.

_________________
Go back to zero, take a pill, and get well ~ Lemmy Kilmister


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 118 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group