Add intercept_verify sudoers option to control execve(2) argument checking.
This commit is contained in:
@@ -667,6 +667,10 @@ struct sudo_defs_types sudo_defs_table[] = {
|
||||
"intercept_type", T_TUPLE,
|
||||
N_("The mechanism used by the intercept and log_subcmds options: %s"),
|
||||
def_data_intercept_type,
|
||||
}, {
|
||||
"intercept_verify", T_FLAG,
|
||||
N_("Whether to verify the command and arguments after execution"),
|
||||
NULL,
|
||||
}, {
|
||||
"apparmor_profile", T_STR,
|
||||
N_("AppArmor profile to use in the new security context: %s"),
|
||||
|
@@ -308,7 +308,9 @@
|
||||
#define def_passprompt_regex (sudo_defs_table[I_PASSPROMPT_REGEX].sd_un.list)
|
||||
#define I_INTERCEPT_TYPE 153
|
||||
#define def_intercept_type (sudo_defs_table[I_INTERCEPT_TYPE].sd_un.tuple)
|
||||
#define I_APPARMOR_PROFILE 154
|
||||
#define I_INTERCEPT_VERIFY 154
|
||||
#define def_intercept_verify (sudo_defs_table[I_INTERCEPT_VERIFY].sd_un.flag)
|
||||
#define I_APPARMOR_PROFILE 155
|
||||
#define def_apparmor_profile (sudo_defs_table[I_APPARMOR_PROFILE].sd_un.str)
|
||||
|
||||
enum def_tuple {
|
||||
|
@@ -479,6 +479,9 @@ intercept_type
|
||||
T_TUPLE
|
||||
"The mechanism used by the intercept and log_subcmds options: %s"
|
||||
dso trace
|
||||
intercept_verify
|
||||
T_FLAG
|
||||
"Whether to verify the command and arguments after execution"
|
||||
apparmor_profile
|
||||
T_STR
|
||||
"AppArmor profile to use in the new security context: %s"
|
||||
|
@@ -549,6 +549,7 @@ init_defaults(void)
|
||||
if ((def_rlimit_core = strdup("0,0")) == NULL)
|
||||
goto oom;
|
||||
def_intercept_type = dso;
|
||||
def_intercept_verify = true;
|
||||
def_netgroup_tuple = false;
|
||||
def_sudoedit_checkdir = true;
|
||||
def_iolog_mode = S_IRUSR|S_IWUSR;
|
||||
|
@@ -636,7 +636,7 @@ sudoers_policy_store_result(bool accepted, char *argv[], char *envp[],
|
||||
}
|
||||
|
||||
/* Increase the length of command_info as needed, it is *not* checked. */
|
||||
command_info = calloc(71, sizeof(char *));
|
||||
command_info = calloc(72, sizeof(char *));
|
||||
if (command_info == NULL)
|
||||
goto oom;
|
||||
|
||||
@@ -812,6 +812,10 @@ sudoers_policy_store_result(bool accepted, char *argv[], char *envp[],
|
||||
if ((command_info[info_len++] = strdup("use_ptrace=true")) == NULL)
|
||||
goto oom;
|
||||
}
|
||||
if (def_intercept_verify) {
|
||||
if ((command_info[info_len++] = strdup("intercept_verify=true")) == NULL)
|
||||
goto oom;
|
||||
}
|
||||
if (def_noexec) {
|
||||
if ((command_info[info_len++] = strdup("noexec=true")) == NULL)
|
||||
goto oom;
|
||||
|
Reference in New Issue
Block a user