[ \fB\-\-gen-key\fR ]
[ \fB\-a\fR | \fB\-\-add-key \fIbase64_key\fP ]
[ \fB\-\-caps\fR \fIcapfils\fP ]
+[ \fB\-b\fR | \fB\-\-bin\fR ]
.SH DESCRIPTION
.B cauthtool
is a utility to create, view, and modify a Ceph keyring file. A keyring
.SH OPTIONS
.TP
\fB\-l\fP, \fB\-\-list\fP
-will list all keys and capabilities present in the keyring.
+will list all keys and capabilities present in the keyring
.TP
\fB\-p\fP, \fB\-\-print\fP
-will print an encoded key for the specified \fIentityname\fP. This is suitable for the mount -o secret= argument.
+will print an encoded key for the specified \fIentityname\fP. This is suitable for the mount -o secret= argument
.TP
\fB\-c\fP, \fB\-\-create-keyring\fP
-will create a new keyring, overwriting any existing \fIkeyringfile\fP.
+will create a new keyring, overwriting any existing \fIkeyringfile\fP
.TP
\fB\-\-gen\-key\fP
-will generate a new secret key for the specified \fIentityname\fP:
+will generate a new secret key for the specified \fIentityname\fP
.TP
\fB\-\-add\-key\fP
-will add an encoded key to the keyring.
+will add an encoded key to the keyring
.TP
\fB\-\-cap\fI subsystem capability \fP
-will set the capability for given subsystem.
+will set the capability for given subsystem
.TP
\fB\-\-caps\fI capsfile \fP
-will set all of capabilities associated with a given key, for all subsystems.
+will set all of capabilities associated with a given key, for all subsystems
+.TP
+\fB\-b\fP, \fB\-\-bin\fP
+will create a binary formatted keyring
.SH CAPABILITIES
.SH EXAMPLE
To create a new keyring containing a key for \fIclient.foo\fP:
.IP
-cauthtool -c -n client.foo --gen-key keyring.bin
+cauthtool -c -n client.foo --gen-key keyring
.PP
To associate some capabilities with the key (namely, the ability to mount a Ceph filesystem):
.IP
-cauthtool -n client.foo --cap mds 'allow' --cap osd 'allow rw pool=data' --cap mon 'allow r' keyring.bin
+cauthtool -n client.foo --cap mds 'allow' --cap osd 'allow rw pool=data' --cap mon 'allow r' keyring
.PP
To display the contents of the keyring:
.IP
-cauthtool -l keyring.bin
+cauthtool -l keyring
.PP
When mount a Ceph file system, you can grab the appropriately encoded secret key with
.IP
-mount -t ceph serverhost:/ mountpoint -o name=foo,secret=`cauthtool -p -n client.foo keyring.bin`
+mount -t ceph serverhost:/ mountpoint -o name=foo,secret=`cauthtool -p -n client.foo keyring`
.PP
.SH AVAILABILITY
.B cauthtool
void usage()
{
- cout << " usage: [--create-keyring] [--gen-key] [--name=<name>] [--set-uid=uid] [--caps=<filename>] [--list] [--print-key] <filename>" << std::endl;
+ cout << "usage: cauthtool keyringfile [OPTIONS]...\n"
+ << "where the options are:\n"
+ << " -l, --list will list all keys and capabilities present in\n"
+ << " the keyring\n"
+ << " -p, --print will print an encoded key for the specified\n"
+ << " entityname. This is suitable for the\n"
+ << " 'mount -o secret=..' argument\n"
+ << " -c, --create-keyring will create a new keyring, overwriting any\n"
+ << " existing keyringfile\n"
+ << " --gen-key will generate a new secret key for the\n"
+ << " specified entityname\n"
+ << " --add-key will add an encoded key to the keyring\n"
+ << " --cap subsystem capability will set the capability for given subsystem\n"
+ << " --caps capsfile will set all of capabilities associated with a\n"
+ << " given key, for all subsystems\n"
+ << " -b, --bin will create a binary formatted keyring" << std::endl;
exit(1);
}
}
}
-static void keyring_init(const char *filename)
+static void keyring_init(const char *filesearch)
{
+ const char *filename = filesearch;
+ string keyring_search = g_conf.keyring;
+ string new_keyring;
+ if (ceph_resolve_file_search(keyring_search, new_keyring)) {
+ filename = new_keyring.c_str();
+ }
+
int ret = g_keyring.load(filename);
if (ret) {
derr << "keyring_init: failed to load " << filename << dendl;
fi
if [ -z "$adminkeyring" ]; then
- echo "mkcephfs requires '-k /path/to/admin/keyring'. default location is /etc/ceph/keyring.bin."
+ echo "mkcephfs requires '-k /path/to/admin/keyring'. default location is /etc/ceph/keyring."
usage_exit
fi
if [ -n "$ssh" ]; then
if [ -n "$user" ]; then
- scp -p $adminkeyring $user@$host:$mon_data/admin_keyring.bin
+ scp -p $adminkeyring $user@$host:$mon_data/admin_keyring
else
- scp -p $adminkeyring $host:$mon_data/admin_keyring.bin
+ scp -p $adminkeyring $host:$mon_data/admin_keyring
fi
else
- cp -av $adminkeyring $mon_data/admin_keyring.bin
+ cp -av $adminkeyring $mon_data/admin_keyring
fi
fi