+ Certificate for Conjur server is OPTIONAL -- But, **when using a self-signed cert when setting up your Conjur server, it is strongly recommended to populate "caBundle" with self-signed cert in the secret-store definition**
When using a self-signed cert when setting up your Conjur server, it is strongly recommended to populate "caBundle" with self-signed cert in the secret-store definition. The certificate CA must be referenced on the secret-store definition using either a `caBundle` or `caProvider` as below:
### External Secret Store Definition with ApiKey Authentication
This method uses a combination of the Conjur `hostid` and `apikey` to authenticate to Conjur. This method is the simplest to setup and use as your Conjur instance requires no special setup.
In order for the ESO **Conjur** provider to connect to the Conjur server using the `apikey` creds, these creds should be stored as k8s secrets. Please refer to <https://kubernetes.io/docs/concepts/configuration/secret/#creating-a-secret> for various methods to create secrets. Here is one way to do it using `kubectl`
This method uses JWT tokens to authenticate with Conjur. The following methods for retrieving the JWT token for authentication are supported:
- JWT token from a referenced Kubernetes Service Account
- JWT token stored in a Kubernetes secret
#### Create External Secret Store Definition
When using JWT authentication the following must be specified in the `SecretStore`:
-`account` - The name of the Conjur account
-`serviceId` - The ID of the JWT Authenticator `WebService` configured in Conjur that will be used to authenticate the JWT token
You can then choose to either retrieve the JWT token using a Service Account reference or from a Kubernetes Secret.
To use a JWT token from a referenced Kubernetes Service Account, the following secret store definition can be used:
```yaml
{% include 'conjur-secret-store-jwt-service-account-ref.yaml' %}
```
This is only supported in Kubernetes 1.22 and above as it uses the [TokenRequest API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-resources/token-request-v1/) to get the JWT token from the referenced service account. Audiences can be set as required by the [Conjur JWT authenticator](https://docs.conjur.org/Latest/en/Content/Integrations/k8s-ocp/k8s-jwt-authn.htm).
Alternatively, a secret containing a valid JWT token can be referenced as follows:
```yaml
{% include 'conjur-secret-store-jwt-secret-ref.yaml' %}
```
This secret must contain a JWT token that identifies your Conjur host. The secret must contain a JWT token consumable by a configured Conjur JWT authenticator and must satisfy all [Conjur JWT guidelines](https://docs.conjur.org/Latest/en/Content/Operations/Services/cjr-authn-jwt-guidelines.htm#Best). This can be a JWT created by an external JWT issuer or the Kubernetes api server itself. Such a with Kubernetes Service Account token can be created using the below command:
Save the `SecretStore` definition as filename `conjur-secret-store.yaml` as referenced in later steps.
### Create External Secret Definition
Important note: **Creds must live in the same namespace as a SecretStore - the secret store may only reference secrets from the same namespace.** When using a ClusterSecretStore this limitation is lifted and the creds can live in any namespace.
Recommend to save as filename: `conjur-external-secret.yaml`