Feature #3135
closedserver.core-files support on Solaris based system
Description
- based on personal/gstrauss/master branch.
- basically making the current process traceable via setpflags call and __PROC_PROTECT.
Files
Updated by gstrauss almost 3 years ago
- Category set to core
What is __PROC_PROTECT
? It is not mentioned in any of
https://www.illumos.org/man/5/privileges
https://www.illumos.org/man/2/setpflags
https://docs.oracle.com/cd/E88353_01/html/E37841/setpflags-2.html
lighttpd does not currently directly modify Linux "capabilities". In most cases, that could be done by the calling process. Should that not also apply similarly to illumos and setpflags
(and coreadm
)?
Updated by devnexen almost 3 years ago
Indeed it is not documented it is a known feature tough when you get to do solaris native programming, one of the few visible examples you can find is openssh (doing the opposite of course)
https://github.com/openssh/openssh-portable/blob/master/platform-tracing.c#L55
Updated by gstrauss almost 3 years ago
Thanks for the pointer to an example. Should this patch check the return value from setpflags()
? Should lighttpd issue trace if setpflags()
fails? Should lighttpd fail and exit? (probably not) Should lighttpd use getpflags()
to see if this needs to be set? How should lighttpd handle EPERM from setpflags()
or will that not occur with __PROC_PROTECT
?
Updated by devnexen almost 3 years ago
should be fine. In openssh case it s important they check since they want to make sure it can't be traced while here it s more like "icing on the cake".
Updated by devnexen almost 3 years ago
gstrauss wrote in #note-4:
Thanks for the pointer to an example. Should this patch check the return value from
setpflags()
? Should lighttpd issue trace ifsetpflags()
fails? Should lighttpd fail and exit? (probably not) Should lighttpd usegetpflags()
to see if this needs to be set? How should lighttpd handle EPERM fromsetpflags()
or will that not occur with__PROC_PROTECT
?
at worse a log entry warning about the failure should be good enough, indeed stopping lighttpd "just" because of this sounds harsh. but that s just a suggestion.
Updated by devnexen almost 3 years ago
FYI with this basic hello world
#include <priv.h>
#include <stdio.h>
int main(void)
{
printf("1st attempt %d\n", setpflags(__PROC_PROTECT, 0));
printf("2nd attempt %d\n", setpflags(__PROC_PROTECT, 0));
return 0;
}
dcarlier@openindianavbox:/tmp$ gcc a.c
dcarlier@openindianavbox:/tmp$ ./a.out
1st attempt 0
2nd attempt 0
don t think we need getpflags to check.
Updated by gstrauss almost 3 years ago
- Status changed from New to Patch Pending
- Target version changed from 1.4.xx to 1.4.64
Probably overthinking it. If it helps, great. If it does not, then things are the same as they were before.
Updated by devnexen almost 3 years ago
- Status changed from Patch Pending to Fixed
Applied in changeset b6bd11c15e62133426cf2acf189886237b97736c.
Also available in: Atom