Skip to content

Commit

Permalink
Three notes on OpenBSD.
Browse files Browse the repository at this point in the history
  • Loading branch information
phf committed Dec 23, 2020
1 parent 4cb4fc6 commit a5913cb
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,26 @@ to remove GCC-specific options. For example, on Solaris:
The feature test macros on these systems isn't reliable, so you may also
need to use `-D__EXTENSIONS__` in `CFLAGS`.

### OpenBSD

The man page needs to go into a different path for OpenBSD's `man` command:

```
diff --git a/Makefile b/Makefile
index 119347a..dedf69d 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ endlessh: endlessh.c
install: endlessh
install -d $(DESTDIR)$(PREFIX)/bin
install -m 755 endlessh $(DESTDIR)$(PREFIX)/bin/
- install -d $(DESTDIR)$(PREFIX)/share/man/man1
- install -m 644 endlessh.1 $(DESTDIR)$(PREFIX)/share/man/man1/
+ install -d $(DESTDIR)$(PREFIX)/man/man1
+ install -m 644 endlessh.1 $(DESTDIR)$(PREFIX)/man/man1/
clean:
rm -rf endlessh
```

[np]: https://nullprogram.com/blog/2019/03/22/
34 changes: 34 additions & 0 deletions util/openbsd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Running `endlessh` on OpenBSD

## Covering IPv4 and IPv6

If you want to cover both IPv4 and IPv6 you'll need to run *two* instances of
`endlessh` due to OpenBSD limitations. Here's how I did it:

- copy the `endlessh` script to `rc.d` twice, as `endlessh` and `endlessh6`
- copy the `config` file to `/etc/endlessh` twice, as `config` and `config6`
- use `BindFamily 4` in `config`
- use `BindFamily 6` in `config6`
- in `rc.conf.local` force `endlessh6` to load `config6` like so:

```
endlessh6_flags=-s -f /etc/endlessh/config6
endlessh_flags=-s
```

## Covering more than 128 connections

The defaults in OpenBSD only allow for 128 open file descriptors per process,
so regardless of the `MaxClients` setting in `/etc/config` you'll end up with
something like 124 clients at the most.
You can increase these limits in `/etc/login.conf` for `endlessh` (and
`endlessh6`) like so:

```
endlessh:\
:openfiles=1024:\
:tc=daemon:
endlessh6:\
:openfiles=1024:\
:tc=daemon:
```

0 comments on commit a5913cb

Please sign in to comment.