Skip to content

Commit b44d7ea

Browse files
Renames securityconfig folder to config in bundle step and makes relevant changes (#1749)
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
1 parent e213e9c commit b44d7ea

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

DEVELOPER_GUIDE.md

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ cp build/distributions/opensearch-security-*.zip $OPENSEARCH_SECURITY_HOME
6060
cd $OPENSEARCH_SECURITY_HOME
6161
unzip opensearch-security-*.zip
6262
rm opensearch-security-*.zip
63+
mkdir $OPENSEARCH_HOME/config/opensearch-security
64+
mv config/* $OPENSEARCH_HOME/config/opensearch-security/
65+
rm -rf config/
6366
```
6467

6568
Install the demo certificates and default configuration, answer `y` to the first two questions and `n` to the last one. The log should look like below:
@@ -74,22 +77,22 @@ Cluster mode requires maybe additional setup of:
7477
- Virtual memory (vm.max_map_count)
7578

7679
Enable cluster mode? [y/N] n
77-
Basedir: /Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT
80+
Basedir: /Users/XXXXX/Test/opensearch-*
7881
OpenSearch install type: .tar.gz on
79-
OpenSearch config dir: /Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/config
80-
OpenSearch config file: /Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/config/opensearch.yml
81-
OpenSearch bin dir: /Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/bin
82-
OpenSearch plugins dir: /Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/plugins
83-
OpenSearch lib dir: /Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/lib
84-
Detected OpenSearch Version: x-content-1.3.0-SNAPSHOT
82+
OpenSearch config dir: /Users/XXXXX/Test/opensearch-*/config
83+
OpenSearch config file: /Users/XXXXX/Test/opensearch-*/config/opensearch.yml
84+
OpenSearch bin dir: /Users/XXXXX/Test/opensearch-*/bin
85+
OpenSearch plugins dir: /Users/XXXXX/Test/opensearch-*/plugins
86+
OpenSearch lib dir: /Users/XXXXX/Test/opensearch-*/lib
87+
Detected OpenSearch Version: x-content-*
8588
Detected OpenSearch Security Version: *
8689

8790
### Success
8891
### Execute this script now on all your nodes and then start all nodes
8992
### OpenSearch Security will be automatically initialized.
9093
### If you like to change the runtime configuration
91-
### change the files in ../securityconfig and execute:
92-
"/Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/plugins/opensearch-security/tools/securityadmin.sh" -cd "/Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/plugins/opensearch-security/securityconfig" -icl -key "/Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/config/kirk-key.pem" -cert "/Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/config/kirk.pem" -cacert "/Users/XXXXX/Test/opensearch-1.3.0-SNAPSHOT/config/root-ca.pem" -nhnv
94+
### change the files in ../config and execute:
95+
"/Users/XXXXX/Test/opensearch-*/plugins/opensearch-security/tools/securityadmin.sh" -cd "/Users/XXXXX/Test/opensearch-*/config/opensearch-security/" -icl -key "/Users/XXXXX/Test/opensearch-*/config/kirk-key.pem" -cert "/Users/XXXXX/Test/opensearch-*/config/kirk.pem" -cacert "/Users/XXXXX/Test/opensearch-*/config/root-ca.pem" -nhnv
9396
### or run ./securityadmin_demo.sh
9497
### To use the Security Plugin ConfigurationGUI
9598
### To access your secured cluster open https://<hostname>:<HTTP port> and log in with admin/admin.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ task bundle(dependsOn: jar, type: Zip) {
283283
from 'plugin-security.policy'
284284
from 'plugin-descriptor.properties'
285285
from('securityconfig') {
286-
into 'securityconfig/'
286+
into 'config/'
287287
}
288288
from('tools') {
289289
into 'tools/'

src/main/java/org/opensearch/security/configuration/ConfigurationRepository.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void run() {
124124

125125
try {
126126
String lookupDir = System.getProperty("security.default_init.dir");
127-
final String cd = lookupDir != null? (lookupDir+"/") : new Environment(settings, configPath).pluginsFile().toAbsolutePath().toString()+"/opensearch-security/securityconfig/";
127+
final String cd = lookupDir != null? (lookupDir+"/") : new Environment(settings, configPath).configFile().toAbsolutePath().toString()+"/opensearch-security/";
128128
File confFile = new File(cd+"config.yml");
129129
if(confFile.exists()) {
130130
final ThreadContext threadContext = threadPool.getThreadContext();

src/main/java/org/opensearch/security/tools/AuditConfigMigrater.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class AuditConfigMigrater {
4848

4949
public static void main(String[] args) {
5050
options.addOption(Option.builder("s").argName("source").hasArg().desc("Path to opensearch.yml file to migrate. If not specified, will try to lookup env " + OPENSEARCH_PATH_CONF_ENV + " followed by lookup in current directory.").build());
51-
options.addOption(Option.builder("oad").argName("output-audit-dir").hasArg().desc("Output directory to store the generated " + AUDIT_YML + " file. To be uploaded in the index, the file must be present in plugins/opensearch-security/securityconfig/ or use securityadmin tool.").build());
51+
options.addOption(Option.builder("oad").argName("output-audit-dir").hasArg().desc("Output directory to store the generated " + AUDIT_YML + " file. To be uploaded in the index, the file must be present in config/opensearch-security/ or use securityadmin tool.").build());
5252
options.addOption(Option.builder("oed").argName("output-opensearch-dir").hasArg().desc("Output directory to store the generated " + OPENSEARCH_AUDIT_FILTERED_YML + " file.").build());
5353

5454
try {

tools/install_demo_configuration.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ echo "### Success"
417417
echo "### Execute this script now on all your nodes and then start all nodes"
418418
#Generate securityadmin_demo.sh
419419
echo "#!/bin/bash" | $SUDO_CMD tee securityadmin_demo.sh > /dev/null
420-
echo $SUDO_CMD \""$OPENSEARCH_PLUGINS_DIR/opensearch-security/tools/securityadmin.sh"\" -cd \""$OPENSEARCH_PLUGINS_DIR/opensearch-security/securityconfig"\" -icl -key \""$OPENSEARCH_CONF_DIR/kirk-key.pem"\" -cert \""$OPENSEARCH_CONF_DIR/kirk.pem"\" -cacert \""$OPENSEARCH_CONF_DIR/root-ca.pem"\" -nhnv | $SUDO_CMD tee -a securityadmin_demo.sh > /dev/null
420+
echo $SUDO_CMD \""$OPENSEARCH_PLUGINS_DIR/opensearch-security/tools/securityadmin.sh"\" -cd \""$OPENSEARCH_CONF_DIR/opensearch-security"\" -icl -key \""$OPENSEARCH_CONF_DIR/kirk-key.pem"\" -cert \""$OPENSEARCH_CONF_DIR/kirk.pem"\" -cacert \""$OPENSEARCH_CONF_DIR/root-ca.pem"\" -nhnv | $SUDO_CMD tee -a securityadmin_demo.sh > /dev/null
421421
$SUDO_CMD chmod +x securityadmin_demo.sh
422422

423423
if [ "$initsecurity" == 0 ]; then
@@ -428,7 +428,7 @@ if [ "$initsecurity" == 0 ]; then
428428
else
429429
echo "### OpenSearch Security will be automatically initialized."
430430
echo "### If you like to change the runtime configuration "
431-
echo "### change the files in ../securityconfig and execute: "
431+
echo "### change the files in ../../../config/opensearch-security and execute: "
432432
$SUDO_CMD cat securityadmin_demo.sh | tail -1
433433
echo "### or run ./securityadmin_demo.sh"
434434
echo "### To use the Security Plugin ConfigurationGUI"

0 commit comments

Comments
 (0)