
Show HN: ssh chat.shazow.net - shazow
Hi HN,<p>I wrote a custom SSH server in Go, give it a try. It uses your terminal user and SSH keys to authenticate implicitly. Instead of getting a shell, you get an IRC-style chatroom with everyone else.<p><pre><code>  $ ssh chat.shazow.net
</code></pre>
If you&#x27;re getting &quot;Permission denied (publickey)&quot;, please use ssh-keygen to create a keypair. Instructions here: https:&#x2F;&#x2F;help.github.com&#x2F;articles&#x2F;generating-ssh-keys&#x2F;<p>SSH is a really cool protocol; it&#x27;s a lot like HTTP2. This is a demo of one thing you can do with it, but I plan to factor out the code into libraries that will let you build all kinds of experiences that can be used with any SSH client.<p>The source code is here: https:&#x2F;&#x2F;github.com&#x2F;shazow&#x2F;ssh-chat<p>(Should be reasonably stable and handle thousands of connections, but apologies in advance if it crashes: Try to reconnect in a minute.)
======
shazow
A not-so-subtle reminder to people who are "curious" and want to break things:

It's open source. Install it locally and break it to your heart's content. If
you're flooding the public server, you're just ruining it for everyone else.

Yes, there are no spam controls. Yes, there are bugs. This thing was built in
a couple of days on my free time, and here I am sharing it with you. Please
find bugs locally, fix them, and send a pull request.

Enjoy. :)

~~~
scrollaway
Awesome work. I love it. I really think that this sort of thing could be
extremely useful in some specific cases, for example for internal
communication from sysadmins in enterprise setups. Imagine if it could be
integrated along with the shell, say in an ncurses split window or something
like this. There's so much potential.

Great work!

------
flac
A little warning: You should turn off SSH Agent Forwarding for this host.
Otherwise it may use your SSH Keys to auth to other servers you connect to via
SSH, e.g. GitHub git access etc.

You can either disable it for a particular session via -a argument:

    
    
      $ ssh -a chat.shazow.net
    

Or permanently for this host in ~/.ssh/config:

    
    
      Host chat.shazow.net
        ForwardAgent no

~~~
shazow
That sounds like a fun hack, thanks! Wonder if it will work, will play with it
later. :) Do any clients have it on by default?

(If you'd like to take my word for it, I have no intention on doing this on
chat.shazow.net)

------
mappu
Cool!

Can you hook a full ncurses up to this?

Going by my input lag, it looks like all keypresses are sent to the server,
can you implement readline somehow or can i configure SSH to buffer input
locally? Cook terminal mode or something?

What's pty.go used for?

If i write a line that's longer than my terminal width, it wraps onto a second
line, but new incoming messages obscure the first line

~~~
shazow
> Can you hook a full ncurses up to this?

Yup! Any ncurses thing should work great. I couldn't find a golang curses lib
that doesn't hardcode to stdout except for crypto/ssh/terminal, but it's
fairly limited.

> Going by my input lag, it looks like all keypresses are sent to the server,
> can you implement readline somehow or can i configure SSH to buffer input
> locally? Cook terminal mode or something?

I believe that's up to your ssh client. There are things like
[https://mosh.mit.edu/](https://mosh.mit.edu/) which try to mask the latency.

> What's pty.go used for?

For bootstrapping the pty request/response. :)

> If i write a line that's longer than my terminal width, it wraps onto a
> second line, but new incoming messages obscure the first line

Yea, there's a bug with long line reflow, not sure how to fix it. :(

~~~
Scaevolus
You could probably write raw ANSI escape sequences -- they're essentially
universal by this point.
[http://en.wikipedia.org/wiki/ANSI_escape_code](http://en.wikipedia.org/wiki/ANSI_escape_code)

ncurses is overkill nowadays when everything is a (VT100) emulator.

~~~
shazow
Yup, that's how most of these curses libraries work. It's a lot of work doing
layout with straight up escape sequences, though.

~~~
Scaevolus
Compatibility is most of the complexity: [http://invisible-
island.net/ncurses/terminfo.ti.html](http://invisible-
island.net/ncurses/terminfo.ti.html)

------
codezero
Reminds me of the good old days of telechat. I was wondering if there was a
way to set up a "login" free SSH server, glad someone else figured it out :)

~~~
shazow
:D Yea, the protocol certainly allows for it. Glad you like it.

------
cmyr
this is really cool even if you're all jerks.

~~~
shazow
I know, right? I got silenced on my own server.

<3

~~~
kirillzubovsky
Got kicked out for not saying anything for 5 minutes. Kind of a bummed :)
Would be nice to see if that was an auto-kick by the server, or someone
actually kicked me out for kicks. There was no info other than [disconnected
by remote server].

~~~
shazow
Nah, that's just the server restarting. :) There's a bug where it hangs
sometimes, haven't quite figured it out.

~~~
aksx
Its because of the memory usage, I'll try fixing it tomorrow

~~~
shazow
How can you tell it's memory?

As far as I can tell, the RSS memory usage of the process has never gone above
15mb.

------
nathell
A log, updated live until something kicks my 'watchdog' session out:

[http://danieljanus.pl/hnchatlog.html](http://danieljanus.pl/hnchatlog.html)

~~~
nathell
This is how it's generated:
[https://gist.github.com/anonymous/055a8fc90419b5beb9ba](https://gist.github.com/anonymous/055a8fc90419b5beb9ba)

------
_RPM
Have you implemented the binary protocol? Where did you get the protocol
specification from?

~~~
shazow
It's using Go's crypto/ssh from the standard library.

~~~
_RPM
Ahh okay. So it isn't implemented on this specification:
[https://tools.ietf.org/html/rfc4253](https://tools.ietf.org/html/rfc4253)
Regardless it seems cool.

~~~
dsl
The Go SSH library implements that RFC. That's why you can use and standard
SSH client to connect.

------
jimnutt
Very interesting, although it seems to be broken at the moment. It connects
and then just kind of hangs (connecting with the latest SSH client in arch).
It's a cool concept though.

~~~
aksx
Some people are spamming the chat room which increases the memory usage and
causes the 'hanging'

The server is restarted every hour so you should be able to access it in a
while.

The flood control feature has been added, we are waiting for shazow to wake up
and update the binary.

------
tux
This should be called "SIRC" ^_^ If anyone else has "Permission denied" run
this command: ssh-keygen -t rsa -f ~/.ssh/id_rsa

------
tsmith
Doesn't work with SSHInATab - I can connect (after adding a keypair) but the
things I type don't show up :'(

------
motyar
How to exit?

~~~
gatehouse
"/exit"

There is also a way to force your ssh client to disconnect:
[http://askubuntu.com/questions/29942/how-can-i-break-out-
of-...](http://askubuntu.com/questions/29942/how-can-i-break-out-of-ssh-when-
it-locks)

Edit, although now I can't seem to reconnect.

------
chuckup
Add some ANSI color, a message board section, stir, and you've got a BBS!
k-rad!

------
jensenbox
Why not tunnel IRC through this and get all the benefits of a seasoned IRC
server?

------
medecau
Username "dump" flooded the server. Service is dead until restart.

------
zifnab06
Reminds me of the old ircii days. Very basic client, I like it!

------
Kiro
Can someone post a screenshot?

~~~
shazow
Here's a screenshot somebody took of it running on a Cathode terminal:
[https://twitter.com/shazow/status/543587063765823490](https://twitter.com/shazow/status/543587063765823490)

We've had some pull requests since then which add colors and other things.

------
Aloha
neat!

------
DLion


------
edibleEnergy
hah cool

