Default automatic telnet connection feature request
This is an awesome app, thanks very much for making it available. We're running a Django web server and would like to use sshwifty to enable our members to connect to a moo based chat server automatically without going through the connection menu.
We very much appreciate the ability to limit outbound connections to designated presets, but would like to avoid having our members need to go through the menus to connect to the chat server when there is only a single telnet preset in our use case. Further, we'd like to pass along the user's connection login and password to the moo server via sshwifty.
So as an implementation in the config.json file, the ability to designate the telnet server and port to automatically connect to without needing to go through the connection menu (and in fact not display the connection menu)
And as an implementation in the sshwifty http server, the ability to take a connection command via POST which is then sent to the telnet server automatically when connected which in our case (and in the case of most MUDs etc) would be a single line like: connect character-name password
We prefer sending the info via POST to avoid exposing it in the browser.
This would serve the general use case of web servers connecting to in-house muds or chat servers
Thanks for your consideration.
Sorry, I've looked into the possibilities and unable to found a easy way to add such feature into Sshwifty in a generalized manner.
The difficult part is automatic user login, which require automatic interaction between Sshwifty and the target server (instead of just sending the login detail and hope for the best). For example, for a server that expect username and password, the manual login flow might look like this:
- Connection established
- Server sends
Username:\n, and wait for user input their username, terminated with\n - User types their username, and press Enter key
- The server checks the input, founds the
\ncharacter, so it knows that the username input process is completed - The server send
Password:\n, and wait for user to input their password, terminated with\n - User types their password, and press Enter key
- The server checks the input again, founds the
\ncharacter, the password input process is completed
Of course, a program can simply just send <Username>\n<Password>\n down the TCP pipe and it might work for the specific case. However, it's quite irresponsible for me to implement it in this way, since it might not work in other cases.
In order to implement it responsibly, Sshwifty must check what exactly the server wants and response to it accordingly, so the login flow might look similar to this:
- Connection established, both the remote server and Sshwifty knows it
- Sshwifty is expecting
Username:\n, and if received, Sshwifty will reply<Username>\n - Server sends
Welcome! You've connected to our server....\n - Server sends
MOTD: ......\n - Sshwifty receives
Welcome! ...\n, user configuration says it should be ignored - Sshwifty receives
MOTD: ...\n, user configuration says it should be ignored too - Server sends
Username:\n, Sshwifty replies<Username>\n - Sshwifty now expecting
Password:\n, and will reply<Password>\nonce received it - Server sends
Hello <Username> - Sshwifty receives
Hello <Username>, user configuration says it should be ignored - Server sends
Password:\n - Sshwifty receives
Password:\n, and replies<Password>\n. Sshwifty now expectsLogin successful!\nand will stop the automatic login since received it - Server sends
Login successful!\n - Sshwifty hand over the control to the user
As you can see, the situation gets complex really quickly, and the case above is just a simplified example. Think what if server sends Password for <Username>:\n instead of just Password? What if something went wrong during the login process?
To make it work in general cases, I'm afraid I have to invent a programming language (kind like expect script) to allow users to express the login logic, but that's too big for this project.
So, sorry again. But I don't think it can be implemented in Sshwifty.
However, since you control the both ends, you can of course modify the software in your own fork to make it work for your specific case.
Another thing is, if you just want Sshwifty to connect to a remote server after the page is loaded (without the need of autologin), there is a feature called Launch Link, which can be generated from the "Connected before" list on the "Known remotes" tab. The link is similar to this: https://sshwifty.herokuapp.com/#+Telnet:horizons.jpl.nasa.gov:6775%7Cutf-8. Of course, user will still have to manually type in their login details, but at least it would save them few clicks :)
Thanks for your thoughtful reply, you make good points with regard to an "auto login" implementation.
The launch link feature is a good start for what I'm looking for.
Thanks again for sshwifty.