sshportal icon indicating copy to clipboard operation
sshportal copied to clipboard

feat: add readline and history WIP

Open jle64 opened this issue 6 years ago • 6 comments

This adds support for basic readline-like behavior using chzyer/readline, including persistence of history for the admin shell between sessions.

Weirdly for now this doesn't seem to work in docker while it works outside of it.

jle64 avatar Jun 10 '19 15:06 jle64

Hi @jle64 is it still in WIP or do you need a review?

moul avatar Jul 03 '20 13:07 moul

Hi @moul it's still broken when I run it in docker and I have no idea why. I don't see what difference it should make to be in docker but it results in the user input being hidden, while it works perfectly if I just run the sshportal binary directly on the host.

So it's not ready but if you have an idea of what could be wrong with it or some time to look at it I would be grateful.

jle64 avatar Jul 04 '20 17:07 jle64

Hum, super strange, I don't have an issue when running sshportal within Docker

I'm running it this way: make docker.build && docker run -it --rm -p 2222:2222 moul/sshportal

Screenshot - Manfred 2020-07-04 at 20 09 02

moul avatar Jul 04 '20 18:07 moul

Hum, if I launch it like you do it works, however if I launch it without the -t docker option it doesn't anymore.

So it seems the fact that the server is being run in a docker with terminal or not changes how it behaves when a client connects, which isn't right.

jle64 avatar Jul 05 '20 18:07 jle64

yes -t if for "tty", it can be checked dynamically from within go, so you can maybe make a condition that uses readline or the previous mode dynamically :)

moul avatar Jul 05 '20 18:07 moul

So it seems the fact that the server is being run in a docker with terminal or not changes how it behaves when a client connects, which isn't right.

yes, thinking more about it, it's unrelated, so maybe, the script is checking if the current process has tty support instead of checking if the SSH user has tty support, we should probably prevent the library from checking itself

moul avatar Jul 05 '20 18:07 moul