mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
MINOR: debug: store runtime uid/gid in postmortem
Let's extend post_mortem to store runtime process uid and gid. This information is fed in feed_post_mortem_late(), just before calling run_poll_loop(). Like this we are sure that all configuration settings were successfully applied.
This commit is contained in:
parent
ac8bd679dc
commit
baa4e1cf39
13
src/debug.c
13
src/debug.c
@ -116,6 +116,8 @@ struct post_mortem {
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
uid_t boot_uid;
|
uid_t boot_uid;
|
||||||
gid_t boot_gid;
|
gid_t boot_gid;
|
||||||
|
uid_t run_uid;
|
||||||
|
gid_t run_gid;
|
||||||
#if defined(USE_LINUX_CAP)
|
#if defined(USE_LINUX_CAP)
|
||||||
struct {
|
struct {
|
||||||
// initial process capabilities
|
// initial process capabilities
|
||||||
@ -565,10 +567,11 @@ static int debug_parse_cli_show_dev(char **args, char *payload, struct appctx *a
|
|||||||
for (i = 0; i < post_mortem.process.argc; i++)
|
for (i = 0; i < post_mortem.process.argc; i++)
|
||||||
chunk_appendf(&trash, "%s ", post_mortem.process.argv[i]);
|
chunk_appendf(&trash, "%s ", post_mortem.process.argv[i]);
|
||||||
chunk_appendf(&trash, "\n");
|
chunk_appendf(&trash, "\n");
|
||||||
|
|
||||||
chunk_appendf(&trash, " boot uid: %d\n", post_mortem.process.boot_uid);
|
chunk_appendf(&trash, " boot uid: %d\n", post_mortem.process.boot_uid);
|
||||||
chunk_appendf(&trash, " runtime uid: %d\n", geteuid());
|
chunk_appendf(&trash, " runtime uid: %d\n", post_mortem.process.run_uid);
|
||||||
chunk_appendf(&trash, " boot gid: %d\n", post_mortem.process.boot_gid);
|
chunk_appendf(&trash, " boot gid: %d\n", post_mortem.process.boot_gid);
|
||||||
chunk_appendf(&trash, " runtime gid: %d\n", getegid());
|
chunk_appendf(&trash, " runtime gid: %d\n", post_mortem.process.run_gid);
|
||||||
|
|
||||||
#if defined(USE_LINUX_CAP)
|
#if defined(USE_LINUX_CAP)
|
||||||
/* let's dump saved in feed_post_mortem() initial capabilities sets */
|
/* let's dump saved in feed_post_mortem() initial capabilities sets */
|
||||||
@ -2429,6 +2432,12 @@ static int feed_post_mortem_late()
|
|||||||
post_mortem.process.thread_info[i].stack_top = ha_thread_info[i].stack_top;
|
post_mortem.process.thread_info[i].stack_top = ha_thread_info[i].stack_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* also set runtime process settings. At this stage we are sure, that all
|
||||||
|
* config options and limits adjustements are successfully applied.
|
||||||
|
*/
|
||||||
|
post_mortem.process.run_uid = geteuid();
|
||||||
|
post_mortem.process.run_gid = getegid();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user