From 951e03fad02d77b51efd1642b73d4ba75ec7b2e7 Mon Sep 17 00:00:00 2001 From: aetonsi <18366087+aetonsi@users.noreply.github.com> Date: Fri, 29 Dec 2023 02:49:21 +0100 Subject: [PATCH] add http basic auth to tinypilot --- sysadmin/rpi-setup.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sysadmin/rpi-setup.md b/sysadmin/rpi-setup.md index 0e9b21d..03a0083 100644 --- a/sysadmin/rpi-setup.md +++ b/sysadmin/rpi-setup.md @@ -73,3 +73,23 @@ curl \ bash - && \ sudo reboot ``` + +#### 6.1 add HTTP basic auth to TinyPilot + +```shell +# https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-nginx-on-ubuntu-14-04 +sudo sh -c "echo -n 'sammy:' >> /etc/nginx/.htpasswd" +sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd" +cat /etc/nginx/.htpasswd +``` + +... in `/etc/nginx/conf.d/tinypilot.conf`: + +```config +server { + location / { + auth_basic "Restricted Content"; + auth_basic_user_file /etc/nginx/.htpasswd; + } +} +```