From 0521ef04f36b7a8eb3bf616afad3e783eb734b2b Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Thu, 27 Oct 2022 20:15:53 -0400 Subject: [PATCH] [Backport 2.x] Add install_demo_configuration Batch script for Windows (#2203) * Add install_demo_configuration Batch script for Windows (#2161) Signed-off-by: Craig Perkins Signed-off-by: Stephen Crawford Co-authored-by: Stephen Crawford Co-authored-by: Stephen Crawford <65832608+scrawfor99@users.noreply.github.com> (cherry picked from commit 45c766f5b98bb88b642d0c7fbccb32653213c300) * Change to 2.4.0 for the min url Signed-off-by: Peter Zhu Signed-off-by: Peter Zhu Co-authored-by: Craig Perkins Co-authored-by: Peter Zhu --- .github/workflows/plugin_install.yml | 173 ++++++++----- tools/install_demo_configuration.bat | 360 +++++++++++++++++++++++++++ 2 files changed, 475 insertions(+), 58 deletions(-) create mode 100755 tools/install_demo_configuration.bat diff --git a/.github/workflows/plugin_install.yml b/.github/workflows/plugin_install.yml index c0c6df60a4..3cf1462618 100644 --- a/.github/workflows/plugin_install.yml +++ b/.github/workflows/plugin_install.yml @@ -3,63 +3,120 @@ name: Plugin Install on: [push, pull_request, workflow_dispatch] jobs: - plugin_install: - name: Plugin Install + + linux-install: + runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v2 - - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: 11 - - - name: Build - run: ./gradlew clean assemble -Dbuild.snapshot=false - - - name: Download OpenSearch Core - run: | - opensearch_version=`./gradlew properties -q | grep "opensearch_version:" | awk '{print $2}' | sed 's/-SNAPSHOT//g'` - wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/$opensearch_version/latest/linux/x64/tar/builds/opensearch/dist/opensearch-min-$opensearch_version-linux-x64.tar.gz - tar -xzf opensearch-*.tar.gz - rm -f opensearch-*.tar.gz - - - name: Move and rename security plugin for installation - run: mv build/distributions/opensearch-security-*.zip opensearch-security.zip - - - name: Run OpenSearch with plugin - run: | - cat > os-ep.sh < os-ep.sh <nul findstr /c:"plugins.security" "%OPENSEARCH_CONF_FILE%" && ( + echo %OPENSEARCH_CONF_FILE% seems to be already configured for Security. Quit. + exit /b %skip_updates% +) + +set LF=^ + + +:: two empty line required after LF +set ADMIN_CERT=-----BEGIN CERTIFICATE-----!LF!^ +MIIEdzCCA1+gAwIBAgIGAWLrc1O4MA0GCSqGSIb3DQEBCwUAMIGPMRMwEQYKCZIm!LF!^ +iZPyLGQBGRYDY29tMRcwFQYKCZImiZPyLGQBGRYHZXhhbXBsZTEZMBcGA1UECgwQ!LF!^ +RXhhbXBsZSBDb20gSW5jLjEhMB8GA1UECwwYRXhhbXBsZSBDb20gSW5jLiBSb290!LF!^ +IENBMSEwHwYDVQQDDBhFeGFtcGxlIENvbSBJbmMuIFJvb3QgQ0EwHhcNMTgwNDIy!LF!^ +MDM0MzQ3WhcNMjgwNDE5MDM0MzQ3WjBNMQswCQYDVQQGEwJkZTENMAsGA1UEBwwE!LF!^ +dGVzdDEPMA0GA1UECgwGY2xpZW50MQ8wDQYDVQQLDAZjbGllbnQxDTALBgNVBAMM!LF!^ +BGtpcmswggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDCwgBOoO88uMM8!LF!^ +dREJsk58Yt4Jn0zwQ2wUThbvy3ICDiEWhiAhUbg6dTggpS5vWWJto9bvaaqgMVoh!LF!^ +ElfYHdTDncX3UQNBEP8tqzHON6BFEFSGgJRGLd6f5dri6rK32nCotYS61CFXBFxf!LF!^ +WumXjSukjyrcTsdkR3C5QDo2oN7F883MOQqRENPzAtZi9s3jNX48u+/e3yvJzXsB!LF!^ +GS9Qmsye6C71enbIujM4CVwDT/7a5jHuaUp6OuNCFbdRPnu/wLYwOS2/yOtzAqk7!LF!^ +/PFnPCe7YOa10ShnV/jx2sAHhp7ZQBJgFkkgnIERz9Ws74Au+EbptWnsWuB+LqRL!LF!^ +x5G02IzpAgMBAAGjggEYMIIBFDCBv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fN7X6LmEpdAczAdBgNVHQ4EFgQUkjUM4A8e!LF!^ +K0X2TTnze1+i5hKXQHMwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4IB!LF!^ +AQBoQHvwsR34hGO2m8qVR9nQ5Klo5HYPyd6ySKNcT36OZ4AQfaCGsk+SecTi35QF!LF!^ +RHL3g2qffED4tKR0RBNGQSgiLavmHGCh3YpDupKq2xhhEeS9oBmQzxanFwWFod4T!LF!^ +nnsG2cCejyR9WXoRzHisw0KJWeuNlwjUdJY0xnn16srm1zL/M/f0PvCyh9HU1mF1!LF!^ +ivnOSqbDD2Z7JSGyckgKad1Omsg/rr5XYtCeyJeXUPcmpeX6erWJJNTUh6yWC/hY!LF!^ +G/dFC4xrJhfXwz6Z0ytUygJO32bJG4Np2iGAwvvgI9EfxzEv/KP+FGrJOvQJAq4/!LF!^ +BU36ZAa80W/8TBnqZTkNnqZV!LF!^ +-----END CERTIFICATE-----!LF! + + +echo !ADMIN_CERT! > "%OPENSEARCH_CONF_DIR%kirk.pem" +echo !NODE_CERT! > "%OPENSEARCH_CONF_DIR%esnode.pem" +echo !ROOT_CA! > "%OPENSEARCH_CONF_DIR%root-ca.pem" +echo !NODE_KEY! > "%OPENSEARCH_CONF_DIR%esnode-key.pem" +echo !ADMIN_CERT_KEY! > "%OPENSEARCH_CONF_DIR%kirk-key.pem" + +echo. >> "%OPENSEARCH_CONF_FILE%" +echo ######## Start OpenSearch Security Demo Configuration ######## >> "%OPENSEARCH_CONF_FILE%" +echo # WARNING: revise all the lines below before you go into production >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.transport.pemcert_filepath: esnode.pem >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.transport.pemkey_filepath: esnode-key.pem >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.transport.pemtrustedcas_filepath: root-ca.pem >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.transport.enforce_hostname_verification: false >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.http.enabled: true >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.http.pemcert_filepath: esnode.pem >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.http.pemkey_filepath: esnode-key.pem >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.ssl.http.pemtrustedcas_filepath: root-ca.pem >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.allow_unsafe_democertificates: true >> "%OPENSEARCH_CONF_FILE%" +if %initsecurity% == 1 ( + echo plugins.security.allow_default_init_securityindex: true >> "%OPENSEARCH_CONF_FILE%" +) +echo plugins.security.authcz.admin_dn: >> "%OPENSEARCH_CONF_FILE%" +echo - CN=kirk,OU=client,O=client,L=test, C=de >> "%OPENSEARCH_CONF_FILE%" +echo. >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.audit.type: internal_opensearch >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.enable_snapshot_restore_privilege: true >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.check_snapshot_restore_write_privileges: true >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.restapi.roles_enabled: ["all_access", "security_rest_api_access"] >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.system_indices.enabled: true >> "%OPENSEARCH_CONF_FILE%" +echo plugins.security.system_indices.indices: [".plugins-ml-model", ".plugins-ml-task", ".opendistro-alerting-config", ".opendistro-alerting-alert*", ".opendistro-anomaly-results*", ".opendistro-anomaly-detector*", ".opendistro-anomaly-checkpoints", ".opendistro-anomaly-detection-state", ".opendistro-reports-*", ".opensearch-notifications-*", ".opensearch-notebooks", ".opensearch-observability", ".opendistro-asynchronous-search-response*", ".replication-metadata-store"] >> "%OPENSEARCH_CONF_FILE%" + +:: network.host +>nul findstr /b /c:"network.host" "%OPENSEARCH_CONF_FILE%" && ( + echo network.host already present +) || ( + if %cluster_mode% == 1 ( + echo network.host: 0.0.0.0 >> "%OPENSEARCH_CONF_FILE%" + echo node.name: smoketestnode >> "%OPENSEARCH_CONF_FILE%" + echo cluster.initial_cluster_manager_nodes: smoketestnode >> "%OPENSEARCH_CONF_FILE%" + ) +) + +>nul findstr /b /c:"node.max_local_storage_nodes" "%OPENSEARCH_CONF_FILE%" && ( + echo node.max_local_storage_nodes already present +) || ( + echo node.max_local_storage_nodes: 3 >> "%OPENSEARCH_CONF_FILE%" +) + +echo ######## End OpenSearch Security Demo Configuration ######## >> "%OPENSEARCH_CONF_FILE%" + +echo ### Success +echo ### Execute this script now on all your nodes and then start all nodes +:: Generate securityadmin_demo.bat +echo. > securityadmin_demo.bat +echo %OPENSEARCH_PLUGINS_DIR%opensearch-security\tools\securityadmin.bat -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 >> securityadmin_demo.bat + +if %initsecurity% == 0 ( + echo ### After the whole cluster is up execute: + type securityadmin_demo.bat + echo ### or run ./securityadmin_demo.bat + echo ### After that you can also use the Security Plugin ConfigurationGUI +) else ( + echo ### OpenSearch Security will be automatically initialized. + echo ### If you like to change the runtime configuration + echo ### change the files in ../../../config/opensearch-security and execute: + type securityadmin_demo.bat + echo ### or run ./securityadmin_demo.bat + echo ### To use the Security Plugin ConfigurationGUI +) + +echo ### To access your secured cluster open https://: and log in with admin/admin. +echo ### [Ignore the SSL certificate warning because we installed self-signed demo certificates]