Skip to content
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

BACKPORT 6.8 Fix test LdapSessionFactoryTests testSslTrustIsReloaded (#69001) #69019

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ public void testGroupLookupBase() throws Exception {
* If the realm's CA path is monitored for changes and the underlying SSL context is reloaded, then we will get two different outcomes
* (one failure, one success) depending on which file content is in place.
*/
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/68995")
public void testSslTrustIsReloaded() throws Exception {
InMemoryDirectoryServer ldapServer = randomFrom(ldapServers);
InetAddress listenAddress = ldapServer.getListenAddress("ldaps");
Expand All @@ -239,8 +238,11 @@ public void testSslTrustIsReloaded() throws Exception {
.put(buildLdapSettings(ldapUrl, userTemplates, groupSearchBase, LdapSearchScope.SUB_TREE))
.build();

// !!!make sure that the file size on disk for the two pem CAs is different!!!
// otherwise, the resource watcher has to rely on the last modified timestamp to detect changes,
// and the resolution for that can be as low as a second, and the test would spuriously fail
final Path realCa = getDataPath("/org/elasticsearch/xpack/security/authc/ldap/support/ldap-ca.crt");
final Path fakeCa = getDataPath("/org/elasticsearch/xpack/security/authc/ldap/support/smb_ca.crt");
final Path fakeCa = getDataPath("/org/elasticsearch/xpack/security/authc/ldap/support/ad.crt");

final Environment environment = TestEnvironment.newEnvironment(settings);
RealmConfig config = new RealmConfig("ldap_realm", settings, globalSettings, environment, new ThreadContext(settings));
Expand All @@ -252,6 +254,7 @@ public void testSslTrustIsReloaded() throws Exception {
new SSLConfigurationReloader(environment, sslService, resourceWatcher);

Files.copy(fakeCa, ldapCaPath, StandardCopyOption.REPLACE_EXISTING);
// resourceWatcher looks at the file size and last access timestamp to detect changes
resourceWatcher.notifyNow(ResourceWatcherService.Frequency.HIGH);

UncategorizedExecutionException e =
Expand Down