update docs for kerberos usage

This commit is contained in:
Brian Gann
2023-04-03 22:22:41 -04:00
parent 64fd2370f2
commit afda8cfc0b
2 changed files with 91 additions and 0 deletions
+6
View File
@@ -50,6 +50,12 @@ Administrators can also [configure the data source via YAML]({{< relref "#provis
| `Max idle` | The maximum number of connections in the idle connection pool, default `2` (Grafana v5.4+). |
| `Max lifetime` | The maximum amount of time in seconds a connection may be reused, default `14400`/4 hours. This should always be lower than configured [wait_timeout](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout) in MySQL (Grafana v5.4+). |
### Kerberos Authentication
It is also possible to use kerberos authentication when running MySQL Enterprise, and will require additional setup for Grafana.
For details, see the [configuring MySQL with Kerberos documentation]({{< relref "./kerberos/" >}}).
### Min time interval
The **Min time interval** setting defines a lower limit for the [`$__interval`]({{< relref "../../dashboards/variables/add-template-variables#__interval" >}}) and [`$__interval_ms`]({{< relref "../../dashboards/variables/add-template-variables#__interval_ms" >}}) variables.
@@ -0,0 +1,85 @@
---
aliases:
- ../../data-sources/mysql/kerberos/
description: Using Kerberos Authentication with MySQL Enterprise in Grafana
keywords:
- grafana
- MySQL
- SQL
- kerberos
menuTitle: Kerberos Authentication
title: MySQL Enterprise Kerberos Integration
weight: 400
---
# Kerberos Authentication with MySQL Enterprise in Grafana
A datasource (and Grafana itself) can use a kerberos-enabled MySQL Enterprise connection.
There are three modes of operation, each are detailed below.
## Environment Variables
Configuring Grafana to use kerberos authentication is done using environment variables that are common to the krb5 go library, and one additional variable unique to this driver.
- KRB5_CONFIG (defaults to `/etc/krb5.conf`)
- KRB5_CLIENT_KTNAME (user keytab)
- KRB5CCNAME
- KRB5_CC_LOOKUP_FILE
### Keytab
This is the typical setup where the user is running under a kerberos authenticated environment, and has a keytab and corresponding credential cache that is updated as needed.
### Global Credential Cache
This setup allows a specific credential cache to be used as a fallback where there isn't a keytab, and where there isn't a match in the lookup file.
The credential cache (generated by `kinit`), can be specified with the environment variable:
`KRB5CCNAME`
### Per-Connection Credential Cache
This provides a lookup file that maps a connection to a specific credential cache. This allows connection to multiple databases with different users using the appropriate authentication.
`KRB5_CC_LOOKUP_FILE`
```JSON
[
{
"user": "usera",
"database": "dbone",
"address": "mysql1.mydomain.com:3306",
"credentialCache": "/tmp/krb5cc_1000"
},
{
"user": "userb",
"database": "dbtwo",
"address": "mysql2.mydomain.com:3306",
"credentialCache": "/tmp/krb5cc_1001"
}
]
```
# Configuring a Kerberos Enabled MySQL Datasource
The configuration options remain the same, except for the hostname option which will include a simple connection string in the hostname field in the form:
```TEXT
mysql://kirbuser@emysql.grafana.com:3306/grafanacore
```
Authentication will use the environment variables/lookup methods as needed. The username/password fields shouldl remain empty.
# Running Grafana with a Kerberos Enabled MySQL Database
An example of running Grafana using this method:
```SHELL
export GF_DATABASE_URL=mysql://kirbuser@emysql.grafana.com:3306/grafanacore
export GF_DATABASE_MAX_IDLE_CONN=10
export KRB5CCNAME=/tmp/krb5cc_1000
```
In the above example, the user ID is `1000` and the `kinit` command would generate the `/tmp/krb5cc_1000` file for the user `kirbuser.`