add chroot support

This allows people to chroot sslh into a path to further harden it.

We have to rework the user logic a bit because we need to look up
the user details *before* we chroot (as we need to read /etc/passwd
files), but do the actual priv dropping *after* we chroot (so we
have permission to make the actual chroot call).

Similarly, we need to open the syslog before we drop privs because
/dev/log won't be available inside the chroot.
This commit is contained in:
Mike Frysinger committed 2018-01-03 10:19:59 -05:00
1 parent d9541392f8
commit 0fb4c6b2ad
6 files changed
+58 -31

No files matched your search

+1
View File
@@ -11,6 +11,7 @@ transparent: false;
timeout: 2;
user: "nobody";
pidfile: "/var/run/sslh.pid";
chroot: "/var/empty";
# Specify which syslog facility to use (names for your
# system are usually defined in /usr/include/*/sys/syslog.h