summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2014-07-01 11:49:07 -0400
committerGreg Hudson <ghudson@mit.edu>2014-07-30 13:00:55 -0400
commit2fa226e13ee3e7a6fddbfb68b27ed6b2c14c8474 (patch)
treedf04e476f53389447a825c8070748ecbf3167abd /src/include
parent8641f87bab24926688a91590040e5b8903e10897 (diff)
Add KCM credential cache type (client only)
Add a new credential cache type "KCM" which performs cache operations by speaking to a Heimdal or OS X KCM daemon, via either Unix domain sockets or (on OS X only) Mach RPC. Add "kcm_socket" and "kcm_mach_service" profile variables to control the socket path and bootstrap service name respectively. In ccmarshal.c, add k5_marshal_mcred to marshal matching credentials in the KCM protocol representation. This cache type is not currently supported on Windows, as Windows does not support Unix domain sockets. As with the keyring cache type, the lastchange method of this cache type is mostly useless, reporting only the time of the last change made through that cache handle. The KCM protocol currently has no support for obtaining the last change time of the cache itself. ticket: 7964 (new)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/k5-int.h2
-rw-r--r--src/include/kcm.h95
2 files changed, 97 insertions, 0 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index d9cb5a4b2..d87b84817 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -225,6 +225,8 @@ typedef unsigned char u_char;
#define KRB5_CONF_K5LOGIN_AUTHORITATIVE "k5login_authoritative"
#define KRB5_CONF_K5LOGIN_DIRECTORY "k5login_directory"
#define KRB5_CONF_KADMIND_PORT "kadmind_port"
+#define KRB5_CONF_KCM_MACH_SERVICE "kcm_mach_service"
+#define KRB5_CONF_KCM_SOCKET "kcm_socket"
#define KRB5_CONF_KDC "kdc"
#define KRB5_CONF_KDCDEFAULTS "kdcdefaults"
#define KRB5_CONF_KDC_DEFAULT_OPTIONS "kdc_default_options"
diff --git a/src/include/kcm.h b/src/include/kcm.h
new file mode 100644
index 000000000..5ea1447cd
--- /dev/null
+++ b/src/include/kcm.h
@@ -0,0 +1,95 @@
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/* include/kcm.h - Kerberos cache manager protocol declarations */
+/*
+ * Copyright (C) 2014 by the Massachusetts Institute of Technology.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef KCM_H
+#define KCM_H
+
+#define KCM_PROTOCOL_VERSION_MAJOR 2
+#define KCM_PROTOCOL_VERSION_MINOR 0
+
+#define KCM_UUID_LEN 16
+
+/* This should ideally be in RUNSTATEDIR, but Heimdal uses a hardcoded
+ * /var/run, and we need to use the same default path. */
+#define DEFAULT_KCM_SOCKET_PATH "/var/run/.heim_org.h5l.kcm-socket"
+#define DEFAULT_KCM_MACH_SERVICE "org.h5l.kcm"
+
+/*
+ * All requests begin with:
+ * major version (1 bytes)
+ * minor version (1 bytes)
+ * opcode (16-bit big-endian)
+ *
+ * All replies begin with a 32-bit big-endian reply code.
+ *
+ * Parameters are appended to the request or reply with no delimiters. Flags
+ * and time offsets are stored as 32-bit big-endian integers. Names are
+ * marshalled as zero-terminated strings. Principals and credentials are
+ * marshalled in the v4 FILE ccache format. UUIDs are 16 bytes. UUID lists
+ * are not delimited, so nothing can come after them.
+ */
+
+/* Opcodes without comments are currently unused in the MIT client
+ * implementation. */
+typedef enum kcm_opcode {
+ KCM_OP_NOOP,
+ KCM_OP_GET_NAME,
+ KCM_OP_RESOLVE,
+ KCM_OP_GEN_NEW, /* () -> (name) */
+ KCM_OP_INITIALIZE, /* (name, princ) -> () */
+ KCM_OP_DESTROY, /* (name) -> () */
+ KCM_OP_STORE, /* (name, cred) -> () */
+ KCM_OP_RETRIEVE,
+ KCM_OP_GET_PRINCIPAL, /* (name) -> (princ) */
+ KCM_OP_GET_CRED_UUID_LIST, /* (name) -> (uuid, ...) */
+ KCM_OP_GET_CRED_BY_UUID, /* (name, uuid) -> (cred) */
+ KCM_OP_REMOVE_CRED, /* (name, flags, credtag) -> () */
+ KCM_OP_SET_FLAGS,
+ KCM_OP_CHOWN,
+ KCM_OP_CHMOD,
+ KCM_OP_GET_INITIAL_TICKET,
+ KCM_OP_GET_TICKET,
+ KCM_OP_MOVE_CACHE,
+ KCM_OP_GET_CACHE_UUID_LIST, /* () -> (uuid, ...) */
+ KCM_OP_GET_CACHE_BY_UUID, /* (uuid) -> (name) */
+ KCM_OP_GET_DEFAULT_CACHE, /* () -> (name) */
+ KCM_OP_SET_DEFAULT_CACHE, /* (name) -> () */
+ KCM_OP_GET_KDC_OFFSET, /* (name) -> (offset) */
+ KCM_OP_SET_KDC_OFFSET, /* (name, offset) -> () */
+ KCM_OP_ADD_NTLM_CRED,
+ KCM_OP_HAVE_NTLM_CRED,
+ KCM_OP_DEL_NTLM_CRED,
+ KCM_OP_DO_NTLM_AUTH,
+ KCM_OP_GET_NTLM_USER_LIST
+} kcm_opcode;
+
+#endif /* KCM_H */