-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission problem with luci-base.json when build-system uses "umask 0022" #1521
Comments
I am unable to verify this problem here.
Ran it on a target device:
|
You probably swapped your with/without error cases. Builds with The problem you raise here is not specific to LuCI and will affect a lot of other packages as well so I am not sure if it makes sense to add workarounds or checks to address this specific arbitrary case. |
Oops, indeed I swapped those values. |
For now we only want to ensure that the group permission mask is permissive enough to not clobber required permissions on the rootfs, so allow less strict masks as well. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
The openwrt files fetched via "git" already need the correct permissions. openwrt/luci#1521 freifunk-berlin#431
If the openwrt files are fetched using "git" on systems with "umask 002", they get checked out with group-writable permission. This finally leads to a "500 internal server error" when accessing luci pages, because of wrong permissions of /usr/share/acl.d/luci-base.json. See OpenWrt: "Builds with umask != 022 are known to be broken": openwrt/luci#1521 (comment) Bugreport and details, how these wrong permissions end up in the image: freifunk-berlin#431
This needs to be solved in OpenWrt buildroot and/or the host system. |
If the openwrt files are fetched using "git" on systems with "umask 002", they get checked out with group-writable permission. This finally leads to a "500 internal server error" when accessing luci pages, because of wrong permissions of /usr/share/acl.d/luci-base.json. See OpenWrt: "Builds with umask != 022 are known to be broken": openwrt/luci#1521 (comment) Bugreport and details, how these wrong permissions end up in the image: #431
If the openwrt files are fetched using "git" on systems with "umask 002", they get checked out with group-writable permission. This finally leads to a "500 internal server error" when accessing luci pages, because of wrong permissions of /usr/share/acl.d/luci-base.json. See OpenWrt: "Builds with umask != 022 are known to be broken": openwrt/luci#1521 (comment) Bugreport and details, how these wrong permissions end up in the image: #431 cherry-pick from master (47eedf5)
If the openwrt files are fetched using "git" on systems with "umask 002", they get checked out with group-writable permission. This finally leads to a "500 internal server error" when accessing luci pages, because of wrong permissions of /usr/share/acl.d/luci-base.json. See OpenWrt: "Builds with umask != 022 are known to be broken": openwrt/luci#1521 (comment) Bugreport and details, how these wrong permissions end up in the image: #431 cherry-pick from master (47eedf5)
If the openwrt files are fetched using "git" on systems with "umask 002", they get checked out with group-writable permission. This finally leads to a "500 internal server error" when accessing luci pages, because of wrong permissions of /usr/share/acl.d/luci-base.json. See OpenWrt: "Builds with umask != 022 are known to be broken": openwrt/luci#1521 (comment) Bugreport and details, how these wrong permissions end up in the image: #431 cherry-pick from master (47eedf5)
Targets: System independent (seen on raspberry pi3, gl-ar150 and wr842)
Version: git-head (probably in earlier versions as well)
Module: luci-base
See also here: freifunk-berlin/firmware#431
When building luci-base on a system with a default umask 0022, luci will not be usable for non-root users in the resulting image (non-root access is enabled e.g. in the freifunk package).
For non-root users, it will just display a "500 internal server error", because ubusd requires the file "/usr/share/acl.d/luci-base.json"[1] to be not group-readable[2]. As a result, access to ubus/system/board will not be allowed, leading to a NIL value for the boardinfo object in "/usr/lib/lua/luci/view/themes/bootstrap/header.htm"[3], what causes a crash, when trying to access its "hostname"[4] property.
The reason is, that the "install" section in "luci.mk"[5] does not set the required permission - it just copies the directories, retaining the permissions, that the files have from "git clone". If you are lucky to be compiling on a host with a "umask 0002" setting, the luci-base.json will have rw-r--r-- permission and everything works fine. On a system with "umask 0022" (this is nothing unusual), it will have rw-rw-r-- permissions after the checkout, resulting in a non-usable luci in the final image.
As a workaround, one can issue "umask 0002" before "git clone"ing. To really solve it, luci.mk may use "chmod" or "$(INSTALL_DATA)" on this file to ensure, the file gets installed with the correct permissions.
How to reproduce:
(Please note, that the Freifunk-module is only used to easily demonstrate the consequences of this issue. The output from restarting ubusd shows, that the permission problem already exists in a vanilla luci-base installation).
[1] affected file "/usr/share/acl.d/luci-base.json"
https://github.com/openwrt/luci/tree/master/modules/luci-base/root/usr/share/acl.d
[2] permission check in ubusd
https://git.lede-project.org/?p=project/ubus.git;a=blob;f=ubusd_acl.c;h=4b72663d25aa983cb65b10fae8ba029b099c7c45;hb=HEAD#l406
[3] NIL value for boardinfo = util.ubus("system", "board")
https://github.com/openwrt/luci/blob/master/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm#L14
[4] crash accessing boardinfo.hostname
https://github.com/openwrt/luci/blob/master/themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm#L162
[5] "install" section from luci.mk
https://github.com/openwrt/luci/blob/master/luci.mk#L169
The text was updated successfully, but these errors were encountered: