SSHChat
Page content
SSH Chat
how to run your own SSH Chat Server
Setup
# add go
pkg_add go
# add user 'sshchat'
adduser
# switch user
su - sshchat
ftp https://github.com/shazow/ssh-chat/archive/v1.10.tar.gz
tar zxf v1.10.tar.gz
cd ssh-chat-1.10/
make build
# back to root
exit
cp /home/sshchat/ssh-chat-1.10/ssh-chat /usr/local/bin/
sshchat - ipfile
manage whiteliste ip in dedicated file
# create folder
mkdir -p /etc/pf.d
# sample file
echo "127.0.0.1" > /etc/pf.d/sshchat
# set permission
chmod 600 /etc/pf.d/sshchat
pf.conf
update pf.conf appropriate
# Table
table <sshchat> persist file "/etc/pf.d/sshchat"
# Redirect
match in log on egress proto tcp from <sshchat> to YOUR-PUBLIC-IP port 22 rdr-to 127.0.0.1 port 2222
# Allow Rule
pass log quick proto tcp from <sshchat> to (self) port { 22 2222 }
restart packetfilter
pfctl -f /etc/pf.conf
shutdown script
we wanna dump the ip’s to the file on shutdown
cat << 'EOF' > /etc/rc.shutdown
#!/bin/sh
cp /etc/pf.d/sshchat /var/log/pf-sshchat-$(date +%s)
pfctl -t sshchat -T show |awk '{print $1}' |sort |uniq > /etc/pf.d/sshchat
EOF
chmod 700 /etc/rc.shutdown
Startup
crontab for user sshchat
# start sshchat
@reboot ssh-chat --verbose --bind "localhost:2222" --identity /home/sshchat/.ssh/ssh-chat-key
Any Comments ?
sha256: 1d01405e02d1209a886df07c404c32ce36dc3c4c28811a4ce53a1e859c7492bc