INSTALL.md: reformat

Add ./configure step
Fix libpcre-dev to libpcre2-dev
This commit is contained in:
Sergey Ponomarev 2024-04-11 00:32:12 +03:00 committed by Yves Rutschle
parent 1ddf45bf52
commit 717fe8fae5

View File

@ -7,6 +7,7 @@ available directly from [Github](https://github.com/yrutschle/sslh/pkgs/containe
Windows binaries for Cygwin are graciously produced by Windows binaries for Cygwin are graciously produced by
nono303 on his [repository](https://github.com/nono303/sslh). nono303 on his [repository](https://github.com/nono303/sslh).
Compile and install Compile and install
=================== ===================
@ -15,139 +16,130 @@ Dependencies
`sslh` uses: `sslh` uses:
* [libconfig](http://www.hyperrealm.com/libconfig/). For * [libconfig](http://www.hyperrealm.com/libconfig/).
Debian this is contained in package `libconfig-dev`. You For Debian this is contained in package `libconfig-dev`.
can compile with or without it using USELIBCONFIG in the You can compile with or without it using USELIBCONFIG in the Makefile.
Makefile.
* [libwrap](http://packages.debian.org/source/unstable/tcp-wrappers). * [libwrap](http://packages.debian.org/source/unstable/tcp-wrappers).
For Debian, this is contained in packages For Debian, this is contained in packages `libwrap0-dev`.
`libwrap0-dev`. You You can compile with or without it using USELIBWRAP in the Makefile.
can compile with or without it using USELIBWRAP in the
Makefile.
* [libsystemd](http://packages.debian.org/source/unstable/libsystemd-dev), in package `libsystemd-dev`. You * [libsystemd](http://packages.debian.org/source/unstable/libsystemd-dev), in package `libsystemd-dev`.
can compile with or without it using USESYSTEMD in the You can compile with or without it using USESYSTEMD in the Makefile.
Makefile.
* [libcap](http://packages.debian.org/source/unstable/libcap-dev), in package `libcap-dev`. You can compile with or without it using USELIBCAP in the Makefile * [libcap](http://packages.debian.org/source/unstable/libcap-dev), in package `libcap-dev`.
You can compile with or without it using USELIBCAP in the Makefile
* libbsd, to enable to change the process name (as shown in * libbsd, to enable to change the process name (as shown in `ps`,
`ps`, so each forked process shows what protocol and what so each forked process shows what protocol and what connection it is serving),
connection it is serving), which requires `libbsd` at runtime, and `libbsd-dev` at compile-time.
which requires `libbsd` at runtime, and `libbsd-dev` at
compile-time.
* libpcre2, in package `libpcre-dev`. You can compile * libpcre2, in package `libpcre2-dev`.
with or without it using ENABLE_REGEX in the Makefile. You can compile with or without it using ENABLE_REGEX in the Makefile.
* libev-dev, in package `libev-dev`. If you build a binary * libev-dev, in package `libev-dev`.
specifically and do not build `sslh-ev`, you don't need If you build a binary specifically and do not build `sslh-ev`, you don't need this.
this.
For OpenSUSE, these are contained in packages libconfig9 and For OpenSUSE, these are contained in packages libconfig9 and
libconfig-dev in repository libconfig-dev in repository
<http://download.opensuse.org/repositories/multimedia:/libs/openSUSE_12.1/> <http://download.opensuse.org/repositories/multimedia:/libs/openSUSE_12.1/>
For Fedora, you'll need packages `libconfig` and For Fedora, you'll need packages `libconfig` and `libconfig-devel`:
`libconfig-devel`:
yum install libconfig libconfig-devel yum install libconfig libconfig-devel
If you want to rebuild `sslh-conf.c` (after a `make If you want to rebuild `sslh-conf.c` (after a `make distclean` for example),
distclean` for example), you will also need to add you will also need to add [conf2struct](https://www.rutschle.net/tech/conf2struct/README.html)
[conf2struct](https://www.rutschle.net/tech/conf2struct/README.html)
(v1.5) to your path. (v1.5) to your path.
The test scripts are written in Perl, and will require The test scripts are written in Perl, and will require
IO::Socket::INET6 (libio-socket-inet6-perl in Debian). `IO::Socket::INET6` (`libio-socket-inet6-perl` in Debian).
Compilation Compilation
----------- -----------
After this, the Makefile should work: After this, the Makefile should work:
make install make install
There are a couple of configuration options at the beginning There are a couple of configuration options at the beginning of the Makefile:
of the Makefile:
* `USELIBWRAP` compiles support for host access control (see * `USELIBWRAP` compiles support for host access control (see `hosts_access(3)`),
`hosts_access(3)`), you will need `libwrap` headers and you will need `libwrap` headers and library to compile (`libwrap0-dev` in Debian).
library to compile (`libwrap0-dev` in Debian).
* `USELIBCONFIG` compiles support for the configuration * `USELIBCONFIG` compiles support for the configuration file.
file. You will need `libconfig` headers to compile You will need `libconfig` headers to compile (`libconfig8-dev` in Debian).
(`libconfig8-dev` in Debian).
* `USESYSTEMD` compiles support for using systemd socket activation. * `USESYSTEMD` compiles support for using systemd socket activation.
You will need `systemd` headers to compile (`systemd-devel` in Fedora). You will need `systemd` headers to compile (`systemd-devel` in Fedora).
* `USELIBBSD` compiles support for updating the process name (as shown by `ps`).
* `USELIBBSD` compiles support for updating the process name (as shown
by `ps`).
Generating the configuration parser Generating the configuration parser
----------------------------------- -----------------------------------
The configuration file and command line parser is generated The configuration file and command line parser is generated by `conf2struct`,
by `conf2struct`, from `sslhconf.cfg`, which generates from `sslhconf.cfg`, which generates `sslh-conf.c` and `sslh-conf.h`.
`sslh-conf.c` and `sslh-conf.h`. The resulting files are The resulting files are included in the source
included in the source so `sslh` can be built without so `sslh` can be built without `conf2struct` installed.
`conf2struct` installed.
Further, to prevent build issues,
`sslh-conf.[ch]` has no dependency to `sslhconf.cfg` in the Makefile.
In the event of adding configuration settings,
they need to be regenerated using `make c2s`.
Further, to prevent build issues, `sslh-conf.[ch]` has no
dependency to `sslhconf.cfg` in the Makefile. In the event
of adding configuration settings, they need to be
regenerated using `make c2s`.
Binaries Binaries
-------- --------
The Makefile produces three different executables: `sslh-fork`, The Makefile produces three different executables:
`sslh-select` and `sslh-ev`: `sslh-fork`, `sslh-select` and `sslh-ev`:
* `sslh-fork` forks a new process for each incoming connection. * `sslh-fork` forks a new process for each incoming connection.
It is well-tested and very reliable, but incurs the overhead It is well-tested and very reliable, but incurs the overhead of many processes.
of many processes. If you are going to use `sslh` for a "small" setup
If you are going to use `sslh` for a "small" setup (less than (less than a dozen ssh connections and a low-traffic https server)
a dozen ssh connections and a low-traffic https server) then then `sslh-fork` is probably more suited for you.
`sslh-fork` is probably more suited for you.
* `sslh-select` uses only one thread, which monitors all * `sslh-select` uses only one thread, which monitors all connections at once.
connections at once. It only incurs a 16 byte overhead per It only incurs a 16 byte overhead per connection.
connection. Also, if it stops, you'll lose all connections, Also, if it stops, you'll lose all connections,
which means you can't upgrade it remotely. If you are going which means you can't upgrade it remotely.
to use `sslh` on a "medium" setup (a few hundreds of If you are going to use `sslh` on a "medium" setup (a few hundreds of connections),
connections), or if you are on a system where forking is or if you are on a system where forking is expensive (e.g. Windows),
expensive (e.g. Windows), `sslh-select` will be better. `sslh-select` will be better.
* `sslh-ev` is similar to `sslh-select`, but uses `libev` as a backend.
This allows using specific kernel APIs that
allow to manage thousands of connections concurrently.
* `sslh-ev` is similar to `sslh-select`, but uses `libev` as
a backend. This allows using specific kernel APIs that
allow to manage thousands of connections concurrently.
Installation Installation
------------ ------------
* In general: * In general:
```sh
make ./configure
cp sslh-fork /usr/local/sbin/sslh make
cp basic.cfg /etc/sslh.cfg cp sslh-fork /usr/local/sbin/sslh
vi /etc/sslh.cfg cp basic.cfg /etc/sslh.cfg
vi /etc/sslh.cfg
```
* For Debian: * For Debian:
```sh
cp scripts/etc.init.d.sslh /etc/init.d/sslh cp scripts/etc.init.d.sslh /etc/init.d/sslh
```
* For CentOS: * For CentOS:
```sh
cp scripts/etc.rc.d.init.d.sslh.centos /etc/rc.d/init.d/sslh cp scripts/etc.rc.d.init.d.sslh.centos /etc/rc.d/init.d/sslh
```
You might need to create links in /etc/rc<x>.d so that the server You might need to create links in /etc/rc<x>.d so that the server
start automatically at boot-up, e.g. under Debian: start automatically at boot-up, e.g. under Debian:
```sh
update-rc.d sslh defaults update-rc.d sslh defaults
```