top | item 40998158

Devzat – Chat over SSH, with some nice quality-of-life features

435 points| humanperhaps | 1 year ago |github.com

105 comments

order

hiAndrewQuinn|1 year ago

I have a Raspberry Pi running a read-only server where some friends and I have a "poor man's IRC" chat, in that we all log in from Termux and post messages to one another using `wall`. It's absolutely ridiculous and I love it.

thejosh|1 year ago

It's one of those things that if you need to ask why, you'll never understand :-)

complaintdept|1 year ago

Install `finger` and you've practically got a social media platform.

_joel|1 year ago

Yea, came here to say, what about wall! :)

rwmj|1 year ago

I wonder if you could do something similar with an ssh account which is hard-wired to run 'ytalk' (https://en.wikipedia.org/wiki/Talk_(software)).

codazoda|1 year ago

Probably. See my comment (and example repo) elsewhere about running any old binary when someone connects.

qudat|1 year ago

Pretty neat! We implemented something similar with an IRC chat app (senpai) in our SSH app (pico.sh). After the user creates an account, it lets users connect to our public IRC bouncer with a single command (`ssh pico.sh -t chat`).

ref: https://pico.sh/irc

codetrotter|1 year ago

See also: ssh-chat by shazow from ~10 years ago written in Go

  ssh chat.shazow.net
The most amazing part is perhaps the fact that this one is still around, 10 years later! Try it yourself and you’ll see :)

Discussion at the time:

https://news.ycombinator.com/item?id=8743374

Source code in GitHub repo here:

https://github.com/shazow/ssh-chat

quackduck|1 year ago

ssh-chat sort of inspired devzat. here's the story: I used to live in dubai at the time and for some odd dns reasons I could never actually join ssh-chat, but it acted as proof that ssh chats are possible, and so I decided to make my own version of it. then I moved to the us and was actually able to use both ssh-chat and devzat.

languagehacker|1 year ago

I'd be curious whether there's any security concerns on this one. Could an attacker craft a message that gets access to execute commands into a client terminal?

qudat|1 year ago

This is not sshd, this is a golang binary that uses the stdlib ssh lib. You would have to either a) figure out how to escape out of a golang binary, or b) if the go code executes shell commands with some user provided text, trying to shell inject something in there.

Tepix|1 year ago

You may not want the chat server owner to know which public ssh key you are using for privacy reasons.

Workaround: Specify another ssh keypair

freedomben|1 year ago

Yeah, though SSH is already very mature at processing text, so it's a surprisingly good fit for a chat. I would also remember that any machine you SSH from is going to give the server some metadata like IP address, public keys (which aren't useful as creds but can be for tracking). Really fun little project though

phoyd|1 year ago

I'm also interested. Setting up a passwordless SSH account for some public service sounds like a good way to give your machine away to North Korean hackers, because you forgot to set someting in /etc/sshd to "no".

Is there a usable description somewhere on how to do this safely?

codazoda|1 year ago

I experimented with writing a shell replacement a while back. Turns out you can just run any old program. Here’s and example “hello world” shell replacement written in Go.

https://github.com/codazoda/goshell

jagged-chisel|1 year ago

> Turns out you can just run any old program.

It’s amazing how simple some things are. Similarly, an HTTP server can also run any old binary in response to an incoming request. As long as it produces output that looks like an HTTP response, the client will receive that response.

quackduck|1 year ago

so sorry for it being down right now. hn hug of death is real

humanperhaps|1 year ago

Didn't think about that when posting - my bad

xyst|1 year ago

Guess it’s only useful as a toy :)

yu3zhou4|1 year ago

There was a beginner friendly machine to hack on HackTheBox where you had to hack a Devzat instance

quackduck|1 year ago

a devzat regular made that!

jasonjayr|1 year ago

As a gentle reminder, if you are forwarding your ssh-agent by default, you should connect with:

    ssh -o 'ForwardAgent no' $host
So your secure identities are not exposed to a random ssh server ...

Aeolun|1 year ago

Forwarding your agent by default (to all hosts!) sounds like a terrible idea.

sdsd|1 year ago

I love stuff like this. I made a widget for MacOS where you can see incoming |hi messages sent to your Urbit, as a kind of poor man's p2p chat. But I didn't add a feature to send hi messages, so you still need a CLI for that.

You can see what it looks like here: https://www.youtube.com/watch?v=_bAx4Jx39jE&t=384s

(it's the widget in the bottom right of the screen)

lynx23|1 year ago

Related: Does anyone by chance know how to configure an "anonymous" ssh account that always runs the same program? This would be great for making text mode games available to everyone without needing to support different platforms, now that windows actually ships with ssh.

SushiHippie|1 year ago

Wouldn't it be possible to just change the shell via 'chsh' or editing /etc/passwd to point to the text mode game for a particular user

quackduck|1 year ago

you can configure sshd to run any random executable when a user connects

xyst|1 year ago

Is this working for anybody else?

I created a throwaway ed25519 key, reconfigured ssh config, and tried to connect with ‘ssh chat’

Nothing loads. ‘ssh -v chat’ isn’t helpful either. ping and nc (on both 22 and 443) show the server (or load balancer) is accessible for me.

Maybe a “hnfp DoS” (hacker news front page DoS)?

n2e|1 year ago

Have you tried connecting with the actual hostname directly instead of an alias?

Edit: nvm the author said it’s down

tcsenpai|1 year ago

If you want to use my server, it might be a little more powerful than the current one. I would self host but to be honest I'd prefer helping out with the main instance. In case, I am here

Tepix|1 year ago

Looks like ascii colors aren't being filtered correctly.. which is a pretty big issue. White on white isn't very readable... :-)

quackduck|1 year ago

this sounds like a terminal thing. what terminal are you on.

localfirst|1 year ago

what sort of server resource usage is this like right now as you are getting a ton of traffic?

also noticed that people were able to run commands but permission denied. that kinda freaked me out. eventually somebody is going to figure out how to escape the go binary

quackduck|1 year ago

im not worried at all :)

nedpat|1 year ago

This is actually cool!

But unless I'm missing something, what's the difference between this and IRC?

ipsum2|1 year ago

Doesn't seem to be working, the chat is frozen and I can't type anything.

evbogue|1 year ago

Same here, seems to have crashed.

aa-jv|1 year ago

This is great, now we just need a way to host it on our mobile phones.

danslo|1 year ago

I appear to have crashed the server with "tic 999", sorry guys!

quackduck|1 year ago

that wasn't it but yeah lol

tempestlxc|1 year ago

Chatting via SSH has given me a lot of insights. Thank you.

ingen0s|1 year ago

This makes my list for top of the year, nice work.

callwhendone|1 year ago

ssh: connect to host devzat.hackclub.com port 22: Connection refused

PORT STATE SERVICE

22/tcp closed ssh

Nmap done: 1 IP address (1 host up) scanned in 1.18 seconds

----

overloaded?

styczen|1 year ago

Normal talk in unices system can do that.

Irc have exange data between server and minimalize data trafic.

still irc is better, but meybe in future