I had a look at runscripts and chpst is rarely used, often with one
option like 'chpst -uuser' or 'chpst -mNNN' or the like, so
for instance (stealing the idea from the power-profile-daemon
chatting we had),
You are right. This does slightly call into question one of my core
design principles, which was to be similar in form to and compatible
with chpst - what is the point if chpst is rarely used? But we are
here now and I think xchpst does basically do its job reasonably well!
[ xhcpst in invoke-run proposal, using an extra file ]
This is an interesting idea. Two thoughts come to mind:
1) Does this pollute the runit environment? An extra file in the
service directory that isn't used by runit itself?
My main concern of this proposal is that it makes the standard path to
reach the crux of a runscript more complicated - invoke-run is really
useful but the more complicated and magical it is, the more opaque
everything is for runit users, I feel. (Acknowledging that the extra complexity is intended to help people use my tool!)
Have you seen what I have tried with a couple of runscript examples?
https://salsa.debian.org/debian/runit-services/-/merge_requests/21/diffs
HARDEN="xchpst --cap-bs-drop CAP_SYS_PTRACE --verbose"
$HARDEN --exit || HARDEN=""
exec $HARDEN ##bin##
https://salsa.debian.org/debian/runit-services/-/merge_requests/19/diffs
HARDEN="/usr/bin/xchpst --ro-sys --private-tmp --uts-ns"
$HARDEN --exit && HARDEN="$HARDEN --verbose --" || HARDEN=""
exec $HARDEN ##bin## $EXIMSERVICE -d
These rely on nothing outside of themselves. They still suffer from
the problem of not being able to quote space within arguments,
although that shouldn't be a big issue.
The '--exit' option was specifically added to return exit code 0 so
that it could be used as a test for presence of xchpst - it can also
check compatibility with the selected options.
If I were to summarise my thoughts on the merits of the options:
1) xchpst.fake: PRO: least invasive to use, CON: magic
2) XCHPST env var CON: magic, CON: env var-based
3) HARDEN env var CON: env var-based
Or is that not fair?
1 & 2 both concern me in that they make xchpst 'special', which I'm
conscious of not necessarily being in the spirit of runit. Option 3
can always be upgraded because it is self-contained. I don't rule out
any of these approaches yet!
pushed a version of the patch with xchpst in invoke-run that uses the
--file option. Hoping that it works as expected, this is what I'm
comfortable to add at this stage of the release process to allow experimenting with xchpst and runscripts in Trixie.
That said, I know this is your least favorite option, I think there are
still important details that need to be looked at, and I propose that
we take the time to do the testing during early Trixie cycle and then
define the final version of the xchpst integration.
On Thu, 27 Feb 2025 22:52:47 +0000
Andrew Bower <andrew@bower.uk> wrote:
I had a look at runscripts and chpst is rarely used, often with one option like 'chpst -uuser' or 'chpst -mNNN' or the like, so
for instance (stealing the idea from the power-profile-daemon
chatting we had),
You are right. This does slightly call into question one of my core
design principles, which was to be similar in form to and compatible
with chpst - what is the point if chpst is rarely used? But we are
here now and I think xchpst does basically do its job reasonably well!
I still think being compatible with chpst is added value, you never
know how a user or another distro may want to use it
The '--exit' option was specifically added to return exit code 0 so
that it could be used as a test for presence of xchpst - it can also
check compatibility with the selected options.
this needs to be thought carefully: a related issue is to decide what to
do if one or more required hardening options are not applicable; it
looks like security vs resilience tradeoff. it needs to be sorted out
in xchpst first.
On Mon, Mar 17, 2025 at 12:47:43AM +0100, Lorenzo wrote:
That said, I know this is your least favorite option, I think there are still important details that need to be looked at, and I propose that
we take the time to do the testing during early Trixie cycle and then define the final version of the xchpst integration.
It seems to work - all in, it's a neat solution.
The '--exit' option was specifically added to return exit code 0 so
that it could be used as a test for presence of xchpst - it can also check compatibility with the selected options.
this needs to be thought carefully: a related issue is to decide what to
do if one or more required hardening options are not applicable; it
looks like security vs resilience tradeoff. it needs to be sorted out
in xchpst first.
Yes, this needs review. We should hope that in most cases, rather than a trade-off, there is an obvious right answer (abort or continue as best effort) so we can minimise excess complexity in configuration.
Thanks again for adding the compat,
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 480 |
Nodes: | 16 (2 / 14) |
Uptime: | 246:43:36 |
Calls: | 9,532 |
Calls today: | 4 |
Files: | 13,650 |
Messages: | 6,137,710 |