From a1e04db6db2acb465d08f5d722322aadb5e30498 Mon Sep 17 00:00:00 2001 From: mvoelkel Date: Thu, 3 Sep 2015 14:32:02 +0200 Subject: [PATCH] password protection (currently disabled) Added files and changes required for password protection --- octoserve/var/www/e401.html | 41 ++++++++++++++++++ octoserve/var/www/setpasswd.lua | 52 +++++++++++++++++++++++ octoserve/var/www/system.html | 62 ++++++++++++++++++++++++---- octoserve/var/www/systemsettings.lua | 5 +-- 4 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 octoserve/var/www/e401.html create mode 100644 octoserve/var/www/setpasswd.lua diff --git a/octoserve/var/www/e401.html b/octoserve/var/www/e401.html new file mode 100644 index 0000000..9969bc6 --- /dev/null +++ b/octoserve/var/www/e401.html @@ -0,0 +1,41 @@ + + + + +OctopusNet + + + + + + + + + + + + + + + + + + + + + + + +
+ DD +
 
+
+ +

401: admin login required

+ +
+
 
+ + + diff --git a/octoserve/var/www/setpasswd.lua b/octoserve/var/www/setpasswd.lua new file mode 100644 index 0000000..524636d --- /dev/null +++ b/octoserve/var/www/setpasswd.lua @@ -0,0 +1,52 @@ +#!/usr/bin/lua + +local host = os.getenv("HTTP_HOST") +local proto = os.getenv("SERVER_PROTOCOL") +local query = os.getenv("QUERY_STRING") +local method = os.getenv("REQUEST_METHOD") +local clength = os.getenv("CONTENT_LENGTH") +local ctype = os.getenv("CONTENT_TYPE") + +function http_print(s) + if s then + io.stdout:write(tostring(s).."\r\n") + else + io.stdout:write("\r\n") + end +end + +if #arg> 0 then + method="GET" + query="admin" + proto = "HTTP/1.0" +end + +function SendError(err,desc) + http_print(proto.." "..err) + http_print() + local file = io.open("e404.html") + if file then + local tmp = file:read("*a") + tmp = string.gsub(tmp,"404 Not Found",err .. " " .. desc) + http_print(tmp) + file:close() + end +end + + +if method == "GET" then + file = io.open("/tmp/pw","w") + if file then + file:write(query.."\n") + file:write(query.."\n") + file:close() + os.execute('passwd admin /dev/null'); + os.execute('rm -f /tmp/pw >/dev/null'); + end + http_print(proto.." 204") + http_print() + return + +else + SendError("500","What") +end diff --git a/octoserve/var/www/system.html b/octoserve/var/www/system.html index 53a1949..2d21339 100644 --- a/octoserve/var/www/system.html +++ b/octoserve/var/www/system.html @@ -56,6 +56,21 @@ function Change() document.getElementById("SetButton").disabled = false; } +function SetPassword() +{ + pwd1 = document.getElementById("pwd1").value; + pwd2 = document.getElementById("pwd2").value; + if( pwd1 != pwd2 ) + { + document.getElementById("pwd1").value = ""; + document.getElementById("pwd2").value = ""; + document.getElementById("PwdError").style = "color:#F02000"; + return 0; + } + document.getElementById("PwdError").style = "color:#FFFFFF"; + location.replace('/setpasswd.lua?'+pwd1); +} + @@ -83,7 +98,7 @@ function Change() See note below - + Telnet @@ -93,7 +108,7 @@ function Change() Enable it at your own risk - + NODMS @@ -103,9 +118,9 @@ function Change() Disable DMS announcement. - + - + NODVBT
@@ -113,9 +128,9 @@ function Change()
Disable DVBT announcement. - + - + No DVB switch
@@ -123,7 +138,7 @@ function Change()
Disable DVB switch emulation on S8. - + @@ -137,6 +152,39 @@ function Change() +
+

Layer 2 Quality of Service

This is defined in the IEEE 802.1Q VLAN standard, and provides QoS in a local network.
diff --git a/octoserve/var/www/systemsettings.lua b/octoserve/var/www/systemsettings.lua index 96b65f3..3467a14 100644 --- a/octoserve/var/www/systemsettings.lua +++ b/octoserve/var/www/systemsettings.lua @@ -74,11 +74,8 @@ if query ~= "" then os.rename("/etc/securetty","/etc/securetty.bak"); -- temp fix to allow root login on telnet os.execute("/etc/init.d/S91telnet restart") end --- if name == "vlan" then os.execute("/etc/init.d/S99octo restartoctonet&") end --- if name == "nodms" then os.execute("/etc/init.d/S99octo restartoctonet&") end --- if name == "nodvbt" then os.execute("/etc/init.d/S99octo restartoctonet&") end if name == "vlan" then restart = 1 end - if name == "nodms" then restart = 1 end + if name == "nodms" then restart = 1 end if name == "nodvbt" then restart = 1 end if name == "noswitch" then restart = 1 end nextloc = "wait.html?5"