libceph: require cephx message signature by default
PATCH 1/1 libceph: require cephx message signature by default
Signed-off-by Yan, Zheng <[email protected]>
--- include/linux/ceph/libceph.h | 1 + net/ceph/ceph_common.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)
include/linux/ceph/libceph.h +1 -0
@@ -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
@@ -237,6 +237,8 @@ enum { Opt_noshare, Opt_crc, Opt_nocrc, + Opt_cephx_require_signatures, + Opt_nocephx_require_signatures, }; 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_signatures, "cephx_require_signatures"}, + {Opt_nocephx_require_signatures, "nocephx_require_signatures"}, {-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_signatures: + opt->flags &= ~CEPH_OPT_NOMSGAUTH ; +break ; +case Opt_nocephx_require_signatures: + 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
Quoted 54 lines · Zheng
Signed-off-by Yan, Zheng <[email protected]>--- include/linux/ceph/libceph.h | 1 + net/ceph/ceph_common.c | 13 +++++++++++++ 2 files changed, 14 insertions(+)include/linux/ceph/libceph.h +1
-0@@ -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 +10
-0@@ -237,6 +237,8 @@ enum { Opt_noshare, Opt_crc, Opt_nocrc, + Opt_cephx_require_signatures, + Opt_nocephx_require_signatures, }; 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_signatures, "cephx_require_signatures"}, + {Opt_nocephx_require_signatures, "nocephx_require_signatures"}, {-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_signatures: + opt->flags &= ~CEPH_OPT_NOMSGAUTH ; +break ; +case Opt_nocephx_require_signatures: + opt->flags |=CEPH_OPT_NOMSGAUTH ; +break ;default :BUG_ON (token);
net/ceph/ceph_common.c struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, · line 514
Quoted 9 lines
net/ceph/ceph_common.c +3
-0@@ -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;
Reviewed-by Ilya Dryomov <[email protected]>
Thanks,
Ilya