mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
Use rfc3961 library to decrypt kerberos 5 tickets
Decrypt tickets with non-des enctypes by calling out to the rfc3961 library.
This requires the security object to be given an enhanced get_key callback
that supports looking up keys by enctype.
Include a wrapper around afsconf_GetKeyByTypes so rxkad doesn't have
to know anything about libauth internals/interfaces
(cherry-picked from ea4812f03d
)
Change-Id: Id2b085fb41e2ed3576ec66b2914c03e78c0077ec
This commit is contained in:
parent
c6a990bf9e
commit
dc4b459e02
@ -213,7 +213,7 @@ afs: config export comerr afs_depinstall
|
||||
sys: cmd comerr afs hcrypto rx rxstat fsint auth sys_depinstall
|
||||
+${COMPILE_PART1} sys ${COMPILE_PART2}
|
||||
|
||||
rxkad: cmd comerr hcrypto rx rxkad_depinstall
|
||||
rxkad: cmd comerr hcrypto rfc3961 rx rxkad_depinstall
|
||||
+${COMPILE_PART1} rxkad ${COMPILE_PART2}
|
||||
|
||||
auth: cmd comerr hcrypto lwp rx rxkad audit sys_depinstall auth_depinstall
|
||||
|
@ -320,6 +320,7 @@ LOGON_DLLLIBS =\
|
||||
$(DESTDIR)\lib\afs\afsutil.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrpc.lib \
|
||||
$(LANAHELPERLIB) \
|
||||
$(AFSKFWLIB)
|
||||
|
||||
@ -404,7 +405,8 @@ EXELIBS = \
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
EXELIBS2 = \
|
||||
$(DESTDIR)\lib\afsrpc.lib \
|
||||
|
@ -103,7 +103,8 @@ EXELIBS = \
|
||||
$(DESTDIR)\lib\afs\TaAfsAppLib.lib \
|
||||
$(DESTDIR)\lib\afs\afsutil.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrpc.lib
|
||||
|
||||
############################################################################
|
||||
|
||||
|
@ -38,7 +38,8 @@ EXELIBS = \
|
||||
$(DESTDIR)\lib\afsrpc.lib \
|
||||
$(DESTDIR)\lib\afsauthent.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrpc.lib
|
||||
|
||||
!IF "$(CPU)" == "IA64" || "$(CPU)" == "AMD64" || "$(CPU)" == "ALPHA64"
|
||||
OTHERLIBS = \
|
||||
|
@ -72,7 +72,8 @@ EXELIBS = \
|
||||
$(DESTDIR)\lib\afs\afscom_err.lib \
|
||||
$(DESTDIR)\lib\afs\afsutil.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrpc.lib
|
||||
|
||||
|
||||
############################################################################
|
||||
|
@ -98,6 +98,7 @@ OBJFILES= \
|
||||
|
||||
LIBFILES= \
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrpc.lib \
|
||||
$(DESTDIR)\lib\afsauthent.lib \
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\afs\mtafsutil.lib\
|
||||
|
@ -17,6 +17,7 @@ KOBJS= cellconfig.o keys.o ktc.krb.o userok.o writeconfig.o authcon.o \
|
||||
|
||||
LIBS=libauth.a \
|
||||
${TOP_LIBDIR}/librxkad.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/librx.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/liblwp.a \
|
||||
|
@ -99,7 +99,8 @@ EXELIBS =\
|
||||
$(EXELIBDIR)\libafsconf.lib \
|
||||
$(EXELIBDIR)\opr.lib \
|
||||
$(EXELIBDIR)\afshcrypto.lib \
|
||||
$(EXELIBDIR)\afsroken.lib
|
||||
$(EXELIBDIR)\afsroken.lib \
|
||||
$(EXELIBDIR)\afsrfc3961.lib
|
||||
|
||||
$(SETKEY_EXEFILE): $(SETKEY_EXEOBJS) $(EXELIBS)
|
||||
$(EXECONLINK) dnsapi.lib shell32.lib
|
||||
|
@ -42,6 +42,31 @@ QuickAuth(struct rx_securityClass **astr, afs_int32 *aindex)
|
||||
}
|
||||
|
||||
#if !defined(UKERNEL)
|
||||
static int _afsconf_GetRxkadKrb5Key(void *arock, int kvno, int enctype, void *outkey,
|
||||
size_t *keylen)
|
||||
{
|
||||
struct afsconf_dir *adir = arock;
|
||||
struct afsconf_typedKey *kobj;
|
||||
struct rx_opaque *keymat;
|
||||
afsconf_keyType tktype;
|
||||
int tkvno, tenctype;
|
||||
int code;
|
||||
|
||||
code = afsconf_GetKeyByTypes(adir, afsconf_rxkad_krb5, kvno, enctype, &kobj);
|
||||
if (code != 0)
|
||||
return code;
|
||||
afsconf_typedKey_values(kobj, &tktype, &tkvno, &tenctype, &keymat);
|
||||
if (*keylen < keymat->len) {
|
||||
afsconf_typedKey_put(&kobj);
|
||||
return AFSCONF_BADKEY;
|
||||
}
|
||||
memcpy(outkey, keymat->val, keymat->len);
|
||||
*keylen = keymat->len;
|
||||
afsconf_typedKey_put(&kobj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Return an appropriate security class and index */
|
||||
afs_int32
|
||||
afsconf_ServerAuth(void *arock,
|
||||
@ -53,7 +78,8 @@ afsconf_ServerAuth(void *arock,
|
||||
|
||||
LOCK_GLOBAL_MUTEX;
|
||||
tclass = (struct rx_securityClass *)
|
||||
rxkad_NewServerSecurityObject(0, adir, afsconf_GetKey, NULL);
|
||||
rxkad_NewKrb5ServerSecurityObject(0, adir, afsconf_GetKey,
|
||||
_afsconf_GetRxkadKrb5Key, NULL);
|
||||
if (tclass) {
|
||||
*astr = tclass;
|
||||
*aindex = RX_SECIDX_KAD;
|
||||
@ -254,12 +280,16 @@ afsconf_BuildServerSecurityObjects(void *rock,
|
||||
|
||||
(*classes)[0] = rxnull_NewServerSecurityObject();
|
||||
(*classes)[1] = NULL;
|
||||
(*classes)[2] = rxkad_NewServerSecurityObject(0, dir,
|
||||
afsconf_GetKey, NULL);
|
||||
(*classes)[2] = rxkad_NewKrb5ServerSecurityObject(0, dir,
|
||||
afsconf_GetKey,
|
||||
_afsconf_GetRxkadKrb5Key,
|
||||
NULL);
|
||||
|
||||
if (dir->securityFlags & AFSCONF_SECOPTS_ALWAYSENCRYPT)
|
||||
(*classes)[3] = rxkad_NewServerSecurityObject(rxkad_crypt, dir,
|
||||
afsconf_GetKey, NULL);
|
||||
(*classes)[3] = rxkad_NewKrb5ServerSecurityObject(rxkad_crypt, dir,
|
||||
afsconf_GetKey,
|
||||
_afsconf_GetRxkadKrb5Key,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -150,7 +150,8 @@ struct afsconf_typedKeyList {
|
||||
|
||||
typedef enum {
|
||||
afsconf_rxkad = 0,
|
||||
afsconf_rxgk =1
|
||||
afsconf_rxgk =1,
|
||||
afsconf_rxkad_krb5 =2
|
||||
} afsconf_keyType;
|
||||
|
||||
extern struct afsconf_typedKey *
|
||||
|
@ -38,6 +38,7 @@ LIBS= ${TOP_LIBDIR}/librx.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/libprocmgmt.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
OBJS=bosserver.o bnode.o ezbnodeops.o fsbnodeops.o bosint.ss.o bosint.xdr.o \
|
||||
|
@ -70,7 +70,8 @@ BOSSERVER_EXELIBS =\
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(BOSSERVER_EXEFILE): $(BOSSERVER_EXEOBJS) $(BOSSERVER_EXELIBS)
|
||||
$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
|
||||
@ -109,7 +110,8 @@ BOS_EXELIBS =\
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
|
||||
$(RS_BOS_EXEFILE): $(BOS_EXEOBJS) $(BOS_EXELIBS)
|
||||
|
@ -21,6 +21,7 @@ LIBS=${TOP_LIBDIR}/libbudb.a ${TOP_LIBDIR}/libbubasics.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
$(TOP_LIBDIR)/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
all: ${TOP_LIBDIR}/libbxdb.a ${TOP_INCDIR}/afs/bucoord_prototypes.h ${TOP_INCDIR}/afs/bc.h backup
|
||||
|
@ -93,7 +93,8 @@ EXELIBS =\
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
|
||||
$(EXEFILE): $(EXEOBJS) $(EXERES) $(EXELIBS)
|
||||
|
@ -42,6 +42,7 @@ LIBS=${TOP_LIBDIR}/libbubasics.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
COMMON_OBJS = database.o db_alloc.o db_dump.o db_hash.o struct_ops.o ol_verify.o
|
||||
|
@ -81,7 +81,8 @@ EXELIBS =\
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(EXEFILE): $(EXEOBJS) $(EXELIBS)
|
||||
$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
|
||||
|
@ -41,6 +41,7 @@ LIBS=${TOP_LIBDIR}/libbudb.a \
|
||||
${TOP_LIBDIR}/liblwp.a \
|
||||
${TOP_LIBDIR}/libcmd.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a \
|
||||
${TOP_LIBDIR}/libusd.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
|
@ -55,7 +55,8 @@ EXELIBS =\
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(EXERES): butc.rc AFS_component_version_number.h
|
||||
|
||||
|
@ -40,6 +40,7 @@ LIBS=${TOP_LIBDIR}/libubik.a \
|
||||
${TOP_LIBDIR}/libkauth.a \
|
||||
${TOP_LIBDIR}/libprot.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${XLIBS}
|
||||
|
||||
all: translate_et
|
||||
|
@ -26,6 +26,7 @@ LIBS=${TOP_LIBDIR}/libvolser.a ${TOP_LIBDIR}/vlib.a ${TOP_LIBDIR}/libacl.a \
|
||||
${TOP_LIBDIR}/liblwp.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/util.a ${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
all: ${TOP_INCDIR}/afs/fsprobe.h ${TOP_LIBDIR}/libfsprobe.a fsprobe_test
|
||||
|
@ -36,6 +36,7 @@ LIBS=\
|
||||
${TOP_LIBDIR}/libkauth.a \
|
||||
${TOP_LIBDIR}/libauth.a \
|
||||
${TOP_LIBDIR}/librxkad.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/util.a
|
||||
|
@ -33,6 +33,7 @@ LIBS=${TOP_LIBDIR}/libubik.a \
|
||||
${TOP_LIBDIR}/libafsutil.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
$(DBM) \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
UKSRCS=authclient.c user.c kautils.h kaserver.h kaaux.c katoken.c \
|
||||
@ -50,6 +51,7 @@ KLIBS=${TOP_LIBDIR}/libubik.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/libafsutil.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
OBJS=kauth.xdr.o kauth.cs.o kaaux.o client.o authclient.o katoken.o kautils.o kalocalcell.o kaerrors.o user.o krb_tf.o
|
||||
|
@ -95,7 +95,8 @@ AFSLIBS = \
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
TOKENLIB = $(DESTDIR)\lib\afs\afspioctl.lib
|
||||
|
||||
|
@ -18,7 +18,8 @@ EXELIBS = \
|
||||
$(DESTDIR)\afs\afsprot.lib \
|
||||
$(DESTDIR)\afsrx.lib \
|
||||
$(DESTDIR)\afs\afscom_err.lib \
|
||||
$(DESTDIR)\afs\afskauth.lib
|
||||
$(DESTDIR)\afs\afskauth.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
|
||||
$(OUT)\multiklog.exe: $(OUT)\multiklog.obj
|
||||
|
@ -340,6 +340,7 @@ EXPORTS
|
||||
initialize_RXK_error_table @345
|
||||
rx_GetNetworkError @346
|
||||
afs_set_com_err_hook @347
|
||||
rxkad_NewKrb5ServerSecurityObject @348
|
||||
|
||||
; for performance testing
|
||||
rx_TSFPQGlobSize @2001 DATA
|
||||
|
@ -22,6 +22,7 @@ LIBRARIES=${TOP_LIBDIR}/libauth.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \
|
||||
${TOP_LIBDIR}/util.a ${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
KLIBRARIES=${TOP_LIBDIR}/libauth.krb.a \
|
||||
@ -30,6 +31,7 @@ KLIBRARIES=${TOP_LIBDIR}/libauth.krb.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libcmd.a \
|
||||
${TOP_LIBDIR}/util.a ${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
#
|
||||
|
@ -39,6 +39,7 @@ LIBS= ${TOP_LIBDIR}/libubik.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/libafsutil.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
|
||||
|
@ -73,7 +73,8 @@ PTSERVER_EXELIBS =\
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
!IF (("$(SYS_NAME)"!="i386_win95" ) && ("$(SYS_NAME)"!="I386_WIN95" ))
|
||||
PTSERVER_EXELIBS =$(PTSERVER_EXELIBS) $(DESTDIR)\lib\afs\afsprocmgmt.lib
|
||||
@ -126,7 +127,8 @@ PTS_EXELIBS =\
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(PTS): $(PTS_EXEOBJS) $(PTS_EXELIBS)
|
||||
$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
|
||||
|
@ -78,6 +78,7 @@ struct rxkad_sprivate {
|
||||
int (*get_key) (void *, int,
|
||||
struct ktc_encryptionKey *);
|
||||
/* func. of kvno and server key ptr */
|
||||
rxkad_get_key_enctype_func get_key_enctype;
|
||||
int (*user_ok) (char *, char *,
|
||||
char *, afs_int32);
|
||||
/* func called with new client name */
|
||||
|
@ -91,6 +91,10 @@ typedef signed char rxkad_level;
|
||||
|
||||
|
||||
extern int rxkad_EpochWasSet; /* TRUE => we called rx_SetEpoch */
|
||||
/* Get key by enctype. Takes a rock (path to conf dir), kvno and enctype as
|
||||
* input and returns the key and key length. On input, the keylength parameter
|
||||
* must be set to the length of storage allocated by the caller. */
|
||||
typedef int (*rxkad_get_key_enctype_func) (void *, int, int, void *, size_t *);
|
||||
|
||||
#include <rx/rxkad_prototypes.h>
|
||||
|
||||
|
@ -108,6 +108,12 @@ extern struct rx_securityClass *rxkad_NewServerSecurityObject(rxkad_level
|
||||
char *cell,
|
||||
afs_int32
|
||||
kvno));
|
||||
extern struct rx_securityClass *rxkad_NewKrb5ServerSecurityObject
|
||||
(rxkad_level level, void *get_key_rock,
|
||||
int (*get_key) (void *get_key_rock, int kvno,
|
||||
struct ktc_encryptionKey *serverKey),
|
||||
rxkad_get_key_enctype_func get_key_enctype,
|
||||
int (*user_ok) (char *name, char *instance, char *cell, afs_int32 kvno));
|
||||
extern int rxkad_CheckAuthentication(struct rx_securityClass *aobj,
|
||||
struct rx_connection *aconn);
|
||||
extern int rxkad_CreateChallenge(struct rx_securityClass *aobj,
|
||||
@ -153,6 +159,7 @@ extern afs_uint32 _rxkad_crc_update(const char *p, size_t len, afs_uint32 res);
|
||||
extern int tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
|
||||
int (*get_key) (void *, int,
|
||||
struct ktc_encryptionKey *),
|
||||
rxkad_get_key_enctype_func get_key2,
|
||||
char *get_key_rock, int serv_kvno, char *name,
|
||||
char *inst, char *cell, struct ktc_encryptionKey *session_key,
|
||||
afs_int32 * host, afs_uint32 * start,
|
||||
|
@ -164,6 +164,23 @@ rxkad_NewServerSecurityObject(rxkad_level level, void *get_key_rock,
|
||||
return tsc;
|
||||
}
|
||||
|
||||
struct rx_securityClass *
|
||||
rxkad_NewKrb5ServerSecurityObject(rxkad_level level, void *get_key_rock,
|
||||
int (*get_key) (void *get_key_rock, int kvno,
|
||||
struct ktc_encryptionKey *
|
||||
serverKey),
|
||||
rxkad_get_key_enctype_func get_key_enctype,
|
||||
int (*user_ok) (char *name, char *instance,
|
||||
char *cell, afs_int32 kvno)
|
||||
) {
|
||||
struct rx_securityClass *tsc;
|
||||
struct rxkad_sprivate *tsp;
|
||||
tsc = rxkad_NewServerSecurityObject(level, get_key_rock, get_key, user_ok);
|
||||
tsp = (struct rxkad_sprivate *)tsc->privateData;
|
||||
tsp->get_key_enctype = get_key_enctype;
|
||||
return tsc;
|
||||
}
|
||||
|
||||
/* server: called to tell if a connection authenticated properly */
|
||||
|
||||
int
|
||||
@ -324,8 +341,9 @@ rxkad_CheckResponse(struct rx_securityClass *aobj,
|
||||
if (code == -1 && ((kvno == RXKAD_TKT_TYPE_KERBEROS_V5)
|
||||
|| (kvno == RXKAD_TKT_TYPE_KERBEROS_V5_ENCPART_ONLY))) {
|
||||
code =
|
||||
tkt_DecodeTicket5(tix, tlen, tsp->get_key, tsp->get_key_rock,
|
||||
kvno, client.name, client.instance, client.cell,
|
||||
tkt_DecodeTicket5(tix, tlen, tsp->get_key, tsp->get_key_enctype,
|
||||
tsp->get_key_rock, kvno, client.name,
|
||||
client.instance, client.cell,
|
||||
&sessionkey, &host, &start, &end,
|
||||
tsp->flags & RXS_CONFIG_FLAGS_DISABLE_DOTCHECK);
|
||||
if (code)
|
||||
|
@ -79,6 +79,10 @@
|
||||
#include "v5der.c"
|
||||
#include "v5gen.c"
|
||||
|
||||
#define RFC3961_NO_ENUMS
|
||||
#define RFC3961_NO_CKSUM
|
||||
#include <afs/rfc3961.h>
|
||||
|
||||
/*
|
||||
* Principal conversion Taken from src/lib/krb5/krb/conv_princ from MIT Kerberos. If you
|
||||
* find a need to change the services here, please consider opening a
|
||||
@ -174,12 +178,19 @@ static int
|
||||
int
|
||||
tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
|
||||
int (*get_key) (void *, int, struct ktc_encryptionKey *),
|
||||
rxkad_get_key_enctype_func get_key_enctype,
|
||||
char *get_key_rock, int serv_kvno, char *name, char *inst,
|
||||
char *cell, struct ktc_encryptionKey *session_key, afs_int32 * host,
|
||||
afs_uint32 * start, afs_uint32 * end, afs_int32 disableCheckdot)
|
||||
{
|
||||
char plain[MAXKRB5TICKETLEN];
|
||||
struct ktc_encryptionKey serv_key;
|
||||
void *keybuf;
|
||||
size_t keysize, allocsiz;
|
||||
krb5_context context;
|
||||
krb5_keyblock k;
|
||||
krb5_crypto cr;
|
||||
krb5_data plaindata;
|
||||
Ticket t5; /* Must free */
|
||||
EncTicketPart decr_part; /* Must free */
|
||||
int code;
|
||||
@ -222,25 +233,82 @@ tkt_DecodeTicket5(char *ticket, afs_int32 ticket_len,
|
||||
case ETYPE_DES_CBC_CRC:
|
||||
case ETYPE_DES_CBC_MD4:
|
||||
case ETYPE_DES_CBC_MD5:
|
||||
/* check ticket */
|
||||
if (t5.enc_part.cipher.length > sizeof(plain)
|
||||
|| t5.enc_part.cipher.length % 8 != 0)
|
||||
goto bad_ticket;
|
||||
|
||||
code = (*get_key) (get_key_rock, v5_serv_kvno, &serv_key);
|
||||
if (code)
|
||||
goto unknown_key;
|
||||
|
||||
/* Decrypt data here, save in plain, assume it will shrink */
|
||||
code =
|
||||
krb5_des_decrypt(&serv_key, t5.enc_part.etype,
|
||||
t5.enc_part.cipher.data, t5.enc_part.cipher.length,
|
||||
plain, &plainsiz);
|
||||
break;
|
||||
default:
|
||||
goto unknown_key;
|
||||
if (get_key_enctype == NULL)
|
||||
goto unknown_key;
|
||||
code = krb5_init_context(&context);
|
||||
if (code != 0)
|
||||
goto unknown_key;
|
||||
code = krb5_enctype_valid(context, t5.enc_part.etype);
|
||||
if (code != 0) {
|
||||
krb5_free_context(context);
|
||||
goto unknown_key;
|
||||
}
|
||||
code = krb5_enctype_keybits(context, t5.enc_part.etype, &keysize);
|
||||
if (code != 0) {
|
||||
krb5_free_context(context);
|
||||
goto unknown_key;
|
||||
}
|
||||
keysize = keysize / 8;
|
||||
allocsiz = keysize;
|
||||
keybuf = rxi_Alloc(allocsiz);
|
||||
/* this is not quite a hole for afsconf_GetKeyByTypes. A wrapper
|
||||
that calls afsconf_GetKeyByTypes and afsconf_typedKey_values
|
||||
is needed */
|
||||
code = get_key_enctype(get_key_rock, v5_serv_kvno, t5.enc_part.etype,
|
||||
keybuf, &keysize);
|
||||
if (code) {
|
||||
rxi_Free(keybuf, allocsiz);
|
||||
krb5_free_context(context);
|
||||
goto unknown_key;
|
||||
}
|
||||
code = krb5_keyblock_init(context, t5.enc_part.etype,
|
||||
keybuf, keysize, &k);
|
||||
rxi_Free(keybuf, allocsiz);
|
||||
if (code != 0) {
|
||||
krb5_free_context(context);
|
||||
goto unknown_key;
|
||||
}
|
||||
code = krb5_crypto_init(context, &k, t5.enc_part.etype, &cr);
|
||||
krb5_free_keyblock_contents(context, &k);
|
||||
if (code != 0) {
|
||||
krb5_free_context(context);
|
||||
goto unknown_key;
|
||||
}
|
||||
#ifndef KRB5_KU_TICKET
|
||||
#define KRB5_KU_TICKET 2
|
||||
#endif
|
||||
code = krb5_decrypt(context, cr, KRB5_KU_TICKET, t5.enc_part.cipher.data,
|
||||
t5.enc_part.cipher.length, &plaindata);
|
||||
krb5_crypto_destroy(context, cr);
|
||||
if (code == 0) {
|
||||
if (plaindata.length > MAXKRB5TICKETLEN) {
|
||||
krb5_data_free(&plaindata);
|
||||
krb5_free_context(context);
|
||||
goto bad_ticket;
|
||||
}
|
||||
memcpy(plain, plaindata.data, plaindata.length);
|
||||
plainsiz = plaindata.length;
|
||||
krb5_data_free(&plaindata);
|
||||
}
|
||||
krb5_free_context(context);
|
||||
}
|
||||
|
||||
/* check ticket */
|
||||
if (t5.enc_part.cipher.length > sizeof(plain)
|
||||
|| t5.enc_part.cipher.length % 8 != 0)
|
||||
goto bad_ticket;
|
||||
|
||||
code = (*get_key) (get_key_rock, v5_serv_kvno, &serv_key);
|
||||
if (code)
|
||||
goto unknown_key;
|
||||
|
||||
/* Decrypt data here, save in plain, assume it will shrink */
|
||||
code =
|
||||
krb5_des_decrypt(&serv_key, t5.enc_part.etype,
|
||||
t5.enc_part.cipher.data, t5.enc_part.cipher.length,
|
||||
plain, &plainsiz);
|
||||
if (code != 0)
|
||||
goto bad_ticket;
|
||||
|
||||
|
@ -43,6 +43,7 @@ LIBS=${TOP_LIBDIR}/libgtx.a \
|
||||
${TOP_LIBDIR}/liblwp.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
all: scout
|
||||
|
@ -25,6 +25,7 @@ AFSLIBS=${TOP_LIBDIR}/libkauth.a \
|
||||
${TOP_LIBDIR}/librxkad.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${LIBDIR}/librx.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a \
|
||||
${LIBDIR}/liblwp.a \
|
||||
${TOP_LIBDIR}/libcmd.a \
|
||||
@ -38,6 +39,7 @@ KAFSLIBS=${TOP_LIBDIR}/libkauth.krb.a \
|
||||
${TOP_LIBDIR}/librxkad.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${LIBDIR}/librx.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a \
|
||||
${LIBDIR}/liblwp.a \
|
||||
${TOP_LIBDIR}/libcmd.a \
|
||||
|
@ -83,7 +83,8 @@ BUTCLIBS=$(DESTDIR)\lib\afs\afsbudb.lib \
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
|
||||
# rm $(OUT)\tcstatus.obj
|
||||
|
@ -97,7 +97,7 @@ SYS_LIBS = ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a $
|
||||
|
||||
AUTH_LIBS = ${TOP_LIBDIR}/libauth.a ${SYS_LIBS}
|
||||
|
||||
INT_LIBS = ${TOP_LIBDIR}/libafsint.a ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libafscom_err.a ${TOP_LIBDIR}/util.a
|
||||
INT_LIBS = ${TOP_LIBDIR}/libafsint.a ${TOP_LIBDIR}/libsys.a ${TOP_LIBDIR}/librxkad.a ${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a ${TOP_LIBDIR}/libafscom_err.a ${TOP_LIBDIR}/util.a ${TOP_LIBDIR}/libafsrfc3961.a
|
||||
|
||||
TEST_PROGRAMS = write-ro-file hello-world read-vs-mmap read-vs-mmap2 \
|
||||
mmap-and-read large-dir large-dir2 large-dir3 mountpoint \
|
||||
|
@ -95,7 +95,8 @@ PTSERVER_EXELIBS =\
|
||||
$(DESTDIR)\lib\libafsconf.lib \
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\afs\afsprocmgmt.lib \
|
||||
$(DESTDIR)\lib\afspthread.lib
|
||||
$(DESTDIR)\lib\afspthread.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(PTSERVER): $(PTSERVER_EXEOBJS) $(PTUTILS_OBJ) $(PTINT_XDR_OBJ) $(UTILS_OBJ) $(MAP_OBJ) $(LWP_OBJS) $(PTSERVER_EXERES) $(RXKADOBJS) $(PTSERVER_EXELIBS)
|
||||
$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
|
||||
|
@ -18,6 +18,7 @@ AFSLIBS = \
|
||||
${TOP_LIBDIR}/libauth.a \
|
||||
${TOP_LIBDIR}/librxkad.a \
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a \
|
||||
${TOP_LIBDIR}/librx.a \
|
||||
${TOP_LIBDIR}/liblwp.a \
|
||||
|
@ -19,6 +19,7 @@ LIBS=${TOP_LIBDIR}/libauth.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
all: upserver upclient
|
||||
|
@ -25,7 +25,8 @@ LIBS = \
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
############################################################################
|
||||
# Definitions for generating files via RXGEN
|
||||
|
@ -30,6 +30,7 @@ LIBS=${TOP_LIBDIR}/libvolser.a \
|
||||
${TOP_LIBDIR}/libafscom_err.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
OBJS = uss_procs.o \
|
||||
|
@ -47,6 +47,7 @@ FSLIBS=${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/libaudit.a \
|
||||
$(TOP_LIBDIR)/libafsutil.a \
|
||||
$(TOP_LIBDIR)/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
CMLIBS=${TOP_LIBDIR}/libsys.a \
|
||||
|
@ -62,7 +62,8 @@ EXELIBS = \
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(EXEFILE): $(EXEOBJS) $(EXERES) $(EXELIBS)
|
||||
$(EXECONLINK)
|
||||
|
@ -32,6 +32,7 @@ LIBS=\
|
||||
${TOP_LIBDIR}/libsys.a \
|
||||
${TOP_LIBDIR}/libafsutil.a \
|
||||
$(TOP_LIBDIR)/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
OBJS=vldbint.xdr.o vldbint.cs.o vl_errors.o
|
||||
|
@ -92,7 +92,8 @@ VLSERVER_EXECLIBS = \
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
$(VLSERVER): $(VLSERVER_EXEOBJS) $(LIBFILE) $(VLSERVER_EXECLIBS)
|
||||
$(EXECONLINK) dnsapi.lib mpr.lib iphlpapi.lib shell32.lib
|
||||
|
@ -41,6 +41,7 @@ LIBS=\
|
||||
${TOP_LIBDIR}/libusd.a \
|
||||
${TOP_LIBDIR}/util.a \
|
||||
${TOP_LIBDIR}/libopr.a \
|
||||
${TOP_LIBDIR}/libafsrfc3961.a \
|
||||
${TOP_LIBDIR}/libafshcrypto_lwp.a
|
||||
|
||||
VOLDUMP_LIBS = \
|
||||
|
@ -75,7 +75,8 @@ EXEC_LIBS = \
|
||||
$(DESTDIR)\lib\afs\afspioctl.lib \
|
||||
$(DESTDIR)\lib\opr.lib \
|
||||
$(DESTDIR)\lib\afshcrypto.lib \
|
||||
$(DESTDIR)\lib\afsroken.lib
|
||||
$(DESTDIR)\lib\afsroken.lib \
|
||||
$(DESTDIR)\lib\afsrfc3961.lib
|
||||
|
||||
|
||||
############################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user