Add tutorial for OpenBSD

Jag Talon 2025-03-07 18:21:52 +00:00
parent ef2aa13aa4
commit a5d809e019

@ -89,9 +89,87 @@ $ sudo systemctl enable ssh-chat # ensures ss
$ sudo systemctl start ssh-chat # starts the ssh-chat daemon
```
#
# Running on OpenBSD
Additional resources:
Building ssh-chat on OpenBSD is the same as in other systems. All we need is to install Go.
```
# pkg_add go
```
## Running as a service
It's perfectly valid to not run ssh-chat as a service. Simply running `$ ssh-chat` yourself or running it inside Tmux works great. For example, you can add the following to run ssh-chat whenever your computer boots by putting the following in your crontab:
```
@reboot tmux new-session -d '/path/to/ssh-chat [...]'
```
But if you want to run it as a service, you can try the following:
### Put the executable in a standard location
You can create a link to the existing binary or move it completely to `/usr/local/bin`.
```
# ln -s ~/ssh-chat/ssh-chat /usr/local/bin/ssh-chat
```
### Create the user that will run this service
You can use `useradd` or `adduser`. For example:
```
# useradd -m chat
```
### Create the directory where ssh-chat configuration will live
Let's make sure to set the right permissions as well.
```
# mkdir /var/ssh-chat
# chown chat:chat /var/chat
```
### Create the service
Finally, let's create the service. Create a file called `/etc/rc.d/ssh_chat` with the following contents:
```
#!/bin/ksh
daemon="/usr/local/bin/ssh-chat"
daemon_logger="daemon.info"
daemon_flags="--verbose --bind ':PORT' --identity PRIVATE_KEY --admin=ADMIN_FILE --motd=MOTD_FILE"
daemon_user="USER"
. /etc/rc.d/rc.subr
rc_bg=YES
rc_reload=NO
rc_cmd $1
```
Modify the values in `daemon_flags` and `daemon_user` based on your configurations. Alternately, you can set the flags directly with `rcctl`:
```
# rcctl set ssh_chat flags --verbose --bind [...] --identity [...]
```
After that, you can enable and run the service:
```
# rcctl enable ssh_chat
# rcctl start ssh_chat
```
### Logs
The logs will be found in `/var/log/daemon` so monitor that file if you run into any issues.
# Additional resources:
- https://impactcore.blogspot.ca/2017/09/ssh-chat-irc-like-chat-client-over-ssh.html
- https://ozgurkazancci.com/setup-ssh-chat-an-sshd-based-chat-server-on-openbsd/ #ssh-chat running under OpenBSD