Skip to contentSkip to conversation

libceph: require cephx message signature by default

PATCH In review Yan, Zheng 2 participants 3 messages Nov 11, 2014 1 message not in the archive Ceph common code (libceph)

lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/1 libceph: require cephx message signature by default

---
 include/linux/ceph/libceph.h |  1 +
 net/ceph/ceph_common.c       | 13 +++++++++++++
 2 files changed, 14 insertions(+)
include/linux/ceph/libceph.h +1 -0
index d293f7e..8b11a79 100644
@@ -29,6 +29,7 @@
 #define CEPH_OPT_NOSHARE          (1<<1) /* don't share client with other sbs */
 #define CEPH_OPT_MYIP             (1<<2) /* specified my ip */
 #define CEPH_OPT_NOCRC            (1<<3) /* no data crc on writes */
+#define CEPH_OPT_NOMSGAUTH	  (1<<4) /* not require cephx message signature */
 
 #define CEPH_OPT_DEFAULT   (0)
 
net/ceph/ceph_common.c +13 -0
index d361a274..b22d82c 100644
@@ -237,6 +237,8 @@ enum {
 	Opt_noshare,
 	Opt_crc,
 	Opt_nocrc,
+	Opt_cephx_require_signature,
+	Opt_cephx_require_no_signature,
 };
 
 static match_table_t opt_tokens = {
@@ -255,6 +257,8 @@ static match_table_t opt_tokens = {
 	{Opt_noshare, "noshare"},
 	{Opt_crc, "crc"},
 	{Opt_nocrc, "nocrc"},
+	{Opt_cephx_require_signature, "cephx_require_signature"},
+	{Opt_cephx_require_no_signature, "cephx_require_no_signature"},
 	{-1, NULL}
 };
 
@@ -453,6 +457,12 @@ ceph_parse_options(char *options, const char *dev_name,
 		case Opt_nocrc:
 			opt->flags |= CEPH_OPT_NOCRC;
 			break;
+		case Opt_cephx_require_signature:
+			opt->flags &= ~CEPH_OPT_NOMSGAUTH;
+			break;
+		case Opt_cephx_require_no_signature:
+			opt->flags |= CEPH_OPT_NOMSGAUTH;
+			break;
 
 		default:
 			BUG_ON(token);
@@ -496,6 +506,9 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
 	init_waitqueue_head(&client->auth_wq);
 	client->auth_err = 0;
 
+	if (!ceph_test_opt(client, NOMSGAUTH))
+		required_features |= CEPH_FEATURE_MSG_AUTH;
+
 	client->extra_mon_dispatch = NULL;
 	client->supported_features = CEPH_FEATURES_SUPPORTED_DEFAULT |
 		supported_features;
Signature · 1 line
1.9.3
#1 lore raw
Quoted 32 lines · Zheng
---
 include/linux/ceph/libceph.h |  1 +
 net/ceph/ceph_common.c       | 13 +++++++++++++
 2 files changed, 14 insertions(+)
include/linux/ceph/libceph.h +1 -0
index d293f7e..8b11a79 100644
@@ -29,6 +29,7 @@
 #define CEPH_OPT_NOSHARE          (1<<1) /* don't share client with other sbs */
 #define CEPH_OPT_MYIP             (1<<2) /* specified my ip */
 #define CEPH_OPT_NOCRC            (1<<3) /* no data crc on writes */
+#define CEPH_OPT_NOMSGAUTH       (1<<4) /* not require cephx message signature */
 
 #define CEPH_OPT_DEFAULT   (0)
 
net/ceph/ceph_common.c +2 -0
index d361a274..b22d82c 100644
@@ -237,6 +237,8 @@ enum {
        Opt_noshare,
        Opt_crc,
        Opt_nocrc,
+       Opt_cephx_require_signature,
+       Opt_cephx_require_no_signature,
 };
 
 static match_table_t opt_tokens = {

net/ceph/ceph_common.c static match_table_t opt_tokens = { · line 261

Quoted 5 lines
net/ceph/ceph_common.c +2 -0
@@ -255,6 +257,8 @@ static match_table_t opt_tokens = {
        {Opt_noshare, "noshare"},
        {Opt_crc, "crc"},
        {Opt_nocrc, "nocrc"},
+       {Opt_cephx_require_signature, "cephx_require_signature"},
+       {Opt_cephx_require_no_signature, "cephx_require_no_signature"},

Maybe "cephx_require_signatures", "nocephx_require_signatures" ? It would (almost) match injectargs and be more in line with general mount option conventions.

Thanks,

Ilya

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 51 lines · 严正

在 2014年11月11日,17:51,Ilya Dryomov <[email protected]> 写道:

On Tue, Nov 11, 2014 at 11:38 AM, Yan, Zheng <[email protected]> wrote:

---
include/linux/ceph/libceph.h | 1 +
net/ceph/ceph_common.c | 13 +++++++++++++

2 files changed, 14 insertions(+)
include/linux/ceph/libceph.h +0 -0
index d293f7e..8b11a79 100644
@@ -29,6 +29,7 @@
 #define CEPH_OPT_NOSHARE          (1<<1) /* don't share client with other

sbs */

#define CEPH_OPT_MYIP             (1<<2) /* specified my ip */
#define CEPH_OPT_NOCRC            (1<<3) /* no data crc on writes */
+#define CEPH_OPT_NOMSGAUTH       (1<<4) /* not require cephx message

signature */

#define CEPH_OPT_DEFAULT (0)

net/ceph/ceph_common.c +4 -0
index d361a274..b22d82c 100644
@@ -237,6 +237,8 @@ enum {
       Opt_noshare,
       Opt_crc,
       Opt_nocrc,
+       Opt_cephx_require_signature,
+       Opt_cephx_require_no_signature,
 };
 
 static match_table_t opt_tokens = {
@@ -255,6 +257,8 @@ static match_table_t opt_tokens = {
       {Opt_noshare, "noshare"},
       {Opt_crc, "crc"},
       {Opt_nocrc, "nocrc"},
+       {Opt_cephx_require_signature, "cephx_require_signature"},
+       {Opt_cephx_require_no_signature, "cephx_require_no_signature"},
 
 

Maybe "cephx_require_signatures", "nocephx_require_signatures" ? It would (almost) match injectargs and be more in line with general mount option conventions.

Quoted 2 lines

nocephx_require_signature looks wired. I don’t like it. how about cephx_not_require_signaure.

First, whatever we settle on should end with "_signatures", not "_signature" because that's how it's spelled out in config_opts.h.

The second issue is how to express negation. For mount options it's conventional to have a "no" prepended. Now, whether or not that "no" should be separated with an underscore is debatable, mount(8) man page has examples of both:

auto_da_alloc/noauto_da_alloc
block_validity/noblock_validity

hashed_relocation/no_unhashed_relocation
bulk_read/no_bulk_read

I'd personally go with the first option (i.e. no underscore), as it's much more common.

Thanks,

Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html