From efc958fbf85755a400bb6ad321dd1ad2f50f2bb6 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 06:13:25 +0100 Subject: [PATCH 1/6] gluon-luci-admin: disable when not in configmode For security reasons we'd like to disable all HTTP config interfaces when the node is operating normally. This patch disables gluon-luci-admin when configmode is not enabled. --- .../files/usr/lib/lua/luci/controller/admin/index.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 8e91fd6d..1bf4d155 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -19,6 +19,11 @@ function index() local uci_state = luci.model.uci.cursor_state() local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" + -- Disable gluon-luci-admin when configmode is not enabled + if not configmode then + return + end + local root = node() if not root.lock then root.target = alias("admin") From d85214d4c511e0644064eeda44593fa8d0825cb6 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 06:16:19 +0100 Subject: [PATCH 2/6] gluon-luci-admin: fix indentation Replaces double-spaces with tabs to match surrounding code. --- .../lib/lua/luci/controller/admin/index.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 1bf4d155..13d9d83e 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -16,8 +16,8 @@ $Id$ module("luci.controller.admin.index", package.seeall) function index() - local uci_state = luci.model.uci.cursor_state() - local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" + local uci_state = luci.model.uci.cursor_state() + local configmode = uci_state:get_first("gluon-config-mode", "wizard", "running", "0") == "1" -- Disable gluon-luci-admin when configmode is not enabled if not configmode then @@ -30,14 +30,14 @@ function index() root.index = true end - local page = entry({"admin"}, alias("admin", "index"), _("Expertmode"), 10) + local page = entry({"admin"}, alias("admin", "index"), _("Expertmode"), 10) page.sysauth = "root" - if configmode then - -- force root to be logged in when running in configmode - page.sysauth_authenticator = function() return "root" end - else - page.sysauth_authenticator = "htmlauth" - end + if configmode then + -- force root to be logged in when running in configmode + page.sysauth_authenticator = function() return "root" end + else + page.sysauth_authenticator = "htmlauth" + end page.index = true entry({"admin", "index"}, form("admin/index"), _("Overview"), 1).ignoreindex = true From 78f5efa7ce64c1d7a991a00cdfc50faf5a68beca Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Tue, 21 Jan 2014 23:06:32 +0100 Subject: [PATCH 3/6] gluon-luci-admin: no logout button in configmode Hide the "logout" button when in configmode. --- .../files/usr/lib/lua/luci/controller/admin/index.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua index 13d9d83e..fb5000af 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/controller/admin/index.lua @@ -41,7 +41,10 @@ function index() page.index = true entry({"admin", "index"}, form("admin/index"), _("Overview"), 1).ignoreindex = true - entry({"admin", "logout"}, call("action_logout"), _("Logout")) + + if not configmode then + entry({"admin", "logout"}, call("action_logout"), _("Logout")) + end end function action_logout() From dd7934a39afec3aaf826c3d5f19cf87b58eb7e64 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:44:29 +0100 Subject: [PATCH 4/6] gluon-luci-admin: remove redundant headings --- .../files/usr/lib/lua/luci/view/admin/backup.htm | 3 +-- .../files/usr/lib/lua/luci/view/admin/reboot.htm | 3 +-- .../files/usr/lib/lua/luci/view/admin/upgrade.htm | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm index eb9dc46e..167419da 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/backup.htm @@ -13,8 +13,7 @@ $Id$ -%> <%+header%> -

<%:System%>

-

<%:Backup / Restore%>

+

<%:Backup / Restore%>

<%:Here you can backup and restore your configuration and - if possible - reset this device to the default settings.%>


diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm index 9e57d89f..5e671471 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm @@ -13,8 +13,7 @@ $Id$ -%> <%+header%> -

<%:System%>

-

<%:Reboot%>

+

<%:Reboot%>

<%:Reboots the operating system of your device%>

<%- local c = require("luci.model.uci").cursor():changes() diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm index 1083a161..3d75b415 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/upgrade.htm @@ -15,8 +15,7 @@ $Id$ <%+header%> -

<%:System%>

-

<%:Flash Firmware%>

+

<%:Flash Firmware%>

<% if step == 1 then %> <% if supported then %> From 8d62f92a4d2540cf43bcc936bd514bb8bf9a418f Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:45:30 +0100 Subject: [PATCH 5/6] gluon-luci-admin: replace overview text This completely replaces the text on the overview page. Consider this a placeholder until someone writes a better suited version :) --- .../usr/lib/lua/luci/view/admin/index.htm | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm index c14d3b0b..c1656a7e 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/index.htm @@ -1,21 +1,5 @@ -<%# -LuCI - Lua Configuration Interface -Copyright 2008 Steven Barth -Copyright 2008 Jo-Philipp Wich - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -$Id$ - --%>

<%:Hello!%>

-

<%_This is the administration area of LuCI.%>

-

<%_LuCI is a free, flexible, and user friendly graphical interface for configuring OpenWrt.%>
-<%:On the following pages you can adjust all important settings of this device.%>

-

<%:As we always want to improve this interface we are looking forward to your feedback and suggestions.%>

-

<%:And now have fun with your OpenWrt device!%>

-

<%_The LuCI Team%>

+

Dies ist der Experten-Modus deines Freifunkknotens.

+

Hier kannst du weitere Einstellungen vornehmen, Firmware Upates + einspielen und auch vieles kaputt machen.

+

Sei bitte vorsichtig!

From c7efde1acfc612d95e8d85ead7a31a3554c01ec1 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Wed, 22 Jan 2014 16:47:13 +0100 Subject: [PATCH 6/6] gluon-luci-admin: reboot.html, remove refresh Don't refresh the reboot page after rebooting the node. It's not going back to configmode anyway so it'll never reload without user intervention. --- .../files/usr/lib/lua/luci/view/admin/reboot.htm | 1 - 1 file changed, 1 deletion(-) diff --git a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm index 5e671471..91699e3a 100644 --- a/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm +++ b/package/gluon-luci-admin/files/usr/lib/lua/luci/view/admin/reboot.htm @@ -27,6 +27,5 @@ if not reboot then

<%:Perform reboot%>

<%- else -%>

<%:Please wait: Device rebooting...%>

- <%- end -%> <%+footer%> \ No newline at end of file