Skip to content

Commit

Permalink
ima: define is_ima_appraise_enabled()
Browse files Browse the repository at this point in the history
Only return enabled if in enforcing mode, not fix or log modes.

Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>

Changes:
- Define is_ima_appraise_enabled() as a bool (Thiago Bauermann)
  • Loading branch information
Mimi Zohar committed Jun 21, 2017
1 parent e1f5e01 commit 6f6723e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/linux/ima.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,17 @@ static inline void ima_add_kexec_buffer(struct kimage *image)
#endif

#ifdef CONFIG_IMA_APPRAISE
extern bool is_ima_appraise_enabled(void);
extern void ima_inode_post_setattr(struct dentry *dentry);
extern int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
const void *xattr_value, size_t xattr_value_len);
extern int ima_inode_removexattr(struct dentry *dentry, const char *xattr_name);
#else
static inline bool is_ima_appraise_enabled(void)
{
return 0;
}

static inline void ima_inode_post_setattr(struct dentry *dentry)
{
return;
Expand Down
10 changes: 10 additions & 0 deletions security/integrity/ima/ima_appraise.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ static int __init default_appraise_setup(char *str)

__setup("ima_appraise=", default_appraise_setup);

/*
* is_ima_appraise_enabled - return appraise status
*
* Only return enabled, if not in ima_appraise="fix" or "log" modes.
*/
bool is_ima_appraise_enabled(void)
{
return (ima_appraise & IMA_APPRAISE_ENFORCE) ? 1 : 0;
}

/*
* ima_must_appraise - set appraise flag
*
Expand Down

0 comments on commit 6f6723e

Please sign in to comment.