mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
Adding telemetry for the fips config (#201282)
## Summary Adding telemetry for the `fipsMode.enabled` config
This commit is contained in:
parent
7fe25036d4
commit
8f12d52138
3 changed files with 72 additions and 1 deletions
|
@ -26,6 +26,7 @@ describe('Security UsageCollector', () => {
|
|||
allowAccessAgreement = true,
|
||||
allowAuditLogging = true,
|
||||
allowRbac = true,
|
||||
allowFips = true,
|
||||
isLicenseAvailable,
|
||||
}: Partial<SecurityLicenseFeatures> & { isLicenseAvailable: boolean }) => {
|
||||
const license = licenseMock.create();
|
||||
|
@ -34,6 +35,7 @@ describe('Security UsageCollector', () => {
|
|||
allowAccessAgreement,
|
||||
allowAuditLogging,
|
||||
allowRbac,
|
||||
allowFips,
|
||||
} as SecurityLicenseFeatures);
|
||||
return license;
|
||||
};
|
||||
|
@ -44,6 +46,7 @@ describe('Security UsageCollector', () => {
|
|||
accessAgreementEnabled: false,
|
||||
authProviderCount: 1,
|
||||
enabledAuthProviders: ['basic'],
|
||||
fipsModeEnabled: false,
|
||||
loginSelectorEnabled: false,
|
||||
httpAuthSchemes: ['apikey', 'bearer'],
|
||||
sessionIdleTimeoutInMinutes: 4320,
|
||||
|
@ -106,6 +109,7 @@ describe('Security UsageCollector', () => {
|
|||
accessAgreementEnabled: false,
|
||||
authProviderCount: 0,
|
||||
enabledAuthProviders: [],
|
||||
fipsModeEnabled: false,
|
||||
loginSelectorEnabled: false,
|
||||
httpAuthSchemes: [],
|
||||
sessionIdleTimeoutInMinutes: 0,
|
||||
|
@ -426,6 +430,55 @@ describe('Security UsageCollector', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('fipsMode enabled', () => {
|
||||
it('reports when fipsMode is enabled', async () => {
|
||||
const config = createSecurityConfig(
|
||||
ConfigSchema.validate({
|
||||
fipsMode: {
|
||||
enabled: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
const usageCollection = usageCollectionPluginMock.createSetupContract();
|
||||
const license = createSecurityLicense({
|
||||
isLicenseAvailable: true,
|
||||
allowFips: true,
|
||||
});
|
||||
registerSecurityUsageCollector({ usageCollection, config, license });
|
||||
|
||||
const usage = await usageCollection
|
||||
.getCollectorByType('security')
|
||||
?.fetch(collectorFetchContext);
|
||||
|
||||
expect(usage).toEqual({
|
||||
...DEFAULT_USAGE,
|
||||
fipsModeEnabled: true,
|
||||
});
|
||||
});
|
||||
|
||||
it('does not report fipsMode when the license does not permit it', async () => {
|
||||
const config = createSecurityConfig(
|
||||
ConfigSchema.validate({
|
||||
fipsMode: {
|
||||
enabled: true,
|
||||
},
|
||||
})
|
||||
);
|
||||
const usageCollection = usageCollectionPluginMock.createSetupContract();
|
||||
const license = createSecurityLicense({ isLicenseAvailable: true, allowFips: false });
|
||||
registerSecurityUsageCollector({ usageCollection, config, license });
|
||||
|
||||
const usage = await usageCollection
|
||||
.getCollectorByType('security')
|
||||
?.fetch(collectorFetchContext);
|
||||
|
||||
expect(usage).toEqual({
|
||||
...DEFAULT_USAGE,
|
||||
fipsModeEnabled: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('http auth schemes', () => {
|
||||
it('reports customized http auth schemes', async () => {
|
||||
const config = createSecurityConfig(
|
||||
|
|
|
@ -16,6 +16,7 @@ interface Usage {
|
|||
accessAgreementEnabled: boolean;
|
||||
authProviderCount: number;
|
||||
enabledAuthProviders: string[];
|
||||
fipsModeEnabled: boolean;
|
||||
httpAuthSchemes: string[];
|
||||
sessionIdleTimeoutInMinutes: number;
|
||||
sessionLifespanInMinutes: number;
|
||||
|
@ -93,6 +94,12 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
|
|||
},
|
||||
},
|
||||
},
|
||||
fipsModeEnabled: {
|
||||
type: 'boolean',
|
||||
_meta: {
|
||||
description: 'Indicates if Kibana is being run in FIPS mode.',
|
||||
},
|
||||
},
|
||||
httpAuthSchemes: {
|
||||
type: 'array',
|
||||
items: {
|
||||
|
@ -139,7 +146,8 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
|
|||
},
|
||||
},
|
||||
fetch: () => {
|
||||
const { allowRbac, allowAccessAgreement, allowAuditLogging } = license.getFeatures();
|
||||
const { allowRbac, allowAccessAgreement, allowAuditLogging, allowFips } =
|
||||
license.getFeatures();
|
||||
if (!allowRbac) {
|
||||
return {
|
||||
auditLoggingEnabled: false,
|
||||
|
@ -147,6 +155,7 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
|
|||
accessAgreementEnabled: false,
|
||||
authProviderCount: 0,
|
||||
enabledAuthProviders: [],
|
||||
fipsModeEnabled: false,
|
||||
httpAuthSchemes: [],
|
||||
sessionIdleTimeoutInMinutes: 0,
|
||||
sessionLifespanInMinutes: 0,
|
||||
|
@ -171,6 +180,8 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
|
|||
WELL_KNOWN_AUTH_SCHEMES.includes(scheme.toLowerCase())
|
||||
);
|
||||
|
||||
const fipsModeEnabled = allowFips && config.fipsMode.enabled;
|
||||
|
||||
const sessionExpirations = config.session.getExpirationTimeouts(undefined); // use `undefined` to get global expiration values
|
||||
const sessionIdleTimeoutInMinutes = sessionExpirations.idleTimeout?.asMinutes() ?? 0;
|
||||
const sessionLifespanInMinutes = sessionExpirations.lifespan?.asMinutes() ?? 0;
|
||||
|
@ -202,6 +213,7 @@ export function registerSecurityUsageCollector({ usageCollection, config, licens
|
|||
accessAgreementEnabled,
|
||||
authProviderCount,
|
||||
enabledAuthProviders,
|
||||
fipsModeEnabled,
|
||||
httpAuthSchemes,
|
||||
sessionIdleTimeoutInMinutes,
|
||||
sessionLifespanInMinutes,
|
||||
|
|
|
@ -15224,6 +15224,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"fipsModeEnabled": {
|
||||
"type": "boolean",
|
||||
"_meta": {
|
||||
"description": "Indicates if Kibana is being run in FIPS mode."
|
||||
}
|
||||
},
|
||||
"httpAuthSchemes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue