public interface KerberosHelper
Modifier and Type | Interface and Description |
---|---|
static interface |
KerberosHelper.Command<T,A>
Command to invoke against the Ambari backend.
|
static class |
KerberosHelper.KerberosDescriptorType
Types of Kerberos descriptors related to where the data is stored.
|
Modifier and Type | Field and Description |
---|---|
static String |
ALLOW_RETRY
If
true , then this will create the stages and tasks as being
retry-able. |
static String |
AMBARI_SERVER_HOST_NAME
The hostname used to hold the place of the actual hostname of the host that the Ambari server
is on.
|
static String |
AMBARI_SERVER_KERBEROS_IDENTITY_NAME
The name of the Ambari server's Kerberos identities as defined in the Kerberos descriptor
|
static String |
CASE_INSENSITIVE_USERNAME_RULES
The kerberos-env property name declaring whether auth-to-local rules should be case-insensitive or not
|
static String |
CLUSTER_HOST_INFO
Used as key in config maps to store component to host assignment mapping.
|
static String |
CREATE_AMBARI_PRINCIPAL
The kerberos-env property name declaring whether Ambari should manage its own required
identities or not
|
static String |
DEFAULT_REALM
The kerberos-env property name declaring the default realm
|
static String |
DIRECTIVE_COMPONENTS
directive used to pass list of services and their components to regenerate keytabs for
|
static String |
DIRECTIVE_CONFIG_UPDATE_POLICY
directive used to indicate how to handle configuration updates when regenerating keytab files
expected values:
none
identities_only
new_and_identities
all
|
static String |
DIRECTIVE_FORCE_TOGGLE_KERBEROS
directive used to indicate that the enable Kerberos operation should proceed even if the
cluster's security type is not changing
|
static String |
DIRECTIVE_HOSTS
directive used to pass host list to regenerate keytabs on
|
static String |
DIRECTIVE_IGNORE_CONFIGS
Deprecated.
|
static String |
DIRECTIVE_MANAGE_KERBEROS_IDENTITIES
directive used to override the behavior of the kerberos-env/manage_identities property
|
static String |
DIRECTIVE_REGENERATE_KEYTABS
directive used to indicate that the enable Kerberos operation is only to regenerate keytab files
|
static String |
INCLUDE_ALL_COMPONENTS_IN_AUTH_TO_LOCAL_RULES
The kerberos-env property name declaring whether the Hadoop auth_to_local rules should be included for all components of an installed service even if the component itself is not installed
|
static String |
KDC_ADMINISTRATOR_CREDENTIAL_ALIAS
The alias to assign to the KDC administrator credential Keystore item
|
static String |
KDC_TYPE
The kerberos-env property name declaring the kdc_type
|
static String |
KERBEROS_ENV
The name of the Kerberos environment configuration type
|
static String |
MANAGE_AUTH_TO_LOCAL_RULES
The kerberos-env property name declaring whether to manage auth-to-local rules or not
|
static String |
MANAGE_IDENTITIES
The kerberos-env property name declaring whether Ambari should manage the cluster's required
identities or not
|
static String |
PRECONFIGURE_SERVICES
The kerberos-env property name declaring how to preprocess services.
|
static String |
SECURITY_ENABLED_CONFIG_TYPE
config type which contains the property used to determine if Kerberos is enabled
|
static String |
SECURITY_ENABLED_PROPERTY_NAME
name of property which states whether kerberos is enabled
|
Modifier and Type | Method and Description |
---|---|
int |
addIdentities(KerberosIdentityDataFileWriter kerberosIdentityDataFileWriter,
Collection<KerberosIdentityDescriptor> identities,
Collection<String> identityFilter,
String hostname,
Long hostId,
String serviceName,
String componentName,
Map<String,Map<String,String>> kerberosConfigurations,
Map<String,Map<String,String>> configurations,
Map<String,ResolvedKerberosKeytab> resolvedKeytabs,
String realm)
Adds identities to the KerberosIdentityDataFileWriter.
|
Map<String,Map<String,String>> |
applyStackAdvisorUpdates(Cluster cluster,
Set<String> services,
Map<String,Map<String,String>> existingConfigurations,
Map<String,Map<String,String>> kerberosConfigurations,
Map<String,Set<String>> propertiesToIgnore,
Map<String,Set<String>> propertiesToRemove,
boolean kerberosEnabled)
Invokes the Stack Advisor to help determine relevant configuration changes when enabling or
disabling Kerberos.
|
Map<String,Map<String,String>> |
calculateConfigurations(Cluster cluster,
String hostname,
KerberosDescriptor kerberosDescriptor,
boolean includePreconfigureData,
boolean calculateClusterHostInfo)
Calculates the map of configurations relative to the cluster and host.
|
void |
configureServices(Cluster cluster,
Map<String,Collection<String>> serviceFilter)
Updates the relevant configurations for the components specified in the service filter.
|
boolean |
createAmbariIdentities(Map<String,String> kerberosEnvProperties)
Determines if the Ambari identities should be created when enabling Kerberos.
|
void |
createResolvedKeytab(ResolvedKerberosKeytab resolvedKerberosKeytab)
Saves underlying entities in persistent storage.
|
File |
createTemporaryDirectory()
Creates a temporary directory within the system temporary directory
The resulting directory is to be removed by the caller when desired.
|
RequestStageContainer |
createTestIdentity(Cluster cluster,
Map<String,String> commandParamsStage,
RequestStageContainer requestStageContainer)
Create a unique identity to use for testing the general Kerberos configuration.
|
void |
deleteIdentities(Cluster cluster,
List<Component> components,
Set<String> identities) |
RequestStageContainer |
deleteIdentities(Cluster cluster,
Map<String,? extends Collection<String>> serviceComponentFilter,
Set<String> hostFilter,
Collection<String> identityFilter,
RequestStageContainer requestStageContainer,
Boolean manageIdentities)
Deletes the set of filtered principals and keytabs from the cluster.
|
RequestStageContainer |
deleteTestIdentity(Cluster cluster,
Map<String,String> commandParamsStage,
RequestStageContainer requestStageContainer)
Deletes the unique identity to use for testing the general Kerberos configuration.
|
boolean |
ensureHeadlessIdentities(Cluster cluster,
Map<String,Map<String,String>> existingConfigurations,
Set<String> services)
Ensures that the relevant headless (or user) Kerberos identities are created and cached.
|
RequestStageContainer |
ensureIdentities(Cluster cluster,
Map<String,? extends Collection<String>> serviceComponentFilter,
Set<String> hostFilter,
Collection<String> identityFilter,
Set<String> hostsToForceKerberosOperations,
RequestStageContainer requestStageContainer,
Boolean manageIdentities)
Ensures the set of filtered principals and keytabs exist on the cluster.
|
RequestStageContainer |
executeCustomOperations(Cluster cluster,
Map<String,String> requestProperties,
RequestStageContainer requestStageContainer,
Boolean manageIdentities)
Used to execute custom security operations which are sent as directives in URI
|
Map<String,Collection<KerberosIdentityDescriptor>> |
getActiveIdentities(String clusterName,
String hostName,
String serviceName,
String componentName,
boolean replaceHostNames,
Map<String,Map<String,Map<String,String>>> hostConfigurations,
KerberosDescriptor kerberosDescriptor)
Returns the active identities for the named cluster.
|
List<KerberosIdentityDescriptor> |
getAmbariServerIdentities(KerberosDescriptor kerberosDescriptor)
Gets the Ambari server Kerberos identities found in the Kerberos descriptor.
|
boolean |
getForceToggleKerberosDirective(Map<String,String> requestProperties)
Retrieves the value of the force_toggle_kerberos directive from the request properties,
if it exists.
|
Set<String> |
getHostsWithValidKerberosClient(Cluster cluster) |
Map<String,Map<String,String>> |
getIdentityConfigurations(List<KerberosIdentityDescriptor> identityDescriptors)
Given a list of KerberosIdentityDescriptors, returns a Map fo configuration types to property
names and values.
|
PrincipalKeyCredential |
getKDCAdministratorCredentials(String clusterName)
Gets the previously stored KDC administrator credentials.
|
KerberosDescriptor |
getKerberosDescriptor(Cluster cluster,
boolean includePreconfigureData)
Builds a composite Kerberos descriptor using the default Kerberos descriptor and a user-specified
Kerberos descriptor, if it exists.
|
KerberosDescriptor |
getKerberosDescriptor(KerberosHelper.KerberosDescriptorType kerberosDescriptorType,
Cluster cluster,
boolean evaluateWhenClauses,
Collection<String> additionalServices,
boolean includePreconfigureData)
Gets the requested Kerberos descriptor.
|
KerberosDescriptor |
getKerberosDescriptor(KerberosHelper.KerberosDescriptorType kerberosDescriptorType,
Cluster cluster,
StackId stackId,
boolean includePreconfigureData)
Gets the Kerberos descriptor for the requested stack.
|
KerberosDetails |
getKerberosDetails(Cluster cluster,
Boolean manageIdentities)
Gathers the Kerberos-related data from configurations and stores it in a new KerberosDetails
instance.
|
Boolean |
getManageIdentitiesDirective(Map<String,String> requestProperties)
Retrieves the value of the manage_kerberos_identities directive from the request properties,
if it exists.
|
List<ServiceComponentHost> |
getServiceComponentHostsToProcess(Cluster cluster,
KerberosDescriptor kerberosDescriptor,
Map<String,? extends Collection<String>> serviceComponentFilter,
Collection<String> hostFilter) |
Map<String,Map<String,String>> |
getServiceConfigurationUpdates(Cluster cluster,
Map<String,Map<String,String>> existingConfigurations,
Map<String,Set<String>> installedServices,
Map<String,Collection<String>> serviceFilter,
Set<String> previouslyExistingServices,
boolean kerberosEnabled,
boolean applyStackAdvisorUpdates)
Returns the updates configurations that are expected when the given set of services are configured
for Kerberos.
|
boolean |
isClusterKerberosEnabled(Cluster cluster)
Determine if a cluster has kerberos enabled.
|
Map<String,Map<String,String>> |
mergeConfigurations(Map<String,Map<String,String>> configurations,
Map<String,KerberosConfigurationDescriptor> updates,
Map<String,Map<String,String>> replacements,
Set<String> configurationTypeFilter)
Merges configurations from a Map of configuration updates into a main configurations Map.
|
Map<String,Map<String,String>> |
processPreconfiguredServiceConfigurations(Map<String,Map<String,String>> configurations,
Map<String,Map<String,String>> replacements,
Cluster cluster,
KerberosDescriptor kerberosDescriptor)
Determines which services, not currently installed, should be preconfigured to aid in reducing
the number of service restarts when new services are added to a cluster where Kerberos is enabled.
|
void |
removeStaleKeytabs(Collection<ResolvedKerberosKeytab> expectedKeytabs)
Removes existent persisted keytabs if they are not in
expectedKeytabs collection. |
void |
setAuthToLocalRules(Cluster cluster,
KerberosDescriptor kerberosDescriptor,
String realm,
Map<String,Set<String>> installedServices,
Map<String,Map<String,String>> existingConfigurations,
Map<String,Map<String,String>> kerberosConfigurations,
boolean includePreconfigureData)
Sets the relevant auth-to-local rule configuration properties using the services installed on
the cluster and their relevant Kerberos descriptors to determine the rules to be created.
|
boolean |
shouldExecuteCustomOperations(SecurityType requestSecurityType,
Map<String,String> requestProperties)
Tests the request properties to check for directives that need to be acted upon
It is required that the SecurityType from the request is either KERBEROS or NONE and that at
least one directive in the requestProperties map is supported.
|
RequestStageContainer |
toggleKerberos(Cluster cluster,
SecurityType securityType,
RequestStageContainer requestStageContainer,
Boolean manageIdentities)
Toggles Kerberos security to enable it or remove it depending on the state of the cluster.
|
Map<String,Set<String>> |
translateConfigurationSpecifications(Collection<String> configurationSpecifications)
Translates a collection of configuration specifications (
config-type/property-name )
to a map of configuration types to a set of property names. |
void |
validateKDCCredentials(Cluster cluster)
Validate the KDC admin credentials.
|
static final String DIRECTIVE_MANAGE_KERBEROS_IDENTITIES
static final String DIRECTIVE_REGENERATE_KEYTABS
static final String DIRECTIVE_HOSTS
static final String DIRECTIVE_COMPONENTS
static final String DIRECTIVE_IGNORE_CONFIGS
DIRECTIVE_CONFIG_UPDATE_POLICY
static final String DIRECTIVE_CONFIG_UPDATE_POLICY
UpdateConfigurationPolicy
,
Constant Field Valuesstatic final String DIRECTIVE_FORCE_TOGGLE_KERBEROS
static final String SECURITY_ENABLED_CONFIG_TYPE
static final String SECURITY_ENABLED_PROPERTY_NAME
static final String KDC_ADMINISTRATOR_CREDENTIAL_ALIAS
static final String AMBARI_SERVER_HOST_NAME
static final String KERBEROS_ENV
static final String AMBARI_SERVER_KERBEROS_IDENTITY_NAME
static final String CREATE_AMBARI_PRINCIPAL
static final String MANAGE_IDENTITIES
static final String DEFAULT_REALM
static final String KDC_TYPE
KDCType
,
Constant Field Valuesstatic final String MANAGE_AUTH_TO_LOCAL_RULES
static final String INCLUDE_ALL_COMPONENTS_IN_AUTH_TO_LOCAL_RULES
static final String CASE_INSENSITIVE_USERNAME_RULES
static final String PRECONFIGURE_SERVICES
Expected values are "ALL"
, "DEFAULT"
, "NONE"
PreconfigureServiceType
,
Constant Field Valuesstatic final String ALLOW_RETRY
true
, then this will create the stages and tasks as being
retry-able. A failure during Kerberos operations will not cause the entire
request to be aborted.static final String CLUSTER_HOST_INFO
RequestStageContainer toggleKerberos(Cluster cluster, SecurityType securityType, RequestStageContainer requestStageContainer, Boolean manageIdentities) throws org.apache.ambari.server.AmbariException, KerberosOperationException
cluster
- the relevant ClustersecurityType
- the SecurityType to handle; this value is expected to be either
SecurityType.KERBEROS or SecurityType.NONErequestStageContainer
- a RequestStageContainer to place generated stages, if needed -
if null a new RequestStageContainer will be created.manageIdentities
- a Boolean value indicating how to override the configured behavior
of managing Kerberos identities; if null the configured behavior
will not be overriddenorg.apache.ambari.server.AmbariException
KerberosInvalidConfigurationException
- if an issue occurs trying to get the
Kerberos-specific configuration detailsKerberosOperationException
RequestStageContainer executeCustomOperations(Cluster cluster, Map<String,String> requestProperties, RequestStageContainer requestStageContainer, Boolean manageIdentities) throws org.apache.ambari.server.AmbariException, KerberosOperationException
cluster
- the relevant ClusterrequestProperties
- this structure is expected to hold already supported and validated directives
for the 'Cluster' resource. See ClusterResourceDefinition#getUpdateDirectivesrequestStageContainer
- a RequestStageContainer to place generated stages, if needed -
if null a new RequestStageContainer will be created.manageIdentities
- a Boolean value indicating how to override the configured behavior
of managing Kerberos identities; if null the configured behavior
will not be overriddenorg.apache.ambari.server.AmbariException
KerberosOperationException
KerberosInvalidConfigurationException
- if an issue occurs trying to get the
Kerberos-specific configuration detailsRequestStageContainer ensureIdentities(Cluster cluster, Map<String,? extends Collection<String>> serviceComponentFilter, Set<String> hostFilter, Collection<String> identityFilter, Set<String> hostsToForceKerberosOperations, RequestStageContainer requestStageContainer, Boolean manageIdentities) throws org.apache.ambari.server.AmbariException, KerberosOperationException
cluster
- the relevant ClusterserviceComponentFilter
- a Map of service names to component names indicating the
relevant set of services and components - if null, no
filter is relevant; if empty, the filter indicates no
relevant services or componentshostFilter
- a set of hostname indicating the set of hosts to process -
if null, no filter is relevant; if empty, the filter
indicates no relevant hostsidentityFilter
- a Collection of identity names indicating the relevant
identities - if null, no filter is relevant; if empty,
the filter indicates no relevant identitieshostsToForceKerberosOperations
- a set of host names on which it is expected that the
Kerberos client is or will be in the INSTALLED state by
the time the operations targeted for them are to be
executed - if empty or null, this no hosts will be
"forced"requestStageContainer
- a RequestStageContainer to place generated stages, if
needed - if null a new RequestStageContainer will be
created.manageIdentities
- a Boolean value indicating how to override the configured behavior
of managing Kerberos identities; if null the configured behavior
will not be overriddenorg.apache.ambari.server.AmbariException
KerberosOperationException
KerberosInvalidConfigurationException
- if an issue occurs trying to get the
Kerberos-specific configuration detailsRequestStageContainer deleteIdentities(Cluster cluster, Map<String,? extends Collection<String>> serviceComponentFilter, Set<String> hostFilter, Collection<String> identityFilter, RequestStageContainer requestStageContainer, Boolean manageIdentities) throws org.apache.ambari.server.AmbariException, KerberosOperationException
cluster
- the relevant ClusterserviceComponentFilter
- a Map of service names to component names indicating the relevant
set of services and components - if null, no filter is relevant;
if empty, the filter indicates no relevant services or componentshostFilter
- a set of hostname indicating the set of hosts to process -
if null, no filter is relevant; if empty, the filter
indicates no relevant hostsidentityFilter
- a Collection of identity names indicating the relevant identities -
if null, no filter is relevant; if empty, the filter indicates no
relevant identitiesrequestStageContainer
- a RequestStageContainer to place generated stages, if needed -
if null a new RequestStageContainer will be created.manageIdentities
- a Boolean value indicating how to override the configured behavior
of managing Kerberos identities; if null the configured behavior
will not be overriddenorg.apache.ambari.server.AmbariException
KerberosOperationException
KerberosInvalidConfigurationException
- if an issue occurs trying to get the
Kerberos-specific configuration detailsvoid deleteIdentities(Cluster cluster, List<Component> components, Set<String> identities) throws org.apache.ambari.server.AmbariException, KerberosOperationException
org.apache.ambari.server.AmbariException
KerberosOperationException
void configureServices(Cluster cluster, Map<String,Collection<String>> serviceFilter) throws org.apache.ambari.server.AmbariException, KerberosInvalidConfigurationException
null
is passed in as the service filter, all installed services and components
will be affected. If an empty map is passed in, no services or components will be affected.
If the relevant services and components have Kerberos descriptors, configuration values from
the descriptors are used to update the relevant configuration sets.cluster
- the relevant ClusterserviceFilter
- a Map of service names to component names indicating the
relevant set of services and components - if null, no
filter is relevant; if empty, the filter indicates no
relevant services or componentsorg.apache.ambari.server.AmbariException
KerberosInvalidConfigurationException
Map<String,Map<String,String>> getServiceConfigurationUpdates(Cluster cluster, Map<String,Map<String,String>> existingConfigurations, Map<String,Set<String>> installedServices, Map<String,Collection<String>> serviceFilter, Set<String> previouslyExistingServices, boolean kerberosEnabled, boolean applyStackAdvisorUpdates) throws KerberosInvalidConfigurationException, org.apache.ambari.server.AmbariException
cluster
- the clusterexistingConfigurations
- the cluster's existing configurationsinstalledServices
- the map of services and relevant components to processserviceFilter
- a Map of service names to component names indicating the
relevant set of services and components - if null, no
filter is relevant; if empty, the filter indicates no
relevant services or componentspreviouslyExistingServices
- a set of previously existing service names - null or a subset of installedServiceskerberosEnabled
- true if kerberos is (to be) enabled; otherwise falseapplyStackAdvisorUpdates
- true to invoke the stack advisor to validate property updates;
false to skiporg.apache.ambari.server.AmbariException
KerberosInvalidConfigurationException
- if an issue occurs trying to get the
Kerberos-specific configuration detailsMap<String,Map<String,String>> applyStackAdvisorUpdates(Cluster cluster, Set<String> services, Map<String,Map<String,String>> existingConfigurations, Map<String,Map<String,String>> kerberosConfigurations, Map<String,Set<String>> propertiesToIgnore, Map<String,Set<String>> propertiesToRemove, boolean kerberosEnabled) throws org.apache.ambari.server.AmbariException
cluster
- a clusterservices
- a set of services that are being configured to enabled or disable KerberosexistingConfigurations
- the cluster's existing configurationskerberosConfigurations
- the configuration updates to makepropertiesToIgnore
- the configuration properties that should be ignored when applying recommendationspropertiesToRemove
- the configuration properties that must be removed from cluster config are inserted
into this map in case if provided (not null) and kerberosEnabledkerberosEnabled
- true if kerberos is (to be) enabled; otherwise falseorg.apache.ambari.server.AmbariException
boolean ensureHeadlessIdentities(Cluster cluster, Map<String,Map<String,String>> existingConfigurations, Set<String> services) throws KerberosInvalidConfigurationException, org.apache.ambari.server.AmbariException
cluster
- the clusterexistingConfigurations
- the cluster's existing configurationsservices
- the set of services to processorg.apache.ambari.server.AmbariException
KerberosInvalidConfigurationException
- if an issue occurs trying to get the
Kerberos-specific configuration detailsRequestStageContainer createTestIdentity(Cluster cluster, Map<String,String> commandParamsStage, RequestStageContainer requestStageContainer) throws KerberosOperationException, org.apache.ambari.server.AmbariException
cluster
- the relevant ClustercommandParamsStage
- the command parameters map that will be sent to the agent side commandrequestStageContainer
- a RequestStageContainer to place generated stages, if needed -
if null a new RequestStageContainer will be created.KerberosOperationException
org.apache.ambari.server.AmbariException
RequestStageContainer deleteTestIdentity(Cluster cluster, Map<String,String> commandParamsStage, RequestStageContainer requestStageContainer) throws KerberosOperationException, org.apache.ambari.server.AmbariException
cluster
- the relevant ClustercommandParamsStage
- the command parameters map that will be sent to the agent side commandrequestStageContainer
- a RequestStageContainer to place generated stages, if needed -
if null a new RequestStageContainer will be created.KerberosOperationException
org.apache.ambari.server.AmbariException
void validateKDCCredentials(Cluster cluster) throws KerberosMissingAdminCredentialsException, KerberosAdminAuthenticationException, KerberosInvalidConfigurationException, org.apache.ambari.server.AmbariException
cluster
- associated clusterorg.apache.ambari.server.AmbariException
- if any other error occurs while trying to validate the credentialsKerberosMissingAdminCredentialsException
KerberosAdminAuthenticationException
KerberosInvalidConfigurationException
void setAuthToLocalRules(Cluster cluster, KerberosDescriptor kerberosDescriptor, String realm, Map<String,Set<String>> installedServices, Map<String,Map<String,String>> existingConfigurations, Map<String,Map<String,String>> kerberosConfigurations, boolean includePreconfigureData) throws org.apache.ambari.server.AmbariException
cluster
- cluster instancekerberosDescriptor
- the current Kerberos descriptorrealm
- the default realminstalledServices
- the map of services and relevant components to processexistingConfigurations
- a map of the current configurationskerberosConfigurations
- a map of the configurations to update, this where the generated
auth-to-local values will be storedincludePreconfigureData
- true
to include the preconfigure data; false
otherwiseorg.apache.ambari.server.AmbariException
List<ServiceComponentHost> getServiceComponentHostsToProcess(Cluster cluster, KerberosDescriptor kerberosDescriptor, Map<String,? extends Collection<String>> serviceComponentFilter, Collection<String> hostFilter) throws org.apache.ambari.server.AmbariException
cluster
- the clusterkerberosDescriptor
- the current Kerberos descriptorserviceComponentFilter
- a Map of service names to component names indicating the
relevant set of services and components - if null, no
filter is relevant; if empty, the filter indicates no
relevant services or componentshostFilter
- a set of hostname indicating the set of hosts to process -
if null, no filter is relevant; if empty, the filter
indicates no relevant hostsorg.apache.ambari.server.AmbariException
Set<String> getHostsWithValidKerberosClient(Cluster cluster) throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
KerberosDescriptor getKerberosDescriptor(Cluster cluster, boolean includePreconfigureData) throws org.apache.ambari.server.AmbariException
stacks/:stackName/versions/:version/artifacts/kerberos_descriptor
endpoint
The user-specified Kerberos descriptor was registered to the
cluster/:clusterName/artifacts/kerberos_descriptor
endpoint.
If the user-specified Kerberos descriptor exists, it is used to update the default Kerberos
descriptor and the composite is returned. If not, the default cluster descriptor is returned
as-is.cluster
- cluster instanceincludePreconfigureData
- true
to include the preconfigure data; false
otherwiseorg.apache.ambari.server.AmbariException
- if unable to obtain the descriptorgetKerberosDescriptor(KerberosDescriptorType, Cluster, boolean, Collection, boolean)
KerberosDescriptor getKerberosDescriptor(KerberosHelper.KerberosDescriptorType kerberosDescriptorType, Cluster cluster, boolean evaluateWhenClauses, Collection<String> additionalServices, boolean includePreconfigureData) throws org.apache.ambari.server.AmbariException
One of the following Kerberos descriptors will be returned - with or without pruning identity
definitions based on the evaluation of their when
clauses:
KerberosHelper.KerberosDescriptorType.STACK
KerberosHelper.KerberosDescriptorType.USER
KerberosHelper.KerberosDescriptorType.COMPOSITE
getKerberosDescriptor(Cluster, boolean)
kerberosDescriptorType
- the type of Kerberos descriptor to retrieve - see KerberosHelper.KerberosDescriptorType
cluster
- the relevant ClusterevaluateWhenClauses
- true to evaluate Kerberos identity when
clauses and
prune if necessary; false otherwise.additionalServices
- an optional collection of service names declaring additional
services to add to the set of currently installed services to use
while evaluating when
clausesincludePreconfigureData
- true
to include the preconfigure data; false
otherwiseorg.apache.ambari.server.AmbariException
KerberosDescriptor getKerberosDescriptor(KerberosHelper.KerberosDescriptorType kerberosDescriptorType, Cluster cluster, StackId stackId, boolean includePreconfigureData) throws org.apache.ambari.server.AmbariException
One of the following Kerberos descriptors will be returned:
KerberosHelper.KerberosDescriptorType.STACK
KerberosHelper.KerberosDescriptorType.USER
KerberosHelper.KerberosDescriptorType.COMPOSITE
getKerberosDescriptor(Cluster, boolean)
kerberosDescriptorType
- the type of Kerberos descriptor to retrieve - see KerberosHelper.KerberosDescriptorType
cluster
- the relevant ClusterstackId
- the relevant stack id, used for COMPOSITE
or STACK
Kerberos descriptor requestsincludePreconfigureData
- true
to include the preconfigure data; false
otherwiseorg.apache.ambari.server.AmbariException
Map<String,Map<String,String>> mergeConfigurations(Map<String,Map<String,String>> configurations, Map<String,KerberosConfigurationDescriptor> updates, Map<String,Map<String,String>> replacements, Set<String> configurationTypeFilter) throws org.apache.ambari.server.AmbariException
Each property in the updates Map is processed to replace variables using the replacement Map, unless it has been filtered out using an optionally supplied configuration type filter (configurationTypeFilter).
SeeVariableReplacementHelper.replaceVariables(String, java.util.Map)
for information on variable replacement.configurations
- a Map of existing configurations (updated in-place)updates
- a Map of configuration updatesreplacements
- a Map of (grouped) replacement valuesconfigurationTypeFilter
- a Set of config types to filter from the map of updates;
null
indicate no filterorg.apache.ambari.server.AmbariException
- if an issue occursMap<String,Map<String,String>> processPreconfiguredServiceConfigurations(Map<String,Map<String,String>> configurations, Map<String,Map<String,String>> replacements, Cluster cluster, KerberosDescriptor kerberosDescriptor) throws org.apache.ambari.server.AmbariException
configurations
- a Map of existing configurations (updated in-place)replacements
- a Map of (grouped) replacement valuescluster
- the clusterkerberosDescriptor
- the Kerberos Descriptororg.apache.ambari.server.AmbariException
- if an issue occursint addIdentities(KerberosIdentityDataFileWriter kerberosIdentityDataFileWriter, Collection<KerberosIdentityDescriptor> identities, Collection<String> identityFilter, String hostname, Long hostId, String serviceName, String componentName, Map<String,Map<String,String>> kerberosConfigurations, Map<String,Map<String,String>> configurations, Map<String,ResolvedKerberosKeytab> resolvedKeytabs, String realm) throws IOException
kerberosIdentityDataFileWriter
- a KerberosIdentityDataFileWriter to use for storing identity
recordsidentities
- a List of KerberosIdentityDescriptors to add to the data
fileidentityFilter
- a Collection of identity names indicating the relevant identities -
if null, no filter is relevant; if empty, the filter indicates no
relevant identitieshostname
- the relevant hostnameserviceName
- the relevant service namecomponentName
- the relevant component namekerberosConfigurations
- a map of the configurations to update with identity-specific
valuesconfigurations
- a Map of configurations to use a replacements for variables
in identity fieldsIOException
- if an error occurs while writing a record to the data fileMap<String,Map<String,String>> calculateConfigurations(Cluster cluster, String hostname, KerberosDescriptor kerberosDescriptor, boolean includePreconfigureData, boolean calculateClusterHostInfo) throws org.apache.ambari.server.AmbariException
ExecutionCommandWrapper.getExecutionCommand()
cluster
- the relevant Clusterhostname
- the relevant hostnamekerberosDescriptor
- a map of general Kerberos descriptor propertiesincludePreconfigureData
- true
to include the preconfigure data; otherwise falsecalculateClusterHostInfo
- org.apache.ambari.server.AmbariException
boolean isClusterKerberosEnabled(Cluster cluster)
cluster
- cluster to testboolean shouldExecuteCustomOperations(SecurityType requestSecurityType, Map<String,String> requestProperties)
requestSecurityType
- the SecurityType from the requestrequestProperties
- A Map of request directives and their valuesBoolean getManageIdentitiesDirective(Map<String,String> requestProperties)
requestProperties
- a map of the request property name/value pairsboolean getForceToggleKerberosDirective(Map<String,String> requestProperties)
false
is
returned.
If force_toggle_kerberos does exists in the map of request properties and is equal to "true",
then true
is returned; otherwise false
is returned.requestProperties
- a map of the request property name/value pairsMap<String,Map<String,String>> getIdentityConfigurations(List<KerberosIdentityDescriptor> identityDescriptors)
identityDescriptors
- a List of KerberosIdentityDescriptor from which to retrieve configurationsMap<String,Collection<KerberosIdentityDescriptor>> getActiveIdentities(String clusterName, String hostName, String serviceName, String componentName, boolean replaceHostNames, Map<String,Map<String,Map<String,String>>> hostConfigurations, KerberosDescriptor kerberosDescriptor) throws org.apache.ambari.server.AmbariException
null
value for any of these filters indicates no filter for that parameter.
The return values are grouped by host and optionally _HOST
in
principals will be replaced with the relevant hostname if specified to do
so.clusterName
- the name of the relevant cluster (mandatory)hostName
- the name of a host for which to find results, null indicates all
hostsserviceName
- the name of a service for which to find results, null indicates
all servicescomponentName
- the name of a component for which to find results, null indicates
all componentsreplaceHostNames
- if true, _HOST in principals will be replace with the relevant
host namehostConfigurations
- a mapping of hostname to configurations for that host. Fetching
this ahead of time for every host in the cluster will ensure that
this method doesn't need to do it inside of a loop. If
null
or empty, then this method will do the lookup itself,
at considerable cost.kerberosDescriptor
- the kerberos descriptor to use when looking up identities. If
null
, then this method will deserialize the descriptor
inside of a loop at considerable cost.org.apache.ambari.server.AmbariException
- if an error occurs processing the cluster's active identitiesList<KerberosIdentityDescriptor> getAmbariServerIdentities(KerberosDescriptor kerberosDescriptor) throws org.apache.ambari.server.AmbariException
kerberosDescriptor
- the kerberos descriptororg.apache.ambari.server.AmbariException
boolean createAmbariIdentities(Map<String,String> kerberosEnvProperties)
If kerberos-env/create_ambari_principal is not set to false the identity should be calculated.
kerberosEnvProperties
- the kerberos-env configuration propertiesPrincipalKeyCredential getKDCAdministratorCredentials(String clusterName) throws org.apache.ambari.server.AmbariException
clusterName
- the name of the relevant clusterorg.apache.ambari.server.AmbariException
- if an error occurs while retrieving the credentialsvoid createResolvedKeytab(ResolvedKerberosKeytab resolvedKerberosKeytab)
resolvedKerberosKeytab
- kerberos keytab to be persistedvoid removeStaleKeytabs(Collection<ResolvedKerberosKeytab> expectedKeytabs)
expectedKeytabs
collection.expectedKeytabs
- collection to compare existent keytabsFile createTemporaryDirectory() throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
- if a new temporary directory cannot be createdMap<String,Set<String>> translateConfigurationSpecifications(Collection<String> configurationSpecifications)
config-type/property-name
)
to a map of configuration types to a set of property names.
For example:
configurationSpecifications
- a collection of configuration specifications (config-type/property-name
)KerberosDetails getKerberosDetails(Cluster cluster, Boolean manageIdentities) throws KerberosInvalidConfigurationException, org.apache.ambari.server.AmbariException
cluster
- the relevant ClustermanageIdentities
- a Boolean value indicating how to override the configured behavior
of managing Kerberos identities; if null the configured behavior
will not be overriddenorg.apache.ambari.server.AmbariException
KerberosInvalidConfigurationException
Copyright © 2022 Apache Software Foundation. All rights reserved.