diff options
author | Roberto Sassu <roberto.sassu@polito.it> | 2010-10-06 12:31:32 -0400 |
---|---|---|
committer | Tyler Hicks <tyhicks@linux.vnet.ibm.com> | 2010-10-29 11:31:36 -0400 |
commit | f16feb5119a87f5e683be7e8916c060abfb0e8d6 (patch) | |
tree | ed80e0f8d2d8c5b63c8b48e11da4eca0163bb9f4 /fs | |
parent | 39fac853a758306285404368fbe392408057b136 (diff) |
ecryptfs: added ecryptfs_mount_auth_tok_only mount parameter
This patch adds a new mount parameter 'ecryptfs_mount_auth_tok_only' to
force ecryptfs to use only authentication tokens which signature has
been specified at mount time with parameters 'ecryptfs_sig' and
'ecryptfs_fnek_sig'. In this way, after disabling the passthrough and
the encrypted view modes, it's possible to make available to users only
files encrypted with the specified authentication token.
Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Cc: Dustin Kirkland <kirkland@canonical.com>
Cc: James Morris <jmorris@namei.org>
[Tyler: Clean up coding style errors found by checkpatch]
Signed-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 1 | ||||
-rw-r--r-- | fs/ecryptfs/keystore.c | 9 | ||||
-rw-r--r-- | fs/ecryptfs/main.c | 8 |
3 files changed, 17 insertions, 1 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 0032a9f5a3a9..59ab793fc01b 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -377,6 +377,7 @@ struct ecryptfs_mount_crypt_stat { | |||
377 | #define ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES 0x00000010 | 377 | #define ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES 0x00000010 |
378 | #define ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK 0x00000020 | 378 | #define ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK 0x00000020 |
379 | #define ECRYPTFS_GLOBAL_ENCFN_USE_FEK 0x00000040 | 379 | #define ECRYPTFS_GLOBAL_ENCFN_USE_FEK 0x00000040 |
380 | #define ECRYPTFS_GLOBAL_MOUNT_AUTH_TOK_ONLY 0x00000080 | ||
380 | u32 flags; | 381 | u32 flags; |
381 | struct list_head global_auth_tok_list; | 382 | struct list_head global_auth_tok_list; |
382 | struct mutex global_auth_tok_list_mutex; | 383 | struct mutex global_auth_tok_list_mutex; |
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index e7f029f00c6b..b1f6858a5223 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
@@ -459,6 +459,15 @@ ecryptfs_find_auth_tok_for_sig( | |||
459 | if (ecryptfs_find_global_auth_tok_for_sig(&global_auth_tok, | 459 | if (ecryptfs_find_global_auth_tok_for_sig(&global_auth_tok, |
460 | mount_crypt_stat, sig)) { | 460 | mount_crypt_stat, sig)) { |
461 | 461 | ||
462 | /* if the flag ECRYPTFS_GLOBAL_MOUNT_AUTH_TOK_ONLY is set in the | ||
463 | * mount_crypt_stat structure, we prevent to use auth toks that | ||
464 | * are not inserted through the ecryptfs_add_global_auth_tok | ||
465 | * function. | ||
466 | */ | ||
467 | if (mount_crypt_stat->flags | ||
468 | & ECRYPTFS_GLOBAL_MOUNT_AUTH_TOK_ONLY) | ||
469 | return -EINVAL; | ||
470 | |||
462 | rc = ecryptfs_keyring_auth_tok_for_sig(auth_tok_key, auth_tok, | 471 | rc = ecryptfs_keyring_auth_tok_for_sig(auth_tok_key, auth_tok, |
463 | sig); | 472 | sig); |
464 | } else | 473 | } else |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index cbd4e18adb20..09eb5296aebb 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
@@ -208,7 +208,8 @@ enum { ecryptfs_opt_sig, ecryptfs_opt_ecryptfs_sig, | |||
208 | ecryptfs_opt_passthrough, ecryptfs_opt_xattr_metadata, | 208 | ecryptfs_opt_passthrough, ecryptfs_opt_xattr_metadata, |
209 | ecryptfs_opt_encrypted_view, ecryptfs_opt_fnek_sig, | 209 | ecryptfs_opt_encrypted_view, ecryptfs_opt_fnek_sig, |
210 | ecryptfs_opt_fn_cipher, ecryptfs_opt_fn_cipher_key_bytes, | 210 | ecryptfs_opt_fn_cipher, ecryptfs_opt_fn_cipher_key_bytes, |
211 | ecryptfs_opt_unlink_sigs, ecryptfs_opt_err }; | 211 | ecryptfs_opt_unlink_sigs, ecryptfs_opt_mount_auth_tok_only, |
212 | ecryptfs_opt_err }; | ||
212 | 213 | ||
213 | static const match_table_t tokens = { | 214 | static const match_table_t tokens = { |
214 | {ecryptfs_opt_sig, "sig=%s"}, | 215 | {ecryptfs_opt_sig, "sig=%s"}, |
@@ -223,6 +224,7 @@ static const match_table_t tokens = { | |||
223 | {ecryptfs_opt_fn_cipher, "ecryptfs_fn_cipher=%s"}, | 224 | {ecryptfs_opt_fn_cipher, "ecryptfs_fn_cipher=%s"}, |
224 | {ecryptfs_opt_fn_cipher_key_bytes, "ecryptfs_fn_key_bytes=%u"}, | 225 | {ecryptfs_opt_fn_cipher_key_bytes, "ecryptfs_fn_key_bytes=%u"}, |
225 | {ecryptfs_opt_unlink_sigs, "ecryptfs_unlink_sigs"}, | 226 | {ecryptfs_opt_unlink_sigs, "ecryptfs_unlink_sigs"}, |
227 | {ecryptfs_opt_mount_auth_tok_only, "ecryptfs_mount_auth_tok_only"}, | ||
226 | {ecryptfs_opt_err, NULL} | 228 | {ecryptfs_opt_err, NULL} |
227 | }; | 229 | }; |
228 | 230 | ||
@@ -406,6 +408,10 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options) | |||
406 | case ecryptfs_opt_unlink_sigs: | 408 | case ecryptfs_opt_unlink_sigs: |
407 | mount_crypt_stat->flags |= ECRYPTFS_UNLINK_SIGS; | 409 | mount_crypt_stat->flags |= ECRYPTFS_UNLINK_SIGS; |
408 | break; | 410 | break; |
411 | case ecryptfs_opt_mount_auth_tok_only: | ||
412 | mount_crypt_stat->flags |= | ||
413 | ECRYPTFS_GLOBAL_MOUNT_AUTH_TOK_ONLY; | ||
414 | break; | ||
409 | case ecryptfs_opt_err: | 415 | case ecryptfs_opt_err: |
410 | default: | 416 | default: |
411 | printk(KERN_WARNING | 417 | printk(KERN_WARNING |