diff --git a/docs/sources/administration/provisioning.md b/docs/sources/administration/provisioning.md index 1ce057d93ca..856eee61563 100644 --- a/docs/sources/administration/provisioning.md +++ b/docs/sources/administration/provisioning.md @@ -146,6 +146,7 @@ Since not all datasources have the same configuration settings we only have the | tlsAuth | boolean | _All_ | Enable TLS authentication using client cert configured in secure json data | | tlsAuthWithCACert | boolean | _All_ | Enable TLS authentication using CA cert | | tlsSkipVerify | boolean | _All_ | Controls whether a client verifies the server's certificate chain and host name. | +| serverName | string | _All_ | Optional. Controls the server name used for certificate common name/subject alternative name verification. Defaults to using the data source URL. | | graphiteVersion | string | Graphite | Graphite version | | timeInterval | string | Prometheus, Elasticsearch, InfluxDB, MySQL, PostgreSQL and MSSQL | Lowest interval/step value that should be used for this data source. | | httpMode | string | Influxdb | HTTP Method. 'GET', 'POST', defaults to GET | diff --git a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx index 768ec624964..8f562623a95 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/DataSourceHttpSettings.story.tsx @@ -25,6 +25,7 @@ const settingsMock: DataSourceSettings = { timeInterval: '15s', httpMode: 'GET', keepCookies: ['cookie1', 'cookie2'], + serverName: '', }, secureJsonData: { password: true, diff --git a/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx b/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx index da9c41fb7bd..f468d5f4aae 100644 --- a/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx +++ b/packages/grafana-ui/src/components/DataSourceSettings/TLSAuthSettings.tsx @@ -5,11 +5,13 @@ import { Tooltip } from '../Tooltip/Tooltip'; import { Icon } from '../Icon/Icon'; import { CertificationKey } from './CertificationKey'; import { HttpSettingsBaseProps } from './types'; +import { FormField } from '../FormField/FormField'; export const TLSAuthSettings: React.FC = ({ dataSourceConfig, onChange }) => { const hasTLSCACert = dataSourceConfig.secureJsonFields && dataSourceConfig.secureJsonFields.tlsCACert; const hasTLSClientCert = dataSourceConfig.secureJsonFields && dataSourceConfig.secureJsonFields.tlsClientCert; const hasTLSClientKey = dataSourceConfig.secureJsonFields && dataSourceConfig.secureJsonFields.tlsClientKey; + const hasServerName = dataSourceConfig.jsonData && dataSourceConfig.jsonData.serverName; const onResetClickFactory = (field: string) => (event: React.MouseEvent) => { event.preventDefault(); @@ -31,6 +33,18 @@ export const TLSAuthSettings: React.FC = ({ dataSourceCon }); }; + const onServerNameLabelChange = (event: React.SyntheticEvent) => { + const newJsonData = { + ...dataSourceConfig.jsonData, + serverName: event.currentTarget.value, + }; + + onChange({ + ...dataSourceConfig, + jsonData: newJsonData, + }); + }; + return (
= ({ dataSourceCon {dataSourceConfig.jsonData.tlsAuth && ( <> +
+ +