Start by installing Go, Git, GCC and glibc (the program is written in Go, but a tiny bit of C code is used to drop privileges when running as root). On Debian, run:
```
apt install golang git gcc libc6-dev
```
Then fetch and build the program:
```
go get tildegit.org/nervuri/client-hello-mirror
```
The resulting binary should now be at `~/go/bin/client-hello-mirror`. You can make it available to all users on the system:
In order to run the program as a daemon and auto-start it on boot, you need to manage it with your operating system's init system. Here you'll find instructions for systemd.
Modify as needed, save to `/etc/systemd/system/client-hello-mirror.service` and run:
```
systemctl enable client-hello-mirror.service
systemctl start client-hello-mirror.service
```
## Drop root
A standard web-facing setup involves using a CA-signed certificate and binding to privileged port 443. For security reasons, the program will drop root privileges imediately after loading the certificate and binding to the specified port. Use the `-u` option to select a user to switch to; the default is `www-data`.
## Redirect http:// to https://
For this you'll need to use another web server, such as nginx.