Skip to content

Commit d00c09e

Browse files
authored
[Monitoring] Fix the messaging around needing TLS enabled (#72310) (#72627)
* Fix the copy * Fix type issues * PR feedback * Add missing code
1 parent 6378647 commit d00c09e

1 file changed

Lines changed: 5 additions & 77 deletions

File tree

x-pack/plugins/monitoring/public/alerts/lib/security_toasts.tsx

Lines changed: 5 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react';
88
import { i18n } from '@kbn/i18n';
99
import { FormattedMessage } from '@kbn/i18n/react';
10-
import { EuiSpacer, EuiLink, EuiCode, EuiText } from '@elastic/eui';
10+
import { EuiSpacer, EuiLink } from '@elastic/eui';
1111
import { Legacy } from '../../legacy_shims';
1212
import { toMountPoint } from '../../../../../../src/plugins/kibana_react/public';
1313

@@ -30,11 +30,10 @@ const showTlsAndEncryptionError = () => {
3030
<div>
3131
<p>
3232
{i18n.translate('xpack.monitoring.healthCheck.tlsAndEncryptionError', {
33-
defaultMessage: `You must enable Transport Layer Security between Kibana and Elasticsearch
34-
and configure an encryption key in your kibana.yml file to use the Alerting feature.`,
33+
defaultMessage: `Stack monitoring alerts require Transport Layer Security between Kibana and Elasticsearch, and an encryption key in your kibana.yml file.`,
3534
})}
3635
</p>
37-
<EuiSpacer />
36+
<EuiSpacer size="xs" />
3837
<EuiLink
3938
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-action-settings-kb.html#general-alert-action-settings`}
4039
external
@@ -49,76 +48,9 @@ const showTlsAndEncryptionError = () => {
4948
});
5049
};
5150

52-
const showEncryptionError = () => {
53-
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
54-
55-
Legacy.shims.toastNotifications.addWarning(
56-
{
57-
title: toMountPoint(
58-
<FormattedMessage
59-
id="xpack.monitoring.healthCheck.encryptionErrorTitle"
60-
defaultMessage="You must set an encryption key"
61-
/>
62-
),
63-
text: toMountPoint(
64-
<div role="banner">
65-
{i18n.translate('xpack.monitoring.healthCheck.encryptionErrorBeforeKey', {
66-
defaultMessage: 'To create an alert, set a value for ',
67-
})}
68-
<EuiText size="xs">
69-
<EuiCode>{'xpack.encryptedSavedObjects.encryptionKey'}</EuiCode>
70-
</EuiText>
71-
{i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAfterKey', {
72-
defaultMessage: ' in your kibana.yml file. ',
73-
})}
74-
<EuiLink
75-
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/alert-action-settings-kb.html#general-alert-action-settings`}
76-
external
77-
target="_blank"
78-
>
79-
{i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAction', {
80-
defaultMessage: 'Learn how.',
81-
})}
82-
</EuiLink>
83-
</div>
84-
),
85-
},
86-
{}
87-
);
88-
};
89-
90-
const showTlsError = () => {
91-
const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
92-
93-
Legacy.shims.toastNotifications.addWarning({
94-
title: toMountPoint(
95-
<FormattedMessage
96-
id="xpack.monitoring.healthCheck.tlsErrorTitle"
97-
defaultMessage="You must enable Transport Layer Security"
98-
/>
99-
),
100-
text: toMountPoint(
101-
<div role="banner">
102-
{i18n.translate('xpack.monitoring.healthCheck.tlsError', {
103-
defaultMessage:
104-
'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. ',
105-
})}
106-
<EuiLink
107-
href={`${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/configuring-tls.html`}
108-
external
109-
target="_blank"
110-
>
111-
{i18n.translate('xpack.monitoring.healthCheck.tlsErrorAction', {
112-
defaultMessage: 'Learn how to enable TLS.',
113-
})}
114-
</EuiLink>
115-
</div>
116-
),
117-
});
118-
};
119-
12051
export const showSecurityToast = (alertingHealth: AlertingFrameworkHealth) => {
12152
const { isSufficientlySecure, hasPermanentEncryptionKey } = alertingHealth;
53+
12254
if (
12355
Array.isArray(alertingHealth) ||
12456
(!alertingHealth.hasOwnProperty('isSufficientlySecure') &&
@@ -127,11 +59,7 @@ export const showSecurityToast = (alertingHealth: AlertingFrameworkHealth) => {
12759
return;
12860
}
12961

130-
if (!isSufficientlySecure && !hasPermanentEncryptionKey) {
62+
if (!isSufficientlySecure || !hasPermanentEncryptionKey) {
13163
showTlsAndEncryptionError();
132-
} else if (!isSufficientlySecure) {
133-
showTlsError();
134-
} else if (!hasPermanentEncryptionKey) {
135-
showEncryptionError();
13664
}
13765
};

0 commit comments

Comments
 (0)