-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Add license check for FIPS #181187
Add license check for FIPS #181187
Changes from 27 commits
fd898bc
392bee9
eff7830
be473ba
d6f8f5c
eccc9e9
ea425ec
d2cc083
b65471c
a0b72e6
683531c
03f4b9e
ff51670
8959fbb
d50f7c5
b1fa762
9d4d035
fd58057
16d7ad8
2bee3ea
b2fc622
eb5d11f
b1cab38
abed490
15ab04b
955cf08
bc31503
80a3867
cb93a25
4816c26
4daab8c
6672ff9
27c9d15
58a9e1b
2126400
1b91334
d871efc
c37004a
90050f1
57c2f36
ff3586a
31b7546
7b1a16a
d5cd54e
19244c4
d468deb
b7f1de0
7b7ed01
50015b0
2c11610
fccc836
b82345d
33db0d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* 2.0. | ||
*/ | ||
|
||
import crypto from 'crypto'; | ||
import crypto, { getFips } from 'crypto'; | ||
import type { Duration } from 'moment'; | ||
import path from 'path'; | ||
|
||
|
@@ -313,13 +313,38 @@ export const ConfigSchema = schema.object({ | |
roleMappingManagementEnabled: schema.boolean({ defaultValue: true }), | ||
}), | ||
}), | ||
fipsMode: schema.object({ | ||
enabled: schema.boolean({ defaultValue: false }), | ||
}), | ||
}); | ||
|
||
function checkFipsConfig(config: RawConfigType, logger: Logger) { | ||
const isFipsEnabled = config.fipsMode.enabled; | ||
const isNodeRunningWithFipsEnabled = getFips() === 1; | ||
|
||
// Check if FIPS is enabled in either setting | ||
if (isFipsEnabled || isNodeRunningWithFipsEnabled) { | ||
// FIPS must be enabled on both or log and error an exit Kibana | ||
if (isFipsEnabled !== isNodeRunningWithFipsEnabled) { | ||
logger.error( | ||
`Configuration mismatch error. xpack.security.fipsMode.enabled is set to ${isFipsEnabled} and the configured Node.js environment has FIPS ${ | ||
isNodeRunningWithFipsEnabled ? 'enabled' : 'disabled' | ||
}` | ||
); | ||
process.exit(78); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙈 I gonna do like I did not saw a plugin's configuration validation call More seriously though, can't this be done at Core's level? I would have way less concerns and issues with Core performing this check (or at least this non-standard process termination). This is done before the license is added to the equation, right? So from my understanding nothing blocks it from being done in Core? (but if we can't I'll just 🙈) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😅 fair points, I'll take a look to see if there might be a better place for this check in core. Did you have any place in mind that might be best? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this possibly be done in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done in 2c11610 |
||
} else { | ||
logger.info('Kibana is running in FIPS mode.'); | ||
} | ||
} | ||
} | ||
|
||
export function createConfig( | ||
config: RawConfigType, | ||
logger: Logger, | ||
{ isTLSEnabled }: { isTLSEnabled: boolean } | ||
) { | ||
checkFipsConfig(config, logger); | ||
|
||
let encryptionKey = config.encryptionKey; | ||
if (encryptionKey === undefined) { | ||
logger.warn( | ||
|
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.
Nit: update test description to include "allow FIPS"