Enable Authenticators for Applications
The following topic describes how to enable authenticators for application deployment.
Policy
Define and upload the following policies:
At least one user needs write permission to load policy and variables into DAP. This is standard DAP policy that creates an administrative group of users for DAP.
Use the following policy as a template to assign permissions:
|
The identities that will be used to authenticate and retrieve secrets from DAP will also need to be defined in policy and added to the layer that was granted access to the Kubernetes authenticator webservice in the previous policy.
For details about the different identities that can be used in this policy, see Application Identity in OpenShift/Kubernetes
Variable |
Description |
---|---|
AUTHENTICATOR_ID |
The Conjur authenticator that your Kubernetes or OpenShift applications are using. |
TEST_APP_NAMESPACE_NAME |
The namespace you are deploying your applications to. |
APPLICATION_SERVICE_ACCOUNT |
The service account that the application is using. |
|
DAP uses policy to allowlist the applications that have access to the Kubernetes authenticator and store the values necessary to create client certificates for mutual TLS. The authenticator service policy should include:
Resource |
Description |
---|---|
Webservice | A resources to represent the authenticator itself |
Variable | A resource to hold the CA certificate and key for creating client certificates |
Permit statement | Allowlists a layer of application identities |
Use the following policy as a template to allowlist applications.
Replace the following variables with values:
Variable |
Description |
---|---|
AUTHENTICATOR_ID | The Conjur authenticator that your K8s / OC applications are using. |
APPLICATION_NAMESPACE | The namespace you are deploying your applications to. |
|
-
Save policy as .yml files in a location accessible to the DAP Master.
-
Log into DAP.
-
Load each policy file:
$ conjur policy load root <policy_for_human_users.yml>
$ conjur policy load root <policy_for_authenticator_identities.yml>
$ conjur policy load root <policy_for_k8s_authenticator_service.yml>
Initialize the CA
The DAP uses policy to allowlist the applications that have access to the Kubernetes authenticator and store the values necessary to create client certificates for mutual TLS. The authenticator service policy should include: declares variables to hold a CA certificate and key. After loading the policy, run the following commands to initialize those resources.
-
The value of
AUTHENTICATOR_ID
must match the AUTHENTICATOR_ID in the name of the Kubernetes Authenticator policy defined in the DAP uses policy to allowlist the applications that have access to the Kubernetes authenticator and store the values necessary to create client certificates for mutual TLS. The authenticator service policy should include:. For example, if the policy ID is "conjur/authn-k8s/subcluster-1", the value ofAUTHENTICATOR_ID
is "subcluster-1". -
The value of
CONJUR_ACCOUNT
must match the DAP account used when deploying the Follower.
To initialize the CA, run the following script:
|
These commands create a private key and root certificate and store contents of those files in the variables
conjur/authn-k8s/<AUTHENTICATOR_ID>/ca/key
and
conjur/authn-k8s/<AUTHENTICATOR_ID>/ca/cert
.
Login or auth calls to the webservice will fail if these resources are not properly defined in policy and initialized.
Configure Conjur authenticators
The deployment scripts for DAP already performed this step using the value you set in the SERVICE_ID environment variable. You need to be aware of this step to add additional application clusters or additional authenticator types. |
The
CONJUR_AUTHENTICATORS
environment variable in the DAP deployment YAML file defines the authentication types
used to authenticate with the DAP cluster.
This variable is set on followers. |
To enable Kubernetes authentication, use:
|
where AUTHENTICATOR_ID is the id assigned to the authn-k8s webservice in DAP policy. It is important that the AUTHENTICATOR_ID used here match the webservice id declared in the Kubernetes policy.
For example, in this snippet from the Conjur webservice policy, a policy branch named
conjur
declares the
authn-k8s
service with the authenticator_id of
prod
:
|
The authentication value is:
|
One authn-k8s service can serve multiple application authenticator ids. Additional DAP policy for hosts and applications will control which namespaces get access to DAP and which applications get access to specific secrets. There should be a separate authn-k8s policy (and corresponding authenticator id) for each or Kubernetes cluster.
CONJUR_AUTHENTICATORS can include more than one authenticator and more than one authentication type as a comma-separated list. For example, the following shows two authn-k8s services and another unrelated authenticator:
|
To disable an authenticator, remove it from the list.