Commit graph

423 commits

Author SHA1 Message Date
Jan Pavlinec
be8d749599
luci-base: send failed/successfull login to syslog
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-04-30 13:46:50 +02:00
Jo-Philipp Wich
a9da1dc5a5 luci-base: remove references to removed functions from documentation
Fixes: #4778
Fixes: 366707a68 ("luci-base: drop unused functions in luci.sys")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-01 09:17:04 +01:00
Hannu Nyman
af1f961589 timezone data: update to 2021a
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-29 20:52:48 +02:00
Giovanni Giacobbi
af422b1924 treewide: removed trailing whitespaces and extra newlines in 'modules'
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-20 17:48:16 +02:00
Giovanni Giacobbi
d3280e6f5d treewide: minor fixes to typos, whitespace, and indentation
Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
2021-01-20 12:36:13 +02:00
Hannu Nyman
9e4391e3a6 timezone data: update to 2020f
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>
2021-01-09 20:22:28 +02:00
Fabian Bläse
e54708a451 luci-base: hide "No password set!" notification if password login is disabled
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-12-04 21:51:13 +01:00
Hannu Nyman
ce3402a453 timezone data: update to 2020d
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-31 20:17:39 +02:00
Hannu Nyman
b0fe11ffc4 luci-base: set the fallback default of rollback timeout to 90s
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-10-21 18:47:38 +03:00
Hannu Nyman
4f2ecd88fd luci-base: tweak busybox top regex to accept 'm' in large VSZ
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-09-19 08:46:16 +03:00
Florian Eckert
4b8d4bac87
Merge pull request #4239 from etactica/error404-messages
luci-base: dispatcher: error404: flow message into template
2020-08-31 14:12:54 +02:00
Sven Roederer
354e4cb4a7 treewide: adapt to new luci.xml class
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-19 20:14:47 +02:00
Sven Roederer
68521fca04 luci-base(-libs): move pcdata() and striptags() from util- to xml-class
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-19 20:14:35 +02:00
Sven Roederer
8b8d83e42d luci-base: move some generic classes into a separate luci-base-libs package
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-19 20:14:22 +02:00
Karl Palsson
48715ba5c8 error404: flow message into template
message was only being shown in the plain text case when the render
failed.

Signed-off-by: Karl Palsson <karlp@etactica.com>
2020-07-07 15:01:03 +00:00
Karl Palsson
8f9433127e luci-base: allow themes to provide sysauth.htm
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-30 17:43:39 +02:00
Jo-Philipp Wich
c351beea56 luci-base: template.lua: fix nil access in string template error handling
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-06-19 14:51:49 +02:00
Jo-Philipp Wich
a7d1e257aa luci-base: dispatcher.lua: improve bytecode cache invalidation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-05-14 19:13:17 +02:00
Hannu Nyman
e5fe16c9ea timezone data: update to 2020a
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-05-09 09:45:05 +03:00
Jo-Philipp Wich
c48a8d5813 luci-base: dispatcher.lua: pass permission state to legacy CBI templates
Ref: https://github.com/openwrt/luci/issues/3937
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-20 09:44:14 +02:00
Jo-Philipp Wich
760763a7b5 luci-base: dispatcher.lua: honour acl_depends annotations in Lua controllers
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-19 17:17:26 +02:00
Jo-Philipp Wich
e56e442d6a luci-base: implement JSON endpoint to fetch menu information
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
94a0c57181 luci-base: expose currently dispatched node info to client side JS
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
125916f2f4 luci-base: dispatcher.lua: add support for handling menu ACL annotations
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-16 13:30:35 +02:00
Jo-Philipp Wich
fde144c9be luci-base: luci.js: add LuCI.fspath() helper
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-12 22:51:28 +02:00
Jo-Philipp Wich
465891ff02 luci-base: uhttpd.lua: expose all CGI variables
Fixes: #3873
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-10 21:03:19 +02:00
Jo-Philipp Wich
d9e9cf92d1 luci-base: ui.js: add instantiateView() helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-03 13:26:44 +02:00
Jo-Philipp Wich
9edb9336d3 luci-base: add missing .btn CSS classes to sysauth template
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-26 22:15:56 +01:00
Jo-Philipp Wich
38289bc975 luci-base: ensure that ubus path uses trailing slash
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-03-13 23:57:19 +01:00
Anton Kikin
2d8299338e luci-base: Add missed config parameter for cbi when converting to JSON
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-18 14:00:01 +03:00
Jo-Philipp Wich
08eea3f93e luci-base: dispatcher.lua: remove redundant check_fs_depends() call
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-05 17:42:58 +01:00
Jo-Philipp Wich
7cfce56553 luci-base: dispatcher.lua: fix filesystem dependency checks
A variable clash led to declarative `fs` dependencies being ineffective.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-30 12:20:05 +01:00
Jo-Philipp Wich
885c97da53 luci-base: add another magic security attribute to the sysauth cookie
Fixes: #3585
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-29 09:07:51 +01:00
Jo-Philipp Wich
b60b4790d1 luci-base: add L.media() URL construction helper
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-28 11:14:42 +01:00
Ansuel Smith
529bde4408
luci-base: make rpc webserver path configurable
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-16 15:16:09 +01:00
Jo-Philipp Wich
fd7961337f luci-base: dispatcher: remove empty firstchild nodes from menu
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-10 22:13:27 +01:00
Jo-Philipp Wich
38c9c9e0a2 luci-base: dispatcher: fix rpc controller regression
When testing the luci-rpc authnetication, avoid clobbering the HTTP
post request body.

