diff options
author | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2018-02-21 11:33:37 -0500 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2018-03-23 06:31:37 -0400 |
commit | 57b56ac6fecb05c3192586e4892572dd13d972de (patch) | |
tree | 125efeee62e9ec9a3fc99a761151569cdba7e26c | |
parent | d906c10d8a31654cb9167c9a2ebc7d3e43820bad (diff) |
ima: fail file signature verification on non-init mounted filesystems
FUSE can be mounted by unprivileged users either today with fusermount
installed with setuid, or soon with the upcoming patches to allow FUSE
mounts in a non-init user namespace.
This patch addresses the new unprivileged non-init mounted filesystems,
which are untrusted, by failing the signature verification.
This patch defines two new flags SB_I_IMA_UNVERIFIABLE_SIGNATURE and
SB_I_UNTRUSTED_MOUNTER.
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <seth.forshee@canonical.com>
Cc: Dongsu Park <dongsu@kinvolk.io>
Cc: Alban Crequy <alban@kinvolk.io>
Acked-by: Serge Hallyn <serge@hallyn.com>
Acked-by: "Eric W. Biederman" <ebiederm@xmission.com>
-rw-r--r-- | include/linux/fs.h | 2 | ||||
-rw-r--r-- | security/integrity/ima/ima_appraise.c | 15 |
2 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index c6baf767619e..d9e60824c374 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1321,6 +1321,8 @@ extern int send_sigurg(struct fown_struct *fown); | |||
1321 | 1321 | ||
1322 | /* sb->s_iflags to limit user namespace mounts */ | 1322 | /* sb->s_iflags to limit user namespace mounts */ |
1323 | #define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */ | 1323 | #define SB_I_USERNS_VISIBLE 0x00000010 /* fstype already mounted */ |
1324 | #define SB_I_IMA_UNVERIFIABLE_SIGNATURE 0x00000020 | ||
1325 | #define SB_I_UNTRUSTED_MOUNTER 0x00000040 | ||
1324 | 1326 | ||
1325 | /* Possible states of 'frozen' field */ | 1327 | /* Possible states of 'frozen' field */ |
1326 | enum { | 1328 | enum { |
diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c index 1b177461f20e..4bafb397ee91 100644 --- a/security/integrity/ima/ima_appraise.c +++ b/security/integrity/ima/ima_appraise.c | |||
@@ -302,7 +302,19 @@ int ima_appraise_measurement(enum ima_hooks func, | |||
302 | } | 302 | } |
303 | 303 | ||
304 | out: | 304 | out: |
305 | if (status != INTEGRITY_PASS) { | 305 | /* |
306 | * File signatures on some filesystems can not be properly verified. | ||
307 | * On these filesytems, that are mounted by an untrusted mounter, | ||
308 | * fail the file signature verification. | ||
309 | */ | ||
310 | if ((inode->i_sb->s_iflags & | ||
311 | (SB_I_IMA_UNVERIFIABLE_SIGNATURE | SB_I_UNTRUSTED_MOUNTER)) == | ||
312 | (SB_I_IMA_UNVERIFIABLE_SIGNATURE | SB_I_UNTRUSTED_MOUNTER)) { | ||
313 | status = INTEGRITY_FAIL; | ||
314 | cause = "unverifiable-signature"; | ||
315 | integrity_audit_msg(AUDIT_INTEGRITY_DATA, inode, filename, | ||
316 | op, cause, rc, 0); | ||
317 | } else if (status != INTEGRITY_PASS) { | ||
306 | if ((ima_appraise & IMA_APPRAISE_FIX) && | 318 | if ((ima_appraise & IMA_APPRAISE_FIX) && |
307 | (!xattr_value || | 319 | (!xattr_value || |
308 | xattr_value->type != EVM_IMA_XATTR_DIGSIG)) { | 320 | xattr_value->type != EVM_IMA_XATTR_DIGSIG)) { |
@@ -319,6 +331,7 @@ out: | |||
319 | } else { | 331 | } else { |
320 | ima_cache_flags(iint, func); | 332 | ima_cache_flags(iint, func); |
321 | } | 333 | } |
334 | |||
322 | ima_set_cache_status(iint, func, status); | 335 | ima_set_cache_status(iint, func, status); |
323 | return status; | 336 | return status; |
324 | } | 337 | } |