Comments (14)
I'm not an expert on socket "files", but the permission on the control sockets are:
root@wap:~# ls -la /var/run/hostapd/wlan0
srwxrwx--- 1 network network 0 Apr 11 12:25 /var/run/hostapd/wlan0
When running as the root user, wifi-presence can't access them. I've tried catting the socket as root and just get a "No such device or address" error back. I guess that as a minimum, the wifi-presence user needs to be in the network group.
from wifi-presence.
Thanks, LGTM.
Open a PR against openwrt-packages
and ping me to merge.
from wifi-presence.
I've the same problem. Could you explain how can I do it?
from wifi-presence.
Edit /etc/init.d/wifi-presence
Add to start_service():
procd_set_param user network
procd_set_param group network
from wifi-presence.
I added the two parameters. I don't have the error anymore, but I think I have something bad configured. I can't see anything at the MQTT server. I will look again to the configuration.
Thanks for the help!
@awilliams could you add this two parameters to the OpenWrt package?
from wifi-presence.
I've only seen processes run as root
on OpenWrt unless explicitly set otherwise. For this reason, I've had no permissions issues. Is wifi-presence
being run as root
for you and you still see the permissions issues with the control sockets?
Instead of hardcoding network
, I'd like to make the user/group configurable (similar to kcptun for example). Would that solve the issue you're experiencing?
from wifi-presence.
I can't say too much, I don't have too much experience with Linux or Openwrt. I only installed the package with opkg and I experienced the issue until I added the lines commented by @timdodge.
from wifi-presence.
@awilliams I encountered this issue also, and was resolved using the changes suggested by @timdodge. Feel free to ping me if you want to make these changes directly in OpenWrt.
from wifi-presence.
I've created a PR that I think will address this issue: PR #6.
Please try it out if you're able to. After updating the /etc/init.d/wifi-presence
script, add the following to /etc/config/wifi-presence
to run the process as network / network:
option runAsUser 'network'
option runAsGroup 'network'
If the PR looks good, I'll make the same change in the openwrt/packages
repo.
I'm guessing you're using seccomp or something similar, and triggering this case in hostapd's init script, causing it to run as network / network.
from wifi-presence.
@awilliams can you share a bit more detail on your OpenWrt builds? Are you running an old build/snapshot, or a target where seccomp
is unavailable? Given that seccomp
is enabled by default on most (all?) targets, I think that the user/group options should be uncommented in the config file.
ad2b6bd#diff-5000e54b7b529e6c12b270a4c9335886f97c9b4065dda3d789740f4e7a042aa5R52-R53
from wifi-presence.
@jmccrohan Thanks for letting me know that seccomp
is enabled by default. I'm using a custom build of OpenWrt for my routers, so wasn't aware.
What do you think about the following idea? Modify the changes in #6 to auto-detect the proper user if runAsUser
/runAsGroup
aren't explicitly defined. In other words, instead of defaulting to root
, do something like stat the /var/run/hostapd/wlan0
sockets and run wifi-presence as the owner of that file.
from wifi-presence.
@awilliams Up to you how you implement it. A simple comment might in the config file re root
/network
users might suffice and is easier to maintain. Key is to get this fixed and merged into OpenWrt so that new users don't get bitten by this issue. :-)
from wifi-presence.
I think the recent change in #6 will work fine.
It allows setting a user/group in /etc/config/wifi-presence
. If no specific values are set, then the init script will look at the owner of the sockets in /var/run/hostapd
and use that user as the user/group to start wifi-presence. I'd expect this to work for almost all users without them having to touch their configs.
If you're able @jmccrohan, please review. Once merged in this repo, I'll make the same change to openwrt/packages
.
from wifi-presence.
Fixed by openwrt/packages#18573
from wifi-presence.
Related Issues (15)
- daemon.err wifi-presence[6693]: Error: unable to connect to hostapd control socket "/var/run/hostapd/wlan0": ping error: read error from "PING" command: read unixgram /tmp/wp.wlan0->/var/run/hostapd/wlan0: i/o timeout HOT 7
- JSON configuration persistency HOT 3
- Support for newer version of hostapd in OpenWrt master HOT 3
- __nanosleep_time64: symbol not found HOT 2
- Ability to publish status for all devices HOT 1
- opkg version outdated HOT 1
- MQTT entity name starts with the device name HOT 2
- Roaming between multiple APs HOT 2
- Conflict with wpad-basic-mbedtls HOT 1
- Support for MQTT over TLS (MQTTS)?
- Error in wifi-presence: EventUnrecognized HOT 4
- OpenWrt Boot racecondition HOT 2
- SSID with mixed UTF-8 and ASCII characters cannot be handled correctly HOT 3
- Doesn't work after update to 22.03.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wifi-presence.