From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: linux-ima-devel@lists.sourceforge.net
Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, David Howells <dhowells@redhat.com>,
Dave Young <dyoung@redhat.com>
Subject: [PATCH 4/4] ima: define is_ima_appraise_enabled()
Date: Tue, 2 May 2017 14:47:12 -0400 [thread overview]
Message-ID: <1493750832-11981-5-git-send-email-zohar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1493750832-11981-1-git-send-email-zohar@linux.vnet.ibm.com>
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)
---
include/linux/ima.h | 6 ++++++
security/integrity/ima/ima_appraise.c | 10 ++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 7f6952f8d6aa..0e4647e0eb60 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -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;
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
index ac546df73afc..7fe0566142d8 100644
--- a/security/integrity/ima/ima_appraise.c
+++ b/security/integrity/ima/ima_appraise.c
@@ -34,6 +34,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
*
* Return 1 to appraise
--
2.7.4
prev parent reply other threads:[~2017-05-02 18:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 18:47 [PATCH 0/4] ima: builtin policy requiring file signatures Mimi Zohar
2017-05-02 18:47 ` [PATCH 1/4] ima: extend the "ima_policy" boot command line to support multiple policies Mimi Zohar
2017-05-02 18:47 ` [PATCH 2/4] ima: define a set of appraisal rules requiring file signatures Mimi Zohar
2017-05-02 18:47 ` [PATCH 3/4] ima: define Kconfig IMA_APPRAISE_BOOTPARAM option Mimi Zohar
2017-05-02 18:47 ` Mimi Zohar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1493750832-11981-5-git-send-email-zohar@linux.vnet.ibm.com \
--to=zohar@linux.vnet.ibm.com \
--cc=dhowells@redhat.com \
--cc=dyoung@redhat.com \
--cc=linux-ima-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).