]> Git Repo - buildroot-mgba.git/commit
package/petitboot: run UI as non-root user
authorReza Arbab <[email protected]>
Wed, 7 Feb 2024 17:51:35 +0000 (11:51 -0600)
committerArnout Vandecappelle <[email protected]>
Fri, 12 Jul 2024 21:59:33 +0000 (23:59 +0200)
commiteee0a2f226bc3c763f845c2f8caae2b06999460b
treefb4c192715899497384e9b227865d613d1cd96ad
parentd5ba2db4011cd577732e26b5c081e57a26d8910f
package/petitboot: run UI as non-root user

Though the petitboot UI is a user application, it is currently being
run by root only because we use getty to display it on the console.

Create an unprivileged user to run the UI instead. The unix socket the
pb-discover daemon sets up is accessible to "petitgroup", so that should
be the gid, with arbitrary uid "petituser" to match.

This is currently the chain of processes leading to the UI:

1. /etc/init.d/pb-console start console
2. /usr/libexec/petitboot/pb-console --getty --detach -- -n -i 0 console linux
3. /sbin/getty -l/usr/libexec/petitboot/pb-console -n -i 0 console linux
4. /usr/libexec/petitboot/pb-console
5. /usr/sbin/petitboot-nc

Instead of (3) running the pb-console helper directly with "getty -l",
we can use "agetty -a" to autologin petituser, and run pb-console via
petituser's login shell:

1. /etc/init.d/pb-console start console
2. /usr/libexec/petitboot/pb-console --getty=/sbin/agetty --detach -- -a petituser -n -i console linux
3. /sbin/agetty -a petituser -n -i console linux
4. /home/petituser/.profile
5. /usr/libexec/petitboot/pb-console
6. /usr/sbin/petiboot-nc

Here, everything from (4) down is running as petituser. In (4), use
$PPID to determine if we're logging in via getty, so that logging in by
other means will give a normal shell. Otherwise we would recurse when
trying to get a shell from the menu.

Signed-off-by: Reza Arbab <[email protected]>
[Arnout: explicitly select util-linux, even though it comes indirectly
through other dependencies]
Signed-off-by: Arnout Vandecappelle <[email protected]>
package/petitboot/Config.in
package/petitboot/S15pb-discover
package/petitboot/pb-console
package/petitboot/petitboot.mk
package/petitboot/shell_profile [new file with mode: 0644]
This page took 0.03714 seconds and 4 git commands to generate.