Some filesystems, like fuse, don't export the filesystem magic number.
In addition, when files in the initramfs will be properly labeled with
file signatures, we will need the ablity to differentiate between
rootfs that require file signatures from those don't.
This patch defines a new IMA policy condition named "fsname", based on
the superblock's file_system_type (sb->s_type) name. This allows policy
rules to be expressed in terms of the filesystem name.
Example rules:
measure func=FILE_CHECK fsname=fuse
appraise func=BPRM_CHECK fsname=rootfs
appraise func=FILE_MMAP fsname=rootfs
Signed-off-by: Mimi Zohar <redacted>
---
Documentation/ABI/testing/ima_policy | 2 +-
security/integrity/ima/ima_policy.c | 25 ++++++++++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
--
2.7.5
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Files on FUSE can change at any point in time without notifying the
kernel. This patch sets the new fs_type flag FS_UNTRUSTED to indicate
that the filesystem is untrusted.
(This patch is based on Alban Crequy's use of fs_flags.)
Signed-off-by: Mimi Zohar <redacted>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <redacted>
Cc: Eric W. Biederman <redacted>
Cc: Dongsu Park <redacted>
Cc: Alban Crequy <redacted>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
---
fs/fuse/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.7.5
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
privileged, untrusted filesystems requires a custom policy.
(This patch is based on Alban Crequy's use of fs_flags and patch
description.)
Signed-off-by: Mimi Zohar <redacted>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <redacted>
Cc: Eric W. Biederman <redacted>
Cc: Dongsu Park <redacted>
Cc: Alban Crequy <redacted>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
---
include/linux/fs.h | 1 +
security/integrity/ima/ima_appraise.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
@@ -292,7 +292,14 @@ int ima_appraise_measurement(enum ima_hooks func,}out:-if(status!=INTEGRITY_PASS){+/* Fail untrusted and unpriviliged filesystems (eg FUSE) */+if((inode->i_sb->s_type->fs_flags&FS_UNTRUSTED)&&+(inode->i_sb->s_user_ns!=&init_user_ns)){+status=INTEGRITY_FAIL;+cause="untrusted-filesystem";+integrity_audit_msg(AUDIT_INTEGRITY_DATA,inode,filename,+op,cause,rc,0);+}elseif(status!=INTEGRITY_PASS){if((ima_appraise&IMA_APPRAISE_FIX)&&(!xattr_value||xattr_value->type!=EVM_IMA_XATTR_DIGSIG)){
@@ -309,6 +316,7 @@ int ima_appraise_measurement(enum ima_hooks func,}else{ima_cache_flags(iint,func);}+ima_set_cache_status(iint,func,status);returnstatus;}
--
2.7.5
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Verifying file signatures on untrusted filesystems is meaningless, as
the filesystem can change the file at any time. This patch defines a
new policy option named "fail", which fails signature verification on
untrusted filesystems.
Like any other signature verification failure, the measurement is still
added to the measurement list and audited based on policy.
Signed-off-by: Mimi Zohar <redacted>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <redacted>
Cc: Eric W. Biederman <redacted>
Cc: Dongsu Park <redacted>
Cc: Alban Crequy <redacted>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
---
Documentation/ABI/testing/ima_policy | 2 +-
security/integrity/ima/ima_appraise.c | 8 ++++++--
security/integrity/ima/ima_policy.c | 12 +++++++++++-
security/integrity/integrity.h | 1 +
4 files changed, 19 insertions(+), 4 deletions(-)
--
2.7.5
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: "Serge E. Hallyn" <serge@hallyn.com> Date: 2018-02-14 14:49:05
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
Good thing we can partially work around that by intercepting real
mount calls with Tycho's new patchset :)
quoted hunk
(This patch is based on Alban Crequy's use of fs_flags and patch
description.)
Signed-off-by: Mimi Zohar <redacted>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <redacted>
Cc: Eric W. Biederman <redacted>
Cc: Dongsu Park <redacted>
Cc: Alban Crequy <redacted>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
---
include/linux/fs.h | 1 +
security/integrity/ima/ima_appraise.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
@@ -292,7 +292,14 @@ int ima_appraise_measurement(enum ima_hooks func,}out:-if(status!=INTEGRITY_PASS){+/* Fail untrusted and unpriviliged filesystems (eg FUSE) */+if((inode->i_sb->s_type->fs_flags&FS_UNTRUSTED)&&+(inode->i_sb->s_user_ns!=&init_user_ns)){+status=INTEGRITY_FAIL;+cause="untrusted-filesystem";+integrity_audit_msg(AUDIT_INTEGRITY_DATA,inode,filename,+op,cause,rc,0);+}elseif(status!=INTEGRITY_PASS){if((ima_appraise&IMA_APPRAISE_FIX)&&(!xattr_value||xattr_value->type!=EVM_IMA_XATTR_DIGSIG)){
@@ -309,6 +316,7 @@ int ima_appraise_measurement(enum ima_hooks func,}else{ima_cache_flags(iint,func);}+ima_set_cache_status(iint,func,status);returnstatus;}
--
2.7.5
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2018-02-14 at 08:49 -0600, Serge E. Hallyn wrote:
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
Right, whether it is an unprivileged mount or not, fuse can return
whatever it wants, whenever it wants. ?IMA can calculate the file hash
based based on what it reads, but fuse can return whatever it wants on
subsequent reads.
Refer to the discussion with Linus -?http://kernsec.org/pipermail/linu
x-security-module-archive/2018-February/005200.html
quoted
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
How would you suggest to differentiate between your unprivileged fuse
mounts from unintended, unintended malicious ones?
The remaining patches are policy based.
Good thing we can partially work around that by intercepting real
mount calls with Tycho's new patchset :)
Can you provide a little more details?
thanks,
Mimi
quoted
(This patch is based on Alban Crequy's use of fs_flags and patch
description.)
Signed-off-by: Mimi Zohar <redacted>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <redacted>
Cc: Eric W. Biederman <redacted>
Cc: Dongsu Park <redacted>
Cc: Alban Crequy <redacted>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
---
include/linux/fs.h | 1 +
security/integrity/ima/ima_appraise.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
@@ -292,7 +292,14 @@ int ima_appraise_measurement(enum ima_hooks func,}out:-if(status!=INTEGRITY_PASS){+/* Fail untrusted and unpriviliged filesystems (eg FUSE) */+if((inode->i_sb->s_type->fs_flags&FS_UNTRUSTED)&&+(inode->i_sb->s_user_ns!=&init_user_ns)){+status=INTEGRITY_FAIL;+cause="untrusted-filesystem";+integrity_audit_msg(AUDIT_INTEGRITY_DATA,inode,filename,+op,cause,rc,0);+}elseif(status!=INTEGRITY_PASS){if((ima_appraise&IMA_APPRAISE_FIX)&&(!xattr_value||xattr_value->type!=EVM_IMA_XATTR_DIGSIG)){
@@ -309,6 +316,7 @@ int ima_appraise_measurement(enum ima_hooks func,}else{ima_cache_flags(iint,func);}+ima_set_cache_status(iint,func,status);returnstatus;}
--
2.7.5
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: "Serge E. Hallyn" <serge@hallyn.com> Date: 2018-02-14 15:16:39
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
On Wed, 2018-02-14 at 08:49 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
Right, whether it is an unprivileged mount or not, fuse can return
whatever it wants, whenever it wants. ?IMA can calculate the file hash
based based on what it reads, but fuse can return whatever it wants on
subsequent reads.
Ok but your patch seems to let privileged fuse mounts slide? (see below)
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
How would you suggest to differentiate between your unprivileged fuse
mounts from unintended, unintended malicious ones?
I wouldn't.
The remaining patches are policy based.
quoted
Good thing we can partially work around that by intercepting real
mount calls with Tycho's new patchset :)
Can you provide a little more details?
It would allow a container runtime to intercept mount(2) and perform
a real mount on the user's behalf. Assuming the runtime is privileged,
of course, otherwise it would intercept and do a fuse mount which is
no help here :)
https://lkml.org/lkml/2018/2/4/28
thanks,
Mimi
quoted
quoted
(This patch is based on Alban Crequy's use of fs_flags and patch
description.)
Signed-off-by: Mimi Zohar <redacted>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Seth Forshee <redacted>
Cc: Eric W. Biederman <redacted>
Cc: Dongsu Park <redacted>
Cc: Alban Crequy <redacted>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
---
include/linux/fs.h | 1 +
security/integrity/ima/ima_appraise.c | 10 +++++++++-
2 files changed, 10 insertions(+), 1 deletion(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2018-02-14 at 09:16 -0600, Serge E. Hallyn wrote:
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
On Wed, 2018-02-14 at 08:49 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
Right, whether it is an unprivileged mount or not, fuse can return
whatever it wants, whenever it wants. ?IMA can calculate the file hash
based based on what it reads, but fuse can return whatever it wants on
subsequent reads.
Ok but your patch seems to let privileged fuse mounts slide? (see below)
Unprivileged fuse mounts hasn't been upstreamed yet, so we wouldn't be
breaking existing userspace.
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
How would you suggest to differentiate between your unprivileged fuse
mounts from unintended, unintended malicious ones?
I wouldn't.
What happened to the requirement that systems should be "fail-safe"?
Ok, hard coding this rule probably is not a good idea. ?For those
wanting to take this liability on their systems, we can make this
configurable, like for privileged fuse mounts. ?Unlike for privileged
fuse mounts, the builtin policies, I think, should be fail safe and
include the "fail" rule for unprivileged fuse mounts.
quoted
The remaining patches are policy based.
quoted
Good thing we can partially work around that by intercepting real
mount calls with Tycho's new patchset :)
Can you provide a little more details?
It would allow a container runtime to intercept mount(2) and perform
a real mount on the user's behalf. Assuming the runtime is privileged,
of course, otherwise it would intercept and do a fuse mount which is
no help here :)
https://lkml.org/lkml/2018/2/4/28
thanks!
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: "Serge E. Hallyn" <serge@hallyn.com> Date: 2018-02-14 15:42:57
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
On Wed, 2018-02-14 at 09:16 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
On Wed, 2018-02-14 at 08:49 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
Right, whether it is an unprivileged mount or not, fuse can return
whatever it wants, whenever it wants. ?IMA can calculate the file hash
based based on what it reads, but fuse can return whatever it wants on
subsequent reads.
Ok but your patch seems to let privileged fuse mounts slide? (see below)
Unprivileged fuse mounts hasn't been upstreamed yet, so we wouldn't be
breaking existing userspace.
I don't think I'm being clear.
In your patch it looks like you mark unprivileged FUSE mounts as
INTEGRITY_FAIL. I agree you should do that. But you skip the
FS_UNTRUSTED check for privileged FUSE mounts. I'm asking why
that's ok.
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
How would you suggest to differentiate between your unprivileged fuse
mounts from unintended, unintended malicious ones?
I wouldn't.
What happened to the requirement that systems should be "fail-safe"?
My point was - I was asking whether there was any way to have IMA be
meaningful with such containers, not saying I had any ideas, and
certainly not saying that just because you can't detect it means you
should allow it in all cases. It's too bad that it has this effect,
but I agree with your patch.
I only didn't ack it because you're skipping the check for privileged
mounts which seems wrong.
-serge
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2018-02-14 at 09:42 -0600, Serge E. Hallyn wrote:
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
On Wed, 2018-02-14 at 09:16 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
On Wed, 2018-02-14 at 08:49 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
Right, whether it is an unprivileged mount or not, fuse can return
whatever it wants, whenever it wants. ?IMA can calculate the file hash
based based on what it reads, but fuse can return whatever it wants on
subsequent reads.
Ok but your patch seems to let privileged fuse mounts slide? (see below)
Unprivileged fuse mounts hasn't been upstreamed yet, so we wouldn't be
breaking existing userspace.
I don't think I'm being clear.
In your patch it looks like you mark unprivileged FUSE mounts as
INTEGRITY_FAIL. I agree you should do that. But you skip the
FS_UNTRUSTED check for privileged FUSE mounts. I'm asking why
that's ok.
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
How would you suggest to differentiate between your unprivileged fuse
mounts from unintended, unintended malicious ones?
I wouldn't.
What happened to the requirement that systems should be "fail-safe"?
My point was - I was asking whether there was any way to have IMA be
meaningful with such containers, not saying I had any ideas, and
certainly not saying that just because you can't detect it means you
should allow it in all cases. It's too bad that it has this effect,
but I agree with your patch.
I only didn't ack it because you're skipping the check for privileged
mounts which seems wrong.
Oh! That is based on Linus' "request" not to break userspace.
Mimi
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: "Serge E. Hallyn" <serge@hallyn.com> Date: 2018-02-14 15:54:23
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
On Wed, 2018-02-14 at 09:42 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
On Wed, 2018-02-14 at 09:16 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
On Wed, 2018-02-14 at 08:49 -0600, Serge E. Hallyn wrote:
quoted
Quoting Mimi Zohar (zohar at linux.vnet.ibm.com):
quoted
Files on untrusted filesystems, such as fuse, can change at any time,
making the measurement(s) and by extension signature verification
meaningless.
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 always fails the file signature verification on unprivileged
and untrusted filesystems. To also fail file signature verification on
Why only untrusted? Fuse could cause the same issue if it just
messes up when mounted from init userns right?
Right, whether it is an unprivileged mount or not, fuse can return
whatever it wants, whenever it wants. ?IMA can calculate the file hash
based based on what it reads, but fuse can return whatever it wants on
subsequent reads.
Ok but your patch seems to let privileged fuse mounts slide? (see below)
Unprivileged fuse mounts hasn't been upstreamed yet, so we wouldn't be
breaking existing userspace.
I don't think I'm being clear.
In your patch it looks like you mark unprivileged FUSE mounts as
INTEGRITY_FAIL. I agree you should do that. But you skip the
FS_UNTRUSTED check for privileged FUSE mounts. I'm asking why
that's ok.
privileged, untrusted filesystems requires a custom policy.
(I'm not saying you shouldn't do this, but) does this mean that
a container whose rootfs is fuse-mounted by the unprivileged user
cannot possibly use IMA?
How would you suggest to differentiate between your unprivileged fuse
mounts from unintended, unintended malicious ones?
I wouldn't.
What happened to the requirement that systems should be "fail-safe"?
My point was - I was asking whether there was any way to have IMA be
meaningful with such containers, not saying I had any ideas, and
certainly not saying that just because you can't detect it means you
should allow it in all cases. It's too bad that it has this effect,
but I agree with your patch.
I only didn't ack it because you're skipping the check for privileged
mounts which seems wrong.
Oh! That is based on Linus' "request" not to break userspace.
Oh, yeah, I guess that would do it :) It seems so wrong that it's
probably worth putting a comment above that exception.
So probably not worth much but
Acked-by: Serge Hallyn <serge@hallyn.com>
thanks,
-serge
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html