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

[Draft] Testing admin password changes #415

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 7 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def _numNodes = findProperty('numNodes') as Integer ?: 1

ext{

System.setProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD", "myStrongPassword123!")
configureSecurityPlugin = { OpenSearchCluster cluster ->

// Retrieve Security Plugin Zip from zipArchive
Expand All @@ -200,12 +201,14 @@ ext{
}
}

var adminPassword = System.getProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this setter should be version based. In case the version being pulled is < 2.12 the password is admin else it should be read from env variable. But in case if security plugin's demo configuration is not being used at all, this logic is not needed at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The security plugin's demo configuration isn't directly used, we pull the configuration files from the security plugin and manually set the required cluster settings while setting up a security enabled integration test cluster. Given this, I'll go ahead and close out this PR, as this modification is not necessary for our plugin.


cluster.getNodes().forEach { node ->
var creds = node.getCredentials()
if (creds.isEmpty()) {
creds.add(Map.of('username', 'admin', 'password', 'admin'))
creds.add(Map.of('username', 'admin', 'password', adminPassword))
} else {
creds.get(0).putAll(Map.of('username', 'admin', 'password', 'admin'))
creds.get(0).putAll(Map.of('username', 'admin', 'password', adminPassword))
}
}

Expand Down Expand Up @@ -287,7 +290,7 @@ integTest {
if (System.getProperty('security.enabled') != null) {
is_https = is_https == null ? 'true' : is_https
user = user == null ? 'admin' : user
password = password == null ? 'admin' : password
password = password == null ? System.getProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD") : password
}
systemProperty('https', is_https)
systemProperty('user', user)
Expand Down Expand Up @@ -391,7 +394,7 @@ task integTestRemote(type: RestIntegTestTask) {
if (System.getProperty('security.enabled') != null) {
is_https = is_https == null ? 'true' : is_https
user = user == null ? 'admin' : user
password = password == null ? 'admin' : password
password = password == null ? System.getProperty("OPENSEARCH_INITIAL_ADMIN_PASSWORD") : password
}
systemProperty('https', is_https)
systemProperty('user', user)
Expand Down
Loading