Skip to content

Commit

Permalink
Add otp client preauth plugin
Browse files Browse the repository at this point in the history
Implements the client side of RFC 6560. Not all features are
implemented, but it should work for the most common cases.

ticket: 7242 (new)
  • Loading branch information
npmccallum authored and greghudson committed Aug 23, 2012
1 parent a7dc565 commit 652313b
Show file tree
Hide file tree
Showing 7 changed files with 592 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/include/k5-int.h
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,12 @@ typedef struct _krb5_enc_sam_response_enc_2 {
#define KRB5_OTP_FLAG_SEPARATE_PIN 0x02000000
#define KRB5_OTP_FLAG_CHECK_DIGIT 0x01000000

#define KRB5_OTP_FORMAT_DECIMAL 0x00000000
#define KRB5_OTP_FORMAT_HEXADECIMAL 0x00000001
#define KRB5_OTP_FORMAT_ALPHANUMERIC 0x00000002
#define KRB5_OTP_FORMAT_BINARY 0x00000003
#define KRB5_OTP_FORMAT_BASE64 0x00000004

typedef struct _krb5_otp_tokeninfo {
krb5_flags flags;
krb5_data vendor;
Expand Down
5 changes: 5 additions & 0 deletions src/include/krb5/krb5.hin
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,7 @@ krb5_c_keyed_checksum_types(krb5_context context, krb5_enctype enctype,
#define KRB5_KEYUSAGE_AD_SIGNEDPATH -21
#define KRB5_KEYUSAGE_IAKERB_FINISHED 42
#define KRB5_KEYUSAGE_PA_PKINIT_KX 44
#define KRB5_KEYUSAGE_PA_OTP_REQUEST 45
/* define in draft-ietf-krb-wg-preauth-framework*/
#define KRB5_KEYUSAGE_FAST_REQ_CHKSUM 50
#define KRB5_KEYUSAGE_FAST_ENC 51
Expand Down Expand Up @@ -1812,6 +1813,10 @@ krb5_verify_checksum(krb5_context context, krb5_cksumtype ctype,
#define KRB5_PADATA_FX_FAST 136
#define KRB5_PADATA_FX_ERROR 137
#define KRB5_PADATA_ENCRYPTED_CHALLENGE 138
#define KRB5_PADATA_OTP_CHALLENGE 141
#define KRB5_PADATA_OTP_REQUEST 142
#define KRB5_PADATA_OTP_CONFIRM 143
#define KRB5_PADATA_OTP_PIN_CHANGE 144
#define KRB5_PADATA_PKINIT_KX 147
#define KRB5_ENCPADATA_REQ_ENC_PA_REP 149

Expand Down
3 changes: 3 additions & 0 deletions src/lib/krb5/krb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ STLIBOBJS= \
preauth2.o \
preauth_ec.o \
preauth_encts.o \
preauth_otp.o \
preauth_sam2.o \
gic_opt_set_pa.o \
princ_comp.o \
Expand Down Expand Up @@ -185,6 +186,7 @@ OBJS= $(OUTPRE)addr_comp.$(OBJEXT) \
$(OUTPRE)preauth2.$(OBJEXT) \
$(OUTPRE)preauth_ec.$(OBJEXT) \
$(OUTPRE)preauth_encts.$(OBJEXT) \
$(OUTPRE)preauth_otp.$(OBJEXT) \
$(OUTPRE)preauth_sam2.$(OBJEXT) \
$(OUTPRE)gic_opt_set_pa.$(OBJEXT) \
$(OUTPRE)princ_comp.$(OBJEXT) \
Expand Down Expand Up @@ -291,6 +293,7 @@ SRCS= $(srcdir)/addr_comp.c \
$(srcdir)/preauth2.c \
$(srcdir)/preauth_ec.c \
$(srcdir)/preauth_encts.c \
$(srcdir)/preauth_otp.c \
$(srcdir)/gic_opt_set_pa.c \
$(srcdir)/princ_comp.c \
$(srcdir)/privsafe.c \
Expand Down
11 changes: 11 additions & 0 deletions src/lib/krb5/krb/deps
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,17 @@ preauth_encts.so preauth_encts.po $(OUTPRE)preauth_encts.$(OBJEXT): \
$(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \
$(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \
$(top_srcdir)/include/socket-utils.h int-proto.h preauth_encts.c
preauth_otp.so preauth_otp.po $(OUTPRE)preauth_otp.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
$(COM_ERR_DEPS) $(top_srcdir)/include/k5-buf.h $(top_srcdir)/include/k5-err.h \
$(top_srcdir)/include/k5-gmt_mktime.h $(top_srcdir)/include/k5-int-pkinit.h \
$(top_srcdir)/include/k5-int.h $(top_srcdir)/include/k5-platform.h \
$(top_srcdir)/include/k5-plugin.h $(top_srcdir)/include/k5-thread.h \
$(top_srcdir)/include/k5-trace.h $(top_srcdir)/include/krb5.h \
$(top_srcdir)/include/krb5/authdata_plugin.h $(top_srcdir)/include/krb5/plugin.h \
$(top_srcdir)/include/krb5/preauth_plugin.h $(top_srcdir)/include/port-sockets.h \
$(top_srcdir)/include/socket-utils.h int-proto.h preauth_otp.c
gic_opt_set_pa.so gic_opt_set_pa.po $(OUTPRE)gic_opt_set_pa.$(OBJEXT): \
$(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \
$(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \
Expand Down
4 changes: 4 additions & 0 deletions src/lib/krb5/krb/int-proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ krb5_error_code
clpreauth_sam2_initvt(krb5_context context, int maj_ver, int min_ver,
krb5_plugin_vtable vtable);

krb5_error_code
clpreauth_otp_initvt(krb5_context context, int maj_ver, int min_ver,
krb5_plugin_vtable vtable);

krb5_error_code
krb5int_construct_matching_creds(krb5_context context, krb5_flags options,
krb5_creds *in_creds, krb5_creds *mcreds,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/krb5/krb/preauth2.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ krb5_init_preauth_context(krb5_context kcontext)
clpreauth_encrypted_timestamp_initvt);
k5_plugin_register(kcontext, PLUGIN_INTERFACE_CLPREAUTH, "sam2",
clpreauth_sam2_initvt);
k5_plugin_register(kcontext, PLUGIN_INTERFACE_CLPREAUTH, "otp",
clpreauth_otp_initvt);

/* Get all available clpreauth vtables. */
if (k5_plugin_load_all(kcontext, PLUGIN_INTERFACE_CLPREAUTH, &plugins))
Expand Down

0 comments on commit 652313b

Please sign in to comment.