Commit graph

120 commits

Author SHA1 Message Date
Jo-Philipp Wich
e1932592c3 luci-base: use different cookie names for HTTP and HTTPS
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-07-08 15:38:53 +02:00
Jo-Philipp Wich
111c551cdb luci-base: fix DSL feature detection
On boards with ADSL instead of VDSL support we need to expect an
`/sbin/dsl_cpe_control` instead of an `/sbin/vdsl_cpe_control` executable.

Ref: https://forum.openwrt.org/t/dsl-line-stats/126580
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-05-03 14:55:00 +02:00
Jo-Philipp Wich
7110635134 luci-base: ucitrack: fix broken affects logic
Changes on a given configuration should trigger change events on affected
configurations, not the other way around.

Fixes: #5745
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-03-30 14:12:38 +02:00
Jo-Philipp Wich
22e2bfb096 luci-base: explicitly invoke busybox applet for password change
Ensure to invoke the Busybox `passwd` applet to change the system password
in a non-interactive manner. Non-Busybox variants may not take the new
password input from stdin or use password hashes which are not supported
by musl's `crypt()` implementation by default.

Fixes: #5629
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-01-25 22:56:56 +01:00
Jo-Philipp Wich
613080fbc9 luci-base: fix ubus luci.getConntrackHelpers call with firewall4
Fallback to firewall4's helper list if the fw3 one cannot be loaded.
Fixes broken zone configuration when firewall4 is installed as backend.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-01-22 00:28:50 +01:00
Jo-Philipp Wich
705d46b1a6 luci-base: properly detect flow offloading capabilities with nftables
When the system is running with nftables instead of iptables, the
proprietary XT_FLOWOFFLOAD module will not be present, query the nft
equivalent instead.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-01-20 13:57:15 +01:00
Stijn Tintel
48599d8d1d luci-app-firewall: initial firewall4 compatibility
Initial changes required for firewall4 compatibility:
* depend on uc-firewall instead of firewall
* detect installed version of firewall and hide incompatible features

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Reviewed-by: Jo-Philipp Wich <jo@mein.io>
2022-01-06 15:03:57 +02:00
Jo-Philipp Wich
50af81193c luci-base: apply Browser/OS dark mode preference to index redirect page
Turn white body, black link into black body, white link if the Browser/OS
indicates dark mode preference.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-11-16 13:06:03 +01:00
Jo-Philipp Wich
d513f1461f luci-base: add "dsl" system feature
Allows LuCI views to probe DSL presence using `L.hasSystemFeature('dsl')`.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-10-28 14:43:29 +02:00
Jo-Philipp Wich
e4d24f07c9 luci-base: dispatcher: rework dispatching and menu filtering logic
- 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-11 20:38:04 +02:00
Hannu Nyman
ccdca27a72 luci-base: remove deprecated radvd from ucitrack
Cleanup /etc/config/ucitrack by removing 'radvd' affect item
from network, as the radvd package has deprecated by odhcpd
and odhcp6c in 2014.

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2021-02-13 12:20:57 +02:00
Dobroslaw Kijowski
ab01040663 luci-mod-network: skip check for 802.11w feature
OpenWrt commit 1a9b896d ("treewide: nuke DRIVER_11W_SUPPORT") enables
802.11w feature for all wpad/hostapd configurations. The feature flag
was removed at all but for the compatibility reasons 11w is still
advertised (but there's a plan to nuke it also) [1].

Remove conditional 802.11w LuCI support to match current behavior.

[1]: https://github.com/openwrt/openwrt/pull/3347

Signed-off-by: Dobroslaw Kijowski <dobo90@gmail.com>
2021-01-02 14:59:25 +02:00
Martin Böh
6e4e1321a2 luci-base: fix syntax error in hostapd features
Signed-off-by: Martin Böh <mart.b@outlook.de>
2020-10-31 21:07:16 +01:00
Ansuel Smith
681d38db31
luci-base: check support for hostapd wps
Check if hostapd supports wps pushbutton features.
(wps is now supported by ubus instead of using hostapd_cli)

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-10-11 01:32:21 +02:00
Nicolas Thumann
c4b617a7a6
luci-base: Fixed delayed portstatus loading on R7800
Signed-off-by: Nicolas Thumann <me@n-thumann.de>
2020-08-02 20:08:20 +02:00
Jo-Philipp Wich
84a0b6845f
Merge pull request #4127 from blocktrron/luci-wep-features
luci-mod-network: query WEP support
2020-06-16 17:01:27 +02:00
Florian Eckert
c6742ebdb8 luci-base: move vpn section
Move the VPN configuration section behind the network configuration. The normal
workflow is add/edit the network and then add/edit a vpn configuration.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
2020-06-16 11:34:04 +02:00
Jo-Philipp Wich
05f07e55b7 luci-base: grant uci rename permissions
When doing an initial wireless configuration migration, LuCI needs to
perform a series of rename calls which weren't allowed so far.

Ref: https://forum.openwrt.org/t/config-migration-endless-loop/64340
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-06-02 17:09:50 +02:00
David Bauer
57ad80a02d luci-base: add queryable WEP WiFi feature
This commit adds WEP as a queryable WiFi feature.

Support for the deprecated WEP encryption is not
compiled-in to hostapd or wpa_supplicant by default
anymore.

Allow LuCi to query the availability of WEP to remove
it from the list of avialable encryption methods in case
hostapd / wpa_supplicant are compiled without it.

Signed-off-by: David Bauer <mail@david-bauer.net>
2020-06-01 08:20:44 +02:00
Jo-Philipp Wich
f44ba4811d luci-base: make logout link depend on luci-base ACL
Fixes: #3966
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-25 13:52:15 +02:00
Jo-Philipp Wich
71e22c1c34 luci-base: fix trainling comma in ACL specification
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-17 16:26:46 +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
c099344013 treewide: reorganize base ACLs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-04-09 23:23:33 +02:00
Jo-Philipp Wich
5fe88f8caf
Merge pull request #3769 from dibdot/logread-fix
luci-base: accept alternative logread location
2020-04-08 09:19:09 +02:00
Jo-Philipp Wich
e331e32b2c
Merge pull request #3749 from Ansuel/fix_relayd
luci-base: fix error 404 on missing relay protocol
2020-04-08 09:15:38 +02:00
jjm2473
97780a9ce1 ucitrack: fix bug for exec with params
In file `/etc/config/ucitrack`
```
config fstab
        option exec '/sbin/block mount'
```
`/sbin/block mount` never be called after fstab changed.

Signed-off-by: jjm2473 <1129525450@qq.com>
2020-03-23 01:05:31 +08:00
Dirk Brenken
085f3f7809
luci-base: accept alternative logread location
* minimal change to accept the usual logread location
  plus the alternative location (/usr/sbin/logread)
  used by syslog-ng (see openwrt/packages/issues/11535 for reference)

Signed-off-by: Dirk Brenken <dev@brenken.org>
2020-03-20 16:11:31 +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
Ansuel Smith
d8e1aef150
luci-base: add relayd to getFeature list
Add /sbin/block to the generic Feature list to make
it easily accessible by getProtocolHandlers

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-03-12 16:40:25 +01:00
Jo-Philipp Wich
81cf99a507 luci-base: extend rollback timeout to 90 seconds
Ref: #3628
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-13 19:26:33 +01:00
Jo-Philipp Wich
6d59a6400e luci-base: make swconfig port state parsing more robust
Since swconfig output varies wildly among different switch drivers, rely
on a simpler more robust parsing approach to find the required information.

Ref: https://forum.openwrt.org/t/cannot-read-property-link/50766
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-28 18:16:44 +01:00
Jo-Philipp Wich
8978aaf6b6 luci-base: allow loading translations when not authenticated
Fixes: #3563
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-01-25 23:28:56 +01:00
Jo-Philipp Wich
679e59f4f3
Merge pull request #3522 from swg0101/systemcert
luci-base/mod-network: corrections to previous commit
2020-01-17 08:26:46 +01:00
David Lam
cbb1c3cf93
luci-base: correct rpcd bad access mode
Corrects the bad access mode from a previous commit that did not allow rpcd luci to execute.

Signed-off-by: David Lam <david@thedavid.net>
2020-01-16 14:49:42 -08:00
Jo-Philipp Wich
b65588ebc6
Merge pull request #3511 from Ansuel/no-hard
luci-base: remove hardcoded cgi-bin path
2020-01-16 15:36:05 +01:00
Jo-Philipp Wich
f545b29aaf
Merge pull request #3517 from Ansuel/ubus_short
luci-base: make rpc webserver path configurable
2020-01-16 15:33:25 +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
Ansuel Smith
5e6ec8562f
luci-base: remove hardcoded cgi-bin path
Currently LuCI can be loaded only when placed in the root of the server as the cgi-bin path are hardcoded. Change the index.html to load the cgi-bin path from the current level.
Also add a new entry in the env Object to make the cgi_base path easily accessible.
This variable will be based on the position of /cgi-bin/luci.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2020-01-16 15:02:14 +01:00
David Lam
27b21c2a62
luci-base: add system cert bundle detection
Add detection mechanism for system cert CA bundle installed by the
ca-bundle package. Used by LuCI to detect whether the "Use system
certificates" certificate validation option should be enabled.

Signed-off-by: David Lam <david@thedavid.net>
2020-01-16 01:15:40 -08:00
Jo-Philipp Wich
16d049f7cd luci-mod-status: reimplement route status page as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-29 23:03:58 +01:00
Jo-Philipp Wich
939b371bc7 luci-mod-status: reimplement log pages as client side views
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-22 23:20:23 +01:00
Jo-Philipp Wich
b9bb34612e luci-mod-status: reimplement iptables status page as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-22 23:20:23 +01:00
Jo-Philipp Wich
43a4481e10 luci-mod-status: replace iptables controller actions with cgi-io calls
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-22 23:20:23 +01:00
Jo-Philipp Wich
3a657b8ab5 luci-mod-network: replace controller address check action with cgi-io script
This change removes the last bit of Lua code from luci-mod-network.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-18 21:33:29 +01:00
Jo-Philipp Wich
ab07b8c4d9 luci-mod-network: reimplement diagnostics page as client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-16 18:07:18 +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
392ba53eff luci-base, luci-mod-network: migrate getDUIDHints method to C plugin
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-08 10:25:30 +01:00
Jo-Philipp Wich
9e57fbb2c3 luci-base, luci-app-firewall: port custom rules to client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:34:57 +01:00
Jo-Philipp Wich
a43b1c6468 luci-base, luci-mod-status: convert process status to client side view
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:07:58 +01:00
Jo-Philipp Wich
8d512f13ec luci-base: add luci/getProcessList RPC method
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 20:03:25 +01:00