about summary refs log tree commit diff
path: root/pkgs/tools/system/netdata
diff options
context:
space:
mode:
authorKranium Gikos Mendoza <kranium@gikos.net>2016-10-25 22:55:25 +0800
committerKranium Gikos Mendoza <kranium@gikos.net>2016-10-25 22:56:15 +0800
commit237c15d883d6f515b6829835167cf3c9f564e2ec (patch)
tree2bc939becbacd28e740638d2699f20abdb3c9d9f /pkgs/tools/system/netdata
parent8f457026ad095d44ad424fb25ddda5c45ac89794 (diff)
downloadnixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.tar
nixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.tar.gz
nixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.tar.bz2
nixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.tar.lz
nixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.tar.xz
nixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.tar.zst
nixlib-237c15d883d6f515b6829835167cf3c9f564e2ec.zip
netdata: allow UI to load when running as non-root
Diffstat (limited to 'pkgs/tools/system/netdata')
-rw-r--r--pkgs/tools/system/netdata/default.nix3
-rw-r--r--pkgs/tools/system/netdata/web_access.patch20
2 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/tools/system/netdata/default.nix b/pkgs/tools/system/netdata/default.nix
index 13c50fe3ec9e..30d9d6b4ef37 100644
--- a/pkgs/tools/system/netdata/default.nix
+++ b/pkgs/tools/system/netdata/default.nix
@@ -13,6 +13,9 @@ stdenv.mkDerivation rec{
 
   buildInputs = [ autoreconfHook zlib pkgconfig libuuid ];
 
+  # Allow UI to load when running as non-root
+  patches = [ ./web_access.patch ];
+
   preConfigure = ''
     export ZLIB_CFLAGS=" "
     export ZLIB_LIBS="-lz"
diff --git a/pkgs/tools/system/netdata/web_access.patch b/pkgs/tools/system/netdata/web_access.patch
new file mode 100644
index 000000000000..f1e4bd64cbb5
--- /dev/null
+++ b/pkgs/tools/system/netdata/web_access.patch
@@ -0,0 +1,20 @@
+--- a/src/web_client.c.orig
++++ b/src/web_client.c
+@@ -331,7 +331,7 @@
+         buffer_sprintf(w->response.data, "File '%s' does not exist, or is not accessible.", webfilename);
+         return 404;
+     }
+-
++#if 0
+     // check if the file is owned by expected user
+     if(stat.st_uid != web_files_uid()) {
+         error("%llu: File '%s' is owned by user %u (expected user %u). Access Denied.", w->id, webfilename, stat.st_uid, web_files_uid());
+@@ -345,7 +345,7 @@
+         buffer_sprintf(w->response.data, "Access to file '%s' is not permitted.", webfilename);
+         return 403;
+     }
+-
++#endif
+     if((stat.st_mode & S_IFMT) == S_IFDIR) {
+         snprintfz(webfilename, FILENAME_MAX, "%s/index.html", filename);
+         return mysendfile(w, webfilename);