-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
backend: Feature - enable kerberos with forked go-mysql-driver #65753
Open
briangann
wants to merge
5
commits into
main
Choose a base branch
from
20230331_add_kerberos_support
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+166
−4
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1c03a03
add kerberos support
briangann 64fd237
Merge branch 'main' into 20230331_add_kerberos_support
briangann afda8cf
update docs for kerberos usage
briangann fe891f5
Merge branch 'main' into 20230331_add_kerberos_support
briangann 2e0baa3
Merge branch 'main' into 20230331_add_kerberos_support
briangann File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it a requirement to add these on separate lines instead of all in one?