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

Opensearch security plugin windows install certs demo config and add batch install script #2704

8 changes: 5 additions & 3 deletions scripts/components/OpenSearch/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ cd $DIR

## Copy the tar installation script into the bundle
if [ "$DISTRIBUTION" = "tar" ]; then
cp ../../../scripts/legacy/tar/linux/opensearch-tar-install.sh "$OUTPUT/"
cp -v ../../../scripts/startup/tar/linux/opensearch-tar-install.sh "$OUTPUT/"

elif [ "$DISTRIBUTION" = "rpm" ]; then
cp -a ../../../scripts/pkg/service_templates/opensearch/* "$OUTPUT/../"
cp -a ../../../scripts/pkg/build_templates/opensearch/* "$OUTPUT/../"
cp -va ../../../scripts/pkg/service_templates/opensearch/* "$OUTPUT/../"
cp -va ../../../scripts/pkg/build_templates/opensearch/* "$OUTPUT/../"
elif [ "$DISTRIBUTION" = "zip" ] && [ "$PLATFORM" = "windows" ]; then
cp -v ../../../scripts/startup/zip/windows/opensearch-windows-install.bat "$OUTPUT/"
fi
83 changes: 83 additions & 0 deletions scripts/components/security/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

# Copyright OpenSearch Contributors
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.

set -ex

function usage() {
echo "Usage: $0 [args]"
echo ""
echo "Arguments:"
echo -e "-v VERSION\t[Required] OpenSearch version."
echo -e "-s SNAPSHOT\t[Optional] Build a snapshot, default is 'false'."
echo -e "-p PLATFORM\t[Optional] Platform, default is 'uname -s'."
echo -e "-a ARCHITECTURE\t[Optional] Build architecture, default is 'uname -m'."
echo -e "-f ARTIFACTS\t[Optional] Location of build artifacts."
echo -e "-o OUTPUT\t[Optional] Output path."
echo -e "-h help"
}

while getopts ":h:v:q:s:o:p:a:f:" arg; do
case $arg in
h)
usage
exit 1
;;
v)
VERSION=$OPTARG
;;
q)
QUALIFIER=$OPTARG
;;
s)
SNAPSHOT=$OPTARG
;;
o)
OUTPUT=$OPTARG
;;
p)
PLATFORM=$OPTARG
;;
a)
ARCHITECTURE=$OPTARG
;;
f)
ARTIFACTS=$ARTIFACTS
;;
:)
echo "Error: -${OPTARG} requires an argument"
usage
exit 1
;;
?)
echo "Invalid option: -${arg}"
exit 1
;;
esac
done

if [ -z "$VERSION" ]; then
echo "Error: missing version."
usage
exit 1
fi

[ -z "$SNAPSHOT" ] && SNAPSHOT="false"
[ -z "$PLATFORM" ] && PLATFORM=$(uname -s | awk '{print tolower($0)}')
[ -z "$ARCHITECTURE" ] && ARCHITECTURE=`uname -m`

SECURITY_PLUGIN="opensearch-security"
chmod -c 755 $OUTPUT/plugins/$SECURITY_PLUGIN/tools/*.sh

if [ "$PLATFORM" = "windows" ]; then
chmod -c 755 $OUTPUT/plugins/$SECURITY_PLUGIN/tools/*.bat

# Temporary solution to run shell script on Windows through MinGW
# Tracking issue: https://github.com/opensearch-project/security/issues/2148
$OUTPUT/plugins/$SECURITY_PLUGIN/tools/install_demo_configuration.sh -y -i -s
fi
22 changes: 22 additions & 0 deletions scripts/startup/zip/windows/opensearch-windows-install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
:: SPDX-License-Identifier: Apache-2.0
:: Copyright OpenSearch Contributors

@echo off

:: Set variables and cd into the location of the batch script
PUSHD "%~dp0"
SET "OPENSEARCH_HOME=%CD%"
SET "OPENSEARCH_PATH_CONF=%OPENSEARCH_HOME%\config"

:: Echo User Inputs
ECHO "OPENSEARCH_HOME: %OPENSEARCH_HOME%"
ECHO "OPENSEARCH_PATH_CONF: %OPENSEARCH_PATH_CONF%"

:: Start OpenSearch
ECHO Start OpenSearch
IF "%~1" == "" (
CALL "%OPENSEARCH_HOME%\bin\opensearch.bat"
) ELSE (
CALL "%OPENSEARCH_HOME%\bin\opensearch.bat" "%*"
)