net/nut: Protect CGI via HTTP Basic Auth
authorDaniel Dickinson <lede@cshore.thecshore.com>
Wed, 11 Jan 2017 23:54:16 +0000 (18:54 -0500)
committerDaniel Dickinson <lede@cshore.thecshore.com>
Wed, 11 Jan 2017 23:54:16 +0000 (18:54 -0500)
When using uhttpd (the default), protect NUT CGI
via HTTP Basic Auth.

Signed-off-by: Daniel Dickinson <lede@cshore.thecshore.com>
net/nut/Makefile
net/nut/files/add_nut_httpd_conf [new file with mode: 0644]

index cc9a5de73f9ac59841e243a99fc9330296675a48..a5773f1f8d3c7de7f3c7332726abf51ed4e490b2 100644 (file)
@@ -275,6 +275,7 @@ define Package/nut-web-cgi/conffiles
 /etc/nut/upsstats.html
 /etc/nut/upsstats-single.html
 /etc/config/nut_cgi
+/etc/httpd.conf
 endef
 
 define Package/nut-web-cgi/install
diff --git a/net/nut/files/add_nut_httpd_conf b/net/nut/files/add_nut_httpd_conf
new file mode 100644 (file)
index 0000000..b8fa847
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+grep -q '/cgi-bin/nut' /etc/httpd.conf 2>/dev/null || {
+       echo '/cgi-bin/nut:root:$p$root' >>/etc/httpd.conf
+       /etc/init.d/uhttpd restart
+}