summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base/luasrc
AgeCommit message (Collapse)Author
2022-07-08luci-base: use different cookie names for HTTP and HTTPSJo-Philipp Wich
Since HTTP cookies may not overwrite HTTPS ("secure") ones, users are frequently unable to log into LuCI when a stale, "secure" `sysauth` cookie is still present in the browser as it commonly happens after e.g. a sysupgrade operation or when frequently jumping between HTTP and HTTPS access. Rework the dispatcher to set either a `sysauth_http` or `sysauth_https` cookie, depending on the HTTPS state of the server connection and accept both cookie names when verifying the session ID. This allows users to log into a HTTP-only LuCI instance while a stale, "secure" HTTPS cookie is still present. Requires commit 2b0539ef9d ("lucihttp: update to latest Git HEAD") to function properly. Fixes: #5843 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-04-29luci-base: sys.lua: fix parsing conntrack entries without timeoutJo-Philipp Wich
Flow offloaded conntrack entries carry no timeout value and trip up the record parsing routine. Adjust the code to properly deal with such entries. Ref: https://forum.openwrt.org/t/offloading-breaks-connections-list/126423 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-04-27luci-base: dispatcher.lua: support "absent" fs dependency for menu nodesJo-Philipp Wich
The "absent" dependency type requires the given path to not exist on the local system for the condition to be satisified. This is useful to disable menu nodes depending on the presence of specific files. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-03-24timezone data: update to 2022aHannu Nyman
Update timezone data to 2022a. http://mm.icann.org/pipermail/tz-announce/2022-March/000070.html * Palestine will spring forward on 2022-03-27, not 2022-03-26. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2022-01-19luci-base: sys: prevent path traversal via sys.init routinesJo-Philipp Wich
Filter the init script name parameter through fs.basename() to avoid invoking paths outside of /etc/init.d/. Reported-by: Graham R <gr348@cam.ac.uk> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-10-28timezone data: update to 2021eHannu Nyman
Update timezone data to 2021e. http://mm.icann.org/pipermail/tz-announce/2021-September/000066.html * Jordan now starts DST on February's last Thursday. * Samoa no longer observes DST. * Rename Pacific/Enderbury to Pacific/Kanton. http://mm.icann.org/pipermail/tz-announce/2021-October/000068.html * Fiji will suspend observance of DST for the 2021/2022 season. http://mm.icann.org/pipermail/tz-announce/2021-October/000069.html * Palestine will fall back 10-29 (not 10-30) Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-10-11luci-base: dispatcher: rework dispatching and menu filtering logicJo-Philipp Wich
- Prefer nodes that do not require authentication over nodes that do - Honour ACL dependencies while resolving firstchild nodes - Consider currently active session while scanning menu tree instead of only loading effective ACLs when a login node is encountered - Do not consider nodes for firstchild dispatching which specify a special "firstchild_ineligible" property - Hide menu nodes that have no accessible children Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-10-11luci-base: sysauth.htm: switch https detection URLJo-Philipp Wich
The `up.gif` icon is not present by default anymore, it has been moved to luci-compat. Probe loading.gif instead which is guaranteed to be available by default. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-10-11luci-base: dispatcher: fix null access on dispatching unknown urlsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-04-30luci-base: send failed/successfull login to syslogJan Pavlinec
Note: This change is relevant for systems that don't use uhttpd for LuCI. This log can be later used for fail2ban etc. Signed-off-by: Jan Pavlinec <jan.pavlinec@nic.cz>
2021-03-01luci-base: remove references to removed functions from documentationJo-Philipp Wich
Fixes: #4778 Fixes: 366707a68 ("luci-base: drop unused functions in luci.sys") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-01-29timezone data: update to 2021aHannu Nyman
Update timezone data to 2021a. http://mm.icann.org/pipermail/tz-announce/2021-January/000065.html * South Sudan changes from +03 to +02 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-01-20treewide: removed trailing whitespaces and extra newlines in 'modules'Giovanni Giacobbi
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-20treewide: minor fixes to typos, whitespace, and indentationGiovanni Giacobbi
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-09timezone data: update to 2020fHannu Nyman
Update timezone data to 2020f. 2020e: http://mm.icann.org/pipermail/tz-announce/2020-December/000063.html Volgograd switches to Moscow time. Australia/Currie removed as identical to Australia/Hobart 2020f: http://mm.icann.org/pipermail/tz-announce/2020-December/000064.html Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-12-04luci-base: hide "No password set!" notification if password login is disabledFabian Bläse
The special characters '!' and '*' in /etc/shadow are used to disable password login for a specific account. The character 'x' has no special meaning, but should not be interpreted as an empty password. However, Luci treats the special characters '!' and 'x' like no password is set and displays the "No password set!" notification. As this might be misleading, the extra check for these special characters is removed, so the invalid hash is returned in that case. This aligns the behavior of this notification with a change in rpcd, which also removed these extra checks, so no login is possible, if password login is disabled [1]. [1] https://git.openwrt.org/?p=project/rpcd.git;a=commit;h=3df62bcebd2caff47506ccffb42df8d2d2123c06 Signed-off-by: Fabian Bläse <fabian@blaese.de>
2020-10-31timezone data: update to 2020dHannu Nyman
Update timezone data to 2020d 2020b: http://mm.icann.org/pipermail/tz-announce/2020-October/000059.html Macquarie Island has stayed in sync with Tasmania since 2011. Casey, Antarctica is at +08 in winter and +11 in summer. 2020c: http://mm.icann.org/pipermail/tz-announce/2020-October/000060.html 2020d: http://mm.icann.org/pipermail/tz-announce/2020-October/000062.html Palestine ends DST earlier than predicted, on 2020-10-24. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-10-21luci-base: set the fallback default of rollback timeout to 90sHannu Nyman
Set the fallback value of the config change rollback timeout to 90 seconds to match the change in /etc/config/luci by commit 81cf99a50. That commit changed the value in the config file, but did not change the underlying fallback values that do get applied when there is no proper config item in etc/config/luci. Users sysupgrading from old systems may have carried an ancient /etc/config/luci (without rollback config) with them, so this change should help them to see the intended user experience. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-09-19luci-base: tweak busybox top regex to accept 'm' in large VSZHannu Nyman
Tweak the lua regex string for process list, so that processes with extremely large memory sizes (over 100 MB) are matched. For those large processes busybox top shows a MB value like '234m' instead of a normal kB value like 234000. Fixes #4425 Reference to https://github.com/openwrt/luci/issues/4425#issuecomment-694073479 Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-08-31Merge pull request #4239 from etactica/error404-messagesFlorian Eckert
luci-base: dispatcher: error404: flow message into template
2020-07-19treewide: adapt to new luci.xml classSven Roederer
In the previous commit the luci.xml module was created, Let's change all references to the old functions to the new xml-module. Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
2020-07-19luci-base(-libs): move pcdata() and striptags() from util- to xml-classSven Roederer
To complete the previous commit these functions are defined in the resulting luci-base package but are also used in the new luci-base-libs package. So move them into the new xml-module of the new package. Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
2020-07-19luci-base: move some generic classes into a separate luci-base-libs packageSven Roederer
The new package luci-base-libs provides the modules that not strictly relate to the web-interface of luci. By separating these libs they can be used by other packages without having to install the web-components. This change was inspired by providing a shell-only interface for 4MB-flash devices, by keeping as much code common with a full install. Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
2020-07-07error404: flow message into templateKarl Palsson
message was only being shown in the plain text case when the render failed. Signed-off-by: Karl Palsson <karlp@etactica.com>
2020-06-30luci-base: allow themes to provide sysauth.htmKarl Palsson
Support for sysauth_template was (inadvertently) dropped in refactorings to support the json menu construction. This does not restore that functionality, which allowed different templates for every node in the dispatcher tree, but provides an alternative mechanism that allows a theme to provide a sysauth.htm template file instead. Tested-by: Karl Palsson <karlp@etactica.com> Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-06-19luci-base: template.lua: fix nil access in string template error handlingJo-Philipp Wich
Template strings have no associated name, which led to an attempt to concat nil with a string when formatting the error message in case of exceptions. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-14luci-base: dispatcher.lua: improve bytecode cache invalidationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-09timezone data: update to 2020aHannu Nyman
Update timezone data to 2020a http://mm.icann.org/pipermail/tz-announce/2020-April/000058.html 2020a: Morocco springs forward on 2020-05-31, not 2020-05-24. Canada's Yukon advanced to -07 year-round on 2020-03-08. America/Nuuk renamed from America/Godthab. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2020-04-20luci-base: dispatcher.lua: pass permission state to legacy CBI templatesJo-Philipp Wich
Ref: https://github.com/openwrt/luci/issues/3937 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-19luci-base: dispatcher.lua: honour acl_depends annotations in Lua controllersJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16luci-base: implement JSON endpoint to fetch menu informationJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16luci-base: expose currently dispatched node info to client side JSJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16luci-base: dispatcher.lua: add support for handling menu ACL annotationsJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-12luci-base: luci.js: add LuCI.fspath() helperJo-Philipp Wich
The LuCI.fspath() function allows constructing absolute filesystem paths from path segments relative to the document root. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-10luci-base: uhttpd.lua: expose all CGI variablesJo-Philipp Wich
Fixes: #3873 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-03luci-base: ui.js: add instantiateView() helperJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-26luci-base: add missing .btn CSS classes to sysauth templateJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-13luci-base: ensure that ubus path uses trailing slashJo-Philipp Wich
Without the trailing slash, probing endpoint availability will fail. Fixes: 529bde440 ("luci-base: make rpc webserver path configurable") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-18luci-base: Add missed config parameter for cbi when converting to JSONAnton Kikin
The cbi() function has a second argument 'config' in which various configuration parameters can be passed. When converting the lua menu to JSON, we must also convert this parameter. Signed-off-by: Anton Kikin <a.kikin@tano-systems.com>
2020-02-05luci-base: dispatcher.lua: remove redundant check_fs_depends() callJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-30luci-base: dispatcher.lua: fix filesystem dependency checksJo-Philipp Wich
A variable clash led to declarative `fs` dependencies being ineffective. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-29luci-base: add another magic security attribute to the sysauth cookieJo-Philipp Wich
Fixes: #3585 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-28luci-base: add L.media() URL construction helperJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-16luci-base: make rpc webserver path configurableAnsuel Smith
Currently the ubus path that provide the webserver is hardcoded to be /ubus. Change this to make it configurable from the luci config file. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-01-10luci-base: dispatcher: remove empty firstchild nodes from menuJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-07luci-base: dispatcher: fix rpc controller regressionJo-Philipp Wich
When testing the luci-rpc authnetication, avoid clobbering the HTTP post request body. Fixes: #3470 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30luci-base: move tools.webadmin to luci-compatJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30luci-base: drop unused tools.webadmin.proto classJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16luci-base: convert menu nodes to JSONJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16luci-base: dispatcher.lua: add support for loading JSON menu filesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>