hdb: Move virtual principals into HDB layer

This is a large commit that adds several features:

 - Revamps and moves virtual host-based service principal functionality
   from kdc/ to lib/hdb/ so that it may be automatically visible to
   lib/kadm5/, as well as kadmin(1)/kadmind(8) and ktutil(1).

   The changes are backwards-incompatible.

 - Completes support for documenting a service principal's supported
   enctypes in its HDB entry independently of its long-term keys.  This
   will reduce HDB bloat by not requiring that service principals have
   more long-term keys than they need just to document the service's
   supported enctypes.

 - Adds support for storing krb5.conf content in principals' HDB
   entries.  This may eventually be used for causing Heimdal KDC
   services to reconfigure primary/secondary roles automatically by
   discovering the configured primary in an HDB entry for the realm.

   For now this will be used to help reduce the amount of configuration
   needed by clients of an upcoming HTTP binding of the kadmin service.
This commit is contained in:
Nicolas Williams
2020-08-24 16:16:59 -05:00
parent ef06b94132
commit 5447b81fb1
50 changed files with 4017 additions and 530 deletions

View File

@@ -81,6 +81,12 @@ enum hdb_lockop{ HDB_RLOCK, HDB_WLOCK };
/* key usage for master key */
#define HDB_KU_MKEY 0x484442
/*
* Second component of WELLKNOWN namespace principals, the third component is
* the common DNS suffix of the implied virtual hosts.
*/
#define HDB_WK_NAMESPACE "HOSTBASED-NAMESPACE"
typedef struct hdb_master_key_data *hdb_master_key;
/**
@@ -114,6 +120,17 @@ typedef struct HDB {
int hdb_capability_flags;
int lock_count;
int lock_type;
/*
* These fields cache config values.
*
* XXX Move these into a structure that we point to so that we
* don't need to break the ABI every time we add a field.
*/
int enable_virtual_hostbased_princs;
size_t virtual_hostbased_princ_ndots; /* Min. # of .s in hostname */
size_t virtual_hostbased_princ_maxdots; /* Max. # of .s in namespace */
char **virtual_hostbased_princ_svcs; /* Which svcs are not wildcarded */
time_t new_service_key_delay; /* Delay for new keys */
/**
* Open (or create) the a Kerberos database.
*