-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Enable tests in FIPS 140 in JDK 11 #48378
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
Changes from all commits
0b98221
f5651a2
65f7532
cc1c5fe
1a864a7
74b0548
6b30693
4b17e9a
85e3cf3
80a28ee
3543a4b
4b48f7f
403abd3
a3db46d
b44534f
66d1a99
e4f59f0
d6ea75a
99aeb03
f1cf5b9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,7 @@ public class ElasticsearchNode implements TestClusterConfiguration { | |
| private final LazyPropertyMap<String, CharSequence> environment = new LazyPropertyMap<>("Environment", this); | ||
| private final LazyPropertyList<CharSequence> jvmArgs = new LazyPropertyList<>("JVM arguments", this); | ||
| private final LazyPropertyMap<String, File> extraConfigFiles = new LazyPropertyMap<>("Extra config files", this, FileEntry::new); | ||
| private final LazyPropertyList<File> extraJarFiles = new LazyPropertyList<>("Extra jar files", this); | ||
| private final List<Map<String, String>> credentials = new ArrayList<>(); | ||
| final LinkedHashMap<String, String> defaultConfig = new LinkedHashMap<>(); | ||
|
|
||
|
|
@@ -454,6 +455,8 @@ public synchronized void start() { | |
|
|
||
| copyExtraConfigFiles(); | ||
|
|
||
| copyExtraJars(); | ||
|
|
||
| if (isSettingTrue("xpack.security.enabled")) { | ||
| if (credentials.isEmpty()) { | ||
| user(Collections.emptyMap()); | ||
|
|
@@ -530,6 +533,25 @@ private void copyExtraConfigFiles() { | |
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Copies extra jars to the `/lib` directory. | ||
| * //TODO: Remove this when system modules are available | ||
| */ | ||
| private void copyExtraJars() { | ||
| if (extraJarFiles.isEmpty() == false){ | ||
| logToProcessStdout("Setting up " + extraJarFiles.size() + " additional jar dependencies"); | ||
| } | ||
| extraJarFiles.forEach(from -> { | ||
| Path destination = getDistroDir().resolve("lib").resolve(from.getName()); | ||
|
Member
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 think this will leave trash behind. @atorok don't we setup a link for the lib dir? This would copy into the lib dir and be left behind after the test is run?
Contributor
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. We don't set up links for directories, so this will be fine. That does bring up a slightly different problem, if we were to replace one of the jars with this mechanism, that will be reflected for all invocations across all projects because the initial file could have changed. That would be really hard to spot and debug. We originally had code to set the links to read only so this would error out, maybe we should get that back ? It would work across the board, as opposed to just checking that the libs don't replace other libs.
Contributor
Author
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. is this something that should be taken into consideration in the context of this PR @atorok or are we ok to merge this and address it in a follow up ?
Contributor
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 think it's ok as a follow-up |
||
| try { | ||
| Files.copy(from.toPath(), destination, StandardCopyOption.REPLACE_EXISTING); | ||
| LOGGER.info("Added extra jar {} to {}", from.getName(), destination); | ||
| } catch (IOException e) { | ||
| throw new UncheckedIOException("Can't copy extra jar dependency " + from.getName() + " to " + destination.toString(), e); | ||
| } | ||
| }); | ||
| } | ||
|
|
||
| private void installModules() { | ||
| if (testDistribution == TestDistribution.INTEG_TEST) { | ||
| logToProcessStdout("Installing " + modules.size() + "modules"); | ||
|
|
@@ -576,6 +598,14 @@ public void extraConfigFile(String destination, File from, PropertyNormalization | |
| extraConfigFiles.put(destination, from, normalization); | ||
| } | ||
|
|
||
| @Override | ||
| public void extraJarFile(File from) { | ||
| if (from.toString().endsWith(".jar") == false) { | ||
| throw new IllegalArgumentException("extra jar file " + from.toString() + " doesn't appear to be a JAR"); | ||
| } | ||
| extraJarFiles.add(from); | ||
| } | ||
|
|
||
| @Override | ||
| public void user(Map<String, String> userSpec) { | ||
| Set<String> keys = new HashSet<>(userSpec.keySet()); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| grant { | ||
| permission java.security.SecurityPermission "putProviderProperty.BCFIPS"; | ||
| permission java.security.SecurityPermission "putProviderProperty.BCJSSE"; | ||
| permission java.lang.RuntimePermission "getProtectionDomain"; | ||
| permission java.util.PropertyPermission "java.runtime.name", "read"; | ||
| permission org.bouncycastle.crypto.CryptoServicesPermission "tlsAlgorithmsEnabled"; | ||
| //io.netty.handler.codec.DecoderException | ||
| permission java.lang.RuntimePermission "accessClassInPackage.sun.security.internal.spec"; | ||
| //java.security.InvalidAlgorithmParameterException: Cannot process GCMParameterSpec | ||
| permission java.lang.RuntimePermission "accessDeclaredMembers"; | ||
| permission java.util.PropertyPermission "intellij.debug.agent", "read"; | ||
| permission java.util.PropertyPermission "intellij.debug.agent", "write"; | ||
| permission org.bouncycastle.crypto.CryptoServicesPermission "exportSecretKey"; | ||
| permission org.bouncycastle.crypto.CryptoServicesPermission "exportPrivateKey"; | ||
| permission java.io.FilePermission "${javax.net.ssl.trustStore}", "read"; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| security.provider.1=org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider | ||
| security.provider.2=org.bouncycastle.jsse.provider.BouncyCastleJsseProvider fips:BCFIPS | ||
| security.provider.3=SUN | ||
| securerandom.source=file:/dev/urandom | ||
| securerandom.strongAlgorithms=NativePRNGBlocking:SUN,DRBG:SUN | ||
| securerandom.drbg.config= | ||
| login.configuration.provider=sun.security.provider.ConfigFile | ||
| policy.provider=sun.security.provider.PolicyFile | ||
| policy.expandProperties=true | ||
| policy.allowSystemProperty=true | ||
| policy.ignoreIdentityScope=false | ||
| keystore.type=BCFKS | ||
| keystore.type.compat=true | ||
| package.access=sun.misc.,\ | ||
| sun.reflect. | ||
| package.definition=sun.misc.,\ | ||
| sun.reflect. | ||
| security.overridePropertiesFile=true | ||
| ssl.KeyManagerFactory.algorithm=PKIX | ||
| ssl.TrustManagerFactory.algorithm=PKIX | ||
| networkaddress.cache.negative.ttl=10 | ||
| krb5.kdc.bad.policy = tryLast | ||
| jdk.certpath.disabledAlgorithms=MD2, MD5, SHA1 jdkCA & usage TLSServer, \ | ||
| RSA keySize < 1024, DSA keySize < 1024, EC keySize < 224 | ||
| jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024, \ | ||
| DSA keySize < 1024 | ||
| jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 1024, \ | ||
| EC keySize < 224, DES40_CBC, RC4_40, 3DES_EDE_CBC | ||
| jdk.tls.legacyAlgorithms= \ | ||
| K_NULL, C_NULL, M_NULL, \ | ||
| DH_anon, ECDH_anon, \ | ||
| RC4_128, RC4_40, DES_CBC, DES40_CBC, \ | ||
| 3DES_EDE_CBC | ||
| jdk.tls.keyLimits=AES/GCM/NoPadding KeyUpdate 2^37 | ||
| crypto.policy=unlimited | ||
| jdk.xml.dsig.secureValidationPolicy=\ | ||
| disallowAlg http://www.w3.org/TR/1999/REC-xslt-19991116,\ | ||
| disallowAlg http://www.w3.org/2001/04/xmldsig-more#rsa-md5,\ | ||
| disallowAlg http://www.w3.org/2001/04/xmldsig-more#hmac-md5,\ | ||
| disallowAlg http://www.w3.org/2001/04/xmldsig-more#md5,\ | ||
| maxTransforms 5,\ | ||
| maxReferences 30,\ | ||
| disallowReferenceUriSchemes file http https,\ | ||
| minKeySize RSA 1024,\ | ||
| minKeySize DSA 1024,\ | ||
| minKeySize EC 224,\ | ||
| noDuplicateIds,\ | ||
| noRetrievalMethodLoops | ||
| jceks.key.serialFilter = java.base/java.lang.Enum;java.base/java.security.KeyRep;\ | ||
| java.base/java.security.KeyRep$Type;java.base/javax.crypto.spec.SecretKeySpec;!* |
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.
We prefer not to couple testclusters with random project configuration like an
extraJarsconfiguration.Would be better to have extra jars work exactly as extra config files so these jars could be passed in externally.
A more generic way would be to add the possibility to add hooks right before the task starts.
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.
I moved this outside as suggested, similar to how extraConfigurationFiles work