openwrt/package
Mark Mentovai 398cbb76fa
hostapd: allow hostapd under ujail to communicate with hostapd_cli
When procd-ujail is available, 1f78538387 runs hostapd as user
"network", with only limited additional capabilities (CAP_NET_ADMIN and
CAP_NET_RAW).

hostapd_cli (CONFIG_PACKAGE_hostapd-utils) communicates with hostapd
over a named UNIX-domain socket. hostapd_cli is responsible for creating
this socket at /tmp/wpa_ctrl_$pid_$counter. Since it typically runs as
root, this endpoint is normally created with uid root, gid root, mode
0755. As a result, hostapd running as uid network is able to receive
control messages sent through this interface, but is not able to respond
to them. If debug-level logging is enabled (CONFIG_WPA_MSG_MIN_PRIORITY
<= 2 at build, and log_level <= 2 in /etc/config/wireless wifi-device),
this message will appear from hostapd:

CTRL: sendto failed: Permission denied

As a fix, hostapd_cli should create the socket node in the filesystem
with uid network, gid network, mode 0770. This borrows the presently
Android-only strategy already in hostapd intended to solve the same
problem on Android.

If procd-ujail is not available and hostapd falls back to running as
root, it will still be able to read from and write to the socket even if
the node in the filesystem has been restricted to the network user and
group. This matches the logic in
package/network/services/hostapd/files/wpad.init, which sets the uid and
gid of /var/run/hostapd to network regardless of whether procd-ujail is
available.

As it appears that the "network" user and group are statically allocated
uid 101 and gid 101, respectively, per
package/base-files/files/etc/passwd and USERID in
package/network/services/hostapd/Makefile, this patch also uses a
constant 101 for the uid and gid.

Signed-off-by: Mark Mentovai <mark@moxienet.com>
[refreshed patch]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-11-23 18:53:31 +00:00
..
base-files base-files: stage2: improve /proc/*/stat parser 2021-11-13 18:36:52 +00:00
boot omap: update u-boot to 2021.07 2021-11-20 21:08:25 +01:00
devel gdb: Make only full gdb depend on libgmp 2021-11-07 18:32:21 +01:00
firmware linux-firmware: add firmware for intel ax200 2021-11-20 21:08:25 +01:00
kernel mt76: update to the latest version 2021-11-23 16:59:54 +01:00
libs gettext: remove package 2021-11-20 21:08:25 +01:00
network hostapd: allow hostapd under ujail to communicate with hostapd_cli 2021-11-23 18:53:31 +00:00
system procd: setup /dev/stdin, /dev/stdout and /dev/stderr symlinks 2021-11-23 14:03:39 +00:00
utils f2fstools: set each library package VARIANT 2021-11-01 20:18:55 +01:00
Makefile build: fix opkg install step for large package selection 2021-05-12 11:13:53 +02:00