Skip to content
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

cmake: Device node permissions should be configurable #1195

Open
wfrisch opened this issue Sep 3, 2024 · 3 comments
Open

cmake: Device node permissions should be configurable #1195

wfrisch opened this issue Sep 3, 2024 · 3 comments

Comments

@wfrisch
Copy link

wfrisch commented Sep 3, 2024

The IIO USB device nodes are set to mode 666 in libiio.rules.cmakein:

SUBSYSTEM=="usb", PROGRAM=="/bin/sh -c '@CMAKE_INSTALL_FULL_BINDIR@/iio_info -S usb=%s{idVendor}:%s{idProduct} | grep %s{idVendor}:%s{idProduct}'", RESULT!="", MODE="666"

While this is easy to manage as it allows all users of a system to access IIO devices, it undermines the system's privilege separation. A more secure configuration, in my humble opinion, would be to add a system group iio with mode 660.

@wfrisch
Copy link
Author

wfrisch commented Sep 3, 2024

Ideally, this should be configurable via cmake so that packagers can easily set the desired group/mode for their distribution.

@wfrisch wfrisch changed the title World-writable device nodes necessary? cmake: Device node permissions should be configurable Sep 3, 2024
@StefanBruens
Copy link

Preferably:

  1. Change MODE="666" to e.g. ENV{libiio_matched}="1"
  2. Add a rules file which actually grants the permissions:
    • ENV{libiio_matched}=="1" TAG+="uaccess" or
    • ENV{libiio_matched}=="1" GROUP="iiod" MODE="660"

The latter can be easily changed/disabled with a local dropin in /etc/udev/rules.d/.

@StefanBruens
Copy link

Btw, the udev match rules itself has still several issues, see my earlier #586 (comment) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants