[PATCH] inetd as unprivileged user
Jack Schmidt
busybox at mowsey.org
Wed Nov 1 02:19:52 UTC 2017
When I tried to use inetd as an unprivileged user on linux (4.9.x, x86_64, glibc or musl), I get:
inetd: can't set groups: Operation not permitted
I believe the problem is line 1486, where it compares the desired uid to 0, rather than to the current uid, to decide whether to set groups.
For example:
printf '127.0.0.1:3030 stream tcp nowait jack ./echo.sh' > inetd.conf
printf '#!/bin/sh\necho ok\nsleep 1' > echo.sh
chmod 755 echo.sh
./busybox inetd -e -f inetd.conf &
nc 127.0.0.1 3030
With the patch, it echoes "ok".
Without the patch, inetd gives an error:
inetd: can't set groups: Operation not permitted
Of course, to placate line 1486 one could use:
printf '127.0.0.1:3030 stream tcp nowait root ./echo.sh' > inetd.conf
but this results in the earlier error:
inetd: non-root must run services as himself
-------------- next part --------------
A non-text attachment was scrubbed...
Name: inetd-setgroups-fix.diff
Type: application/octet-stream
Size: 455 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20171031/70e66516/attachment.obj>
More information about the busybox
mailing list