aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/auth.h
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2009-11-18 19:19:57 -0500
committerSage Weil <sage@newdream.net>2009-11-18 19:19:57 -0500
commit4e7a5dcd1bbab6560fbc8ada29a840e7a20ed7bc (patch)
treea77e9b4563022340361ca673ef2e1beebb538e2f /fs/ceph/auth.h
parent5f44f142601bf94c448e2d463f0f18fd159da164 (diff)
ceph: negotiate authentication protocol; implement AUTH_NONE protocol
When we open a monitor session, we send an initial AUTH message listing the auth protocols we support, our entity name, and (possibly) a previously assigned global_id. The monitor chooses a protocol and responds with an initial message. Initially implement AUTH_NONE, a dummy protocol that provides no security, but works within the new framework. It generates 'authorizers' that are used when connecting to (mds, osd) services that simply state our entity name and global_id. This is a wire protocol change. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/auth.h')
-rw-r--r--fs/ceph/auth.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/fs/ceph/auth.h b/fs/ceph/auth.h
new file mode 100644
index 000000000000..4d8cdf6bb3b6
--- /dev/null
+++ b/fs/ceph/auth.h
@@ -0,0 +1,77 @@
1#ifndef _FS_CEPH_AUTH_H
2#define _FS_CEPH_AUTH_H
3
4#include "types.h"
5#include "buffer.h"
6
7/*
8 * Abstract interface for communicating with the authenticate module.
9 * There is some handshake that takes place between us and the monitor
10 * to acquire the necessary keys. These are used to generate an
11 * 'authorizer' that we use when connecting to a service (mds, osd).
12 */
13
14struct ceph_auth_client;
15struct ceph_authorizer;
16
17struct ceph_auth_client_ops {
18 /*
19 * true if we are authenticated and can connect to
20 * services.
21 */
22 int (*is_authenticated)(struct ceph_auth_client *ac);
23
24 /*
25 * build requests and process replies during monitor
26 * handshake. if handle_reply returns -EAGAIN, we build
27 * another request.
28 */
29 int (*build_request)(struct ceph_auth_client *ac, void *buf, void *end);
30 int (*handle_reply)(struct ceph_auth_client *ac, int result,
31 void *buf, void *end);
32
33 /*
34 * Create authorizer for connecting to a service, and verify
35 * the response to authenticate the service.
36 */
37 int (*create_authorizer)(struct ceph_auth_client *ac, int peer_type,
38 struct ceph_authorizer **a,
39 void **buf, size_t *len,
40 void **reply_buf, size_t *reply_len);
41 int (*verify_authorizer_reply)(struct ceph_auth_client *ac,
42 struct ceph_authorizer *a, size_t len);
43 void (*destroy_authorizer)(struct ceph_auth_client *ac,
44 struct ceph_authorizer *a);
45
46 /* reset when we (re)connect to a monitor */
47 void (*reset)(struct ceph_auth_client *ac);
48
49 void (*destroy)(struct ceph_auth_client *ac);
50};
51
52struct ceph_auth_client {
53 u32 protocol; /* CEPH_AUTH_* */
54 void *private; /* for use by protocol implementation */
55 const struct ceph_auth_client_ops *ops; /* null iff protocol==0 */
56
57 bool negotiating; /* true if negotiating protocol */
58 const char *name; /* entity name */
59 u64 global_id; /* our unique id in system */
60 const char *secret; /* our secret key */
61 unsigned want_keys; /* which services we want */
62};
63
64extern struct ceph_auth_client *ceph_auth_init(const char *name,
65 const char *secret);
66extern void ceph_auth_destroy(struct ceph_auth_client *ac);
67
68extern void ceph_auth_reset(struct ceph_auth_client *ac);
69
70extern int ceph_auth_build_hello(struct ceph_auth_client *ac,
71 void *buf, size_t len);
72extern int ceph_handle_auth_reply(struct ceph_auth_client *ac,
73 void *buf, size_t len,
74 void *reply_buf, size_t reply_len);
75extern int ceph_entity_name_encode(const char *name, void **p, void *end);
76
77#endif