diff options
Diffstat (limited to 'eBones/kdb_init')
-rw-r--r-- | eBones/kdb_init/Makefile | 10 | ||||
-rw-r--r-- | eBones/kdb_init/kdb_init.8 | 45 | ||||
-rw-r--r-- | eBones/kdb_init/kdb_init.c | 180 |
3 files changed, 0 insertions, 235 deletions
diff --git a/eBones/kdb_init/Makefile b/eBones/kdb_init/Makefile deleted file mode 100644 index 4d6a110..0000000 --- a/eBones/kdb_init/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# From: @(#)Makefile 5.1 (Berkeley) 6/25/90 -# $Id: Makefile,v 1.3 1995/07/18 16:37:34 mark Exp $ - -PROG= kdb_init -CFLAGS+=-DKERBEROS -DDEBUG -I${.CURDIR}/../include -Wall -DPADD= ${LIBKDB} ${LIBKRB} -LDADD= -L${KDBOBJDIR} -lkdb -L${KRBOBJDIR} -lkrb -ldes -MAN8= kdb_init.8 - -.include <bsd.prog.mk> diff --git a/eBones/kdb_init/kdb_init.8 b/eBones/kdb_init/kdb_init.8 deleted file mode 100644 index d884d00..0000000 --- a/eBones/kdb_init/kdb_init.8 +++ /dev/null @@ -1,45 +0,0 @@ -.\" from: kdb_init.8,v 4.1 89/01/23 11:09:02 jtkohl Exp $ -.\" $Id: kdb_init.8,v 1.1.1.1 1994/09/30 14:50:06 csgr Exp $ -.\" Copyright 1989 by the Massachusetts Institute of Technology. -.\" -.\" For copying and distribution information, -.\" please see the file <Copyright.MIT>. -.\" -.TH KDB_INIT 8 "Kerberos Version 4.0" "MIT Project Athena" -.SH NAME -kdb_init \- Initialize Kerberos key distribution center database -.SH SYNOPSIS -kdb_init [ -.B realm -] -.SH DESCRIPTION -.I kdb_init -initializes a Kerberos key distribution center database, creating the -necessary principals. -.PP -If the optional -.I realm -argument is not present, -.I kdb_init -prompts for a realm name (defaulting to the definition in -/usr/include/kerberosIV/krb.h). -After determining the realm to be created, it prompts for -a master key password. The master key password is used to encrypt -every encryption key stored in the database. -.SH DIAGNOSTICS -.TP 20n -"/etc/kerberosIV/principal: File exists" -An attempt was made to create a database on a machine which already had -an existing database. -.SH FILES -.TP 20n -/etc/kerberosIV/principal.db -DBM file containing database -.TP -/etc/kerberosIV/principal.ok -Semaphore indicating that the DBM database is not being modified. -.TP -/usr/include/kerberosIV/krb.h -Include file defining default realm -.SH SEE ALSO -kdb_destroy(8) diff --git a/eBones/kdb_init/kdb_init.c b/eBones/kdb_init/kdb_init.c deleted file mode 100644 index de99181..0000000 --- a/eBones/kdb_init/kdb_init.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 1987, 1988 by the Massachusetts Institute of Technology. - * For copying and distribution information, please see the file - * <Copyright.MIT>. - * - * program to initialize the database, reports error if database file - * already exists. - * - * from: kdb_init.c,v 4.0 89/01/24 21:50:45 jtkohl Exp $ - * $Id: kdb_init.c,v 1.4 1995/07/18 16:37:35 mark Exp $ - */ - -#if 0 -#ifndef lint -static char rcsid[] = -"$Id: kdb_init.c,v 1.4 1995/07/18 16:37:35 mark Exp $"; -#endif lint -#endif - -#include <stdio.h> -#include <sys/types.h> -#include <sys/file.h> -#include <sys/time.h> -#include <des.h> -#include <krb.h> -#include <krb_db.h> -#include <string.h> - -#define TRUE 1 - -enum ap_op { - NULL_KEY, /* setup null keys */ - MASTER_KEY, /* use master key as new key */ - RANDOM_KEY, /* choose a random key */ -}; - -int add_principal(char *name, char *instance, enum ap_op aap_op); - -int debug = 0; -char *progname; -C_Block master_key; -Key_schedule master_key_schedule; - -int -main(argc, argv) - int argc; - char *argv[]; -{ - char realm[REALM_SZ]; - char *cp; - int code; - char *database; - - progname = (cp = rindex(*argv, '/')) ? cp + 1 : *argv; - - if (argc > 3) { - fprintf(stderr, "Usage: %s [realm-name] [database-name]\n", argv[0]); - exit(1); - } - if (argc == 3) { - database = argv[2]; - --argc; - } else - database = DBM_FILE; - - /* Do this first, it'll fail if the database exists */ - if ((code = kerb_db_create(database)) != 0) { - fprintf(stderr, "Couldn't create database: %s\n", - sys_errlist[code]); - exit(1); - } - kerb_db_set_name(database); - - if (argc == 2) - strncpy(realm, argv[1], REALM_SZ); - else { - fprintf(stderr, "Realm name [default %s ]: ", KRB_REALM); - if (fgets(realm, sizeof(realm), stdin) == NULL) { - fprintf(stderr, "\nEOF reading realm\n"); - exit(1); - } - if ((cp = index(realm, '\n'))) - *cp = '\0'; - if (!*realm) /* no realm given */ - strcpy(realm, KRB_REALM); - } - if (!k_isrealm(realm)) { - fprintf(stderr, "%s: Bad kerberos realm name \"%s\"\n", - progname, realm); - exit(1); - } - printf("You will be prompted for the database Master Password.\n"); - printf("It is important that you NOT FORGET this password.\n"); - fflush(stdout); - - if (kdb_get_master_key (TRUE, master_key, master_key_schedule) != 0) { - fprintf (stderr, "Couldn't read master key.\n"); - exit (-1); - } - - if ( - add_principal(KERB_M_NAME, KERB_M_INST, MASTER_KEY) || - add_principal(KERB_DEFAULT_NAME, KERB_DEFAULT_INST, NULL_KEY) || - add_principal("krbtgt", realm, RANDOM_KEY) || - add_principal("changepw", KRB_MASTER, RANDOM_KEY) - ) { - fprintf(stderr, "\n%s: couldn't initialize database.\n", - progname); - exit(1); - } - - /* play it safe */ - bzero (master_key, sizeof (C_Block)); - bzero (master_key_schedule, sizeof (Key_schedule)); - exit(0); -} - -/* use a return code to indicate success or failure. check the return */ -/* values of the routines called by this routine. */ - -int -add_principal(name, instance, aap_op) - char *name, *instance; - enum ap_op aap_op; -{ - Principal principal; - struct tm *tm; - C_Block new_key; - - bzero(&principal, sizeof(principal)); - strncpy(principal.name, name, ANAME_SZ); - strncpy(principal.instance, instance, INST_SZ); - switch (aap_op) { - case NULL_KEY: - principal.key_low = 0; - principal.key_high = 0; - break; - case RANDOM_KEY: -#ifdef NOENCRYPTION - bzero(new_key, sizeof(C_Block)); - new_key[0] = 127; -#else - random_key(new_key); -#endif - kdb_encrypt_key (new_key, new_key, master_key, master_key_schedule, - ENCRYPT); - bcopy(new_key, &principal.key_low, 4); - bcopy(((long *) new_key) + 1, &principal.key_high, 4); - break; - case MASTER_KEY: - bcopy (master_key, new_key, sizeof (C_Block)); - kdb_encrypt_key (new_key, new_key, master_key, master_key_schedule, - ENCRYPT); - bcopy(new_key, &principal.key_low, 4); - bcopy(((long *) new_key) + 1, &principal.key_high, 4); - break; - } - principal.exp_date = 946702799; /* Happy new century */ - strncpy(principal.exp_date_txt, "12/31/99", DATE_SZ); - principal.mod_date = time(0); - - tm = localtime(&principal.mod_date); - principal.attributes = 0; - principal.max_life = 255; - - principal.kdc_key_ver = 1; - principal.key_version = 1; - - strncpy(principal.mod_name, "db_creation", ANAME_SZ); - strncpy(principal.mod_instance, "", INST_SZ); - principal.old = 0; - - kerb_db_put_principal(&principal, 1); - - /* let's play it safe */ - bzero (new_key, sizeof (C_Block)); - bzero (&principal.key_low, 4); - bzero (&principal.key_high, 4); - return 0; -} |