Skip to content

Commit

Permalink
Merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
mcasas993 committed Nov 28, 2024
2 parents 812b82b + d08eaa2 commit 4230645
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions build-scripts/assemble.sh
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ function parse_args() {
# ====
function add_configuration_files() {
# Add our settings to the configuration files
cat "$PATH_CONF/security/roles.wazuh.yml" >> "$PATH_CONF/opensearch-security/roles.yml"
cat "$PATH_CONF/security/roles_mapping.wazuh.yml" >> "$PATH_CONF/opensearch-security/roles_mapping.yml"
cat "$PATH_CONF/security/roles.wazuh.yml" >>"$PATH_CONF/opensearch-security/roles.yml"
cat "$PATH_CONF/security/roles_mapping.wazuh.yml" >>"$PATH_CONF/opensearch-security/roles_mapping.yml"

cp "$PATH_CONF/opensearch.prod.yml" "$PATH_CONF/opensearch.yml"

Expand Down Expand Up @@ -188,9 +188,16 @@ function add_wazuh_tools() {
local download_url
download_url="https://packages-dev.wazuh.com/${version}"

curl -sL "${download_url}/config.yml" -o "$PATH_PLUGINS/opensearch-security/tools/config.yml"
curl -sL "${download_url}/wazuh-passwords-tool.sh" -o "$PATH_PLUGINS/opensearch-security/tools/wazuh-passwords-tool.sh"
curl -sL "${download_url}/wazuh-certs-tool.sh" -o "$PATH_PLUGINS/opensearch-security/tools/wazuh-certs-tool.sh"
curl -sL "${download_url}/config.yml" -o "$PATH_PLUGINS"/opensearch-security/tools/config.yml
curl -sL "${download_url}/wazuh-passwords-tool.sh" -o "$PATH_PLUGINS"/opensearch-security/tools/wazuh-passwords-tool.sh
curl -sL "${download_url}/wazuh-certs-tool.sh" -o "$PATH_PLUGINS"/opensearch-security/tools/wazuh-certs-tool.sh
}

# ====
# Add demo certificates installer
# ====
function add_demo_certs_installer() {
cp install-demo-certificates.sh "$PATH_PLUGINS"/opensearch-security/tools/
}

# ====
Expand Down Expand Up @@ -282,6 +289,7 @@ function assemble_tar() {
# Install plugins
install_plugins "${version}"
fix_log_rotation "${PATH_CONF}"
add_demo_certs_installer
# Swap configuration files
add_configuration_files
remove_unneeded_files
Expand Down Expand Up @@ -322,6 +330,7 @@ function assemble_rpm() {
install_plugins "${version}"
fix_log_rotation ${PATH_CONF}
enable_performance_analyzer_rca ${src_path}
add_demo_certs_installer
# Swap configuration files
add_configuration_files
remove_unneeded_files
Expand Down Expand Up @@ -366,8 +375,16 @@ function assemble_deb() {

# Extract min-package. Creates usr/, etc/ and var/ in the current directory
echo "Extract ${ARTIFACT_BUILD_NAME} archive"
# Extracts code
ar xf "${ARTIFACT_BUILD_NAME}" data.tar.gz
tar zvxf data.tar.gz
# Extracts debian control files (preinst, postrm, ...)
# We need to use some custom files, otherwise debuild fails
mv "./debian/control" "./debian/wazuh-control"
ar xf "${ARTIFACT_BUILD_NAME}" control.tar.gz
tar zvxf control.tar.gz -C "debian"
mv "./debian/wazuh-control" "./debian/control"
rm "./debian/conffiles"

local version
version=$(cat ./usr/share/wazuh-indexer/VERSION)
Expand All @@ -376,6 +393,7 @@ function assemble_deb() {
install_plugins "${version}"
fix_log_rotation ${PATH_CONF}
enable_performance_analyzer_rca ${src_path}
add_demo_certs_installer
# Swap configuration files
add_configuration_files
remove_unneeded_files
Expand Down Expand Up @@ -421,6 +439,8 @@ function main() {
TMP_DIR="${OUTPUT}/tmp/${TARGET}"
mkdir -p "$TMP_DIR"
cp "${OUTPUT}/dist/$ARTIFACT_BUILD_NAME" "${TMP_DIR}"
# Copy the demo certificates generator
cp distribution/packages/src/common/scripts/install-demo-certificates.sh "$TMP_DIR"

case $PACKAGE in
tar)
Expand Down

0 comments on commit 4230645

Please sign in to comment.