Fixes: #3470
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-07 09:10:19 +01:00
Jo-Philipp Wich
09b2d8a8ac luci-base: move tools.webadmin to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 10:37:48 +01:00
Jo-Philipp Wich
6591b48f8e luci-base: drop unused tools.webadmin.proto class
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-30 10:37:25 +01:00
Jo-Philipp Wich
16853bcd2e luci-base: convert menu nodes to JSON
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
cf1219bd07 luci-base: dispatcher.lua: add support for loading JSON menu files
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
184ea62300 luci-base: dispatcher.lua: refactor dispatch logic
Refactor the dispatch logic to operate on the internal JSON representation
of the menu tree.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
1ec6e72106 luci-base: dispatcher.lua: factor out template class init into own function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
a6b214f873 luci-base: dispatcher.lua: factor out language check into own function
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
97f27e0d54 luci-base: expose effective dispatched path to client side environment
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
852d24061d luci-base: dispatcher.lua: introduce dispatch tree JSON conversion
Introduce a new method menu_json() which converts the current dispatch
tree into JSON structure.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:17 +01:00
Jo-Philipp Wich
d5dff8f9a5 treewide: move server side CBI support to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:49:31 +01:00
Jo-Philipp Wich
284918bfaf treewide: move templates and libraries not used by the core to luci-compat
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 17:56:58 +01:00
Jo-Philipp Wich
1b835a50aa luci-base: sys.lua: lazy-load luci.model.network
This allows using luci.sys without installed luci.model.network class.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-02 20:14:25 +01:00
Jo-Philipp Wich
790005cdfa luci-base: dispatcher.lua: support declarative node dependencies
Introduce two new properties for page nodes to allow for declaratively
specifiying system dependencies which is useful to e.g. make certain
views depend on specific uci values or the presence of certain files.

The recognized properties are:

 - `uci_depends` - a nested table in one of the following forms:

     1) `{ config = { section = { option = "exact_value" } }`
     2) `{ config = { section = { option = true } }`
     3) `{ config = { section = "exact_type" } }`
     4) `{ config = { section = true } }`
     5) `{ config = true }`

   Depending on the declaration, the uci option or section type must either
   match the given "exact_value" or "exact_type" values or be a non-nil value
   in case boolean "true" is specified.

 - `file_depends` - a flat lists of file paths that must be accessible

   If a path listed in `file_depends` points to a directory, that directory
   must be not empty, otherwise it suffices if the path exists.

Examples:

 - Only display the node if an /etc/config/wireless file exists with
   a "config wifi-device radio0" section.

    node = page(...)
    node.uci_depends = { wireless = { radio0 = "wifi-device" } }

 - Only display the node when swconfig is installed.

    node = page(...)
    node.file_depends = { "/sbin/swconfig" }

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:33 +01:00