[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1304084515-22132-4-git-send-email-roberto.sassu@polito.it>
Date: Fri, 29 Apr 2011 15:41:51 +0200
From: Roberto Sassu <roberto.sassu@...ito.it>
To: linux-security-module@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
dhowells@...hat.com, jmorris@...ei.org, zohar@...ux.vnet.ibm.com,
safford@...son.ibm.com, tyhicks@...ux.vnet.ibm.com,
kirkland@...onical.com, ecryptfs-devel@...ts.launchpad.net,
casey@...aufler-ca.com, eparis@...hat.com, sds@...ho.nsa.gov,
selinux@...ho.nsa.gov, viro@...iv.linux.org.uk,
john.johansen@...onical.com, apparmor@...ts.ubuntu.com,
Roberto Sassu <roberto.sassu@...ito.it>
Subject: [RFC][PATCH 3/4] eCryptfs: override prepared credentials
The new mount parameter 'ecryptfs_security_ctx' allows to override the
security label of the filesystem's credentials. This feature can be used to
identify or restrict actions performed by a specific eCryptfs filesystem.
Signed-off-by: Roberto Sassu <roberto.sassu@...ito.it>
---
fs/ecryptfs/main.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index d53f834..075634b 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -254,7 +254,7 @@ enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig,
ecryptfs_opt_encrypted_view, ecryptfs_opt_fnek_sig,
ecryptfs_opt_fn_cipher, ecryptfs_opt_fn_cipher_key_bytes,
ecryptfs_opt_unlink_sigs, ecryptfs_opt_mount_auth_tok_only,
- ecryptfs_opt_err };
+ ecryptfs_opt_security_ctx, ecryptfs_opt_err };
static const match_table_t tokens = {
{ecryptfs_opt_sig, "sig=%s"},
@@ -270,6 +270,7 @@ static const match_table_t tokens = {
{ecryptfs_opt_fn_cipher_key_bytes, "ecryptfs_fn_key_bytes=%u"},
{ecryptfs_opt_unlink_sigs, "ecryptfs_unlink_sigs"},
{ecryptfs_opt_mount_auth_tok_only, "ecryptfs_mount_auth_tok_only"},
+ {ecryptfs_opt_security_ctx, "ecryptfs_security_ctx=%s"},
{ecryptfs_opt_err, NULL}
};
@@ -365,6 +366,7 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options)
char *fnek_src;
char *cipher_key_bytes_src;
char *fn_cipher_key_bytes_src;
+ char *security_ctx = NULL;
if (!options) {
rc = -EINVAL;
@@ -474,6 +476,9 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options)
mount_crypt_stat->flags |=
ECRYPTFS_GLOBAL_MOUNT_AUTH_TOK_ONLY;
break;
+ case ecryptfs_opt_security_ctx:
+ security_ctx = args[0].from;
+ break;
case ecryptfs_opt_err:
default:
printk(KERN_WARNING
@@ -505,6 +510,15 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options)
&& !fn_cipher_key_bytes_set)
mount_crypt_stat->global_default_fn_cipher_key_bytes =
mount_crypt_stat->global_default_cipher_key_size;
+ if (security_ctx) {
+ rc = set_security_override_from_ctx(
+ mount_crypt_stat->subject_cred, security_ctx);
+ if (rc) {
+ printk(KERN_ERR "%s: set_security_override_from_ctx "
+ "failed: rc = [%d]\n", __func__, rc);
+ goto out;
+ }
+ }
mutex_lock(&key_tfm_list_mutex);
if (!ecryptfs_tfm_exists(mount_crypt_stat->global_default_cipher_name,
NULL)) {
--
1.7.4.4
Download attachment "smime.p7s" of type "application/x-pkcs7-signature" (2061 bytes)
Powered by blists - more mailing lists