Merge branch '2.4/dev' into 2.4/taglogs

This commit is contained in:
Josh Brower
2023-05-15 12:13:44 -04:00
committed by GitHub
9 changed files with 87 additions and 84 deletions

View File

@@ -238,7 +238,7 @@ gpg_rpm_import() {
local RPMKEYSLOC="$UPDATE_DIR/salt/repo/client/files/rocky/keys" local RPMKEYSLOC="$UPDATE_DIR/salt/repo/client/files/rocky/keys"
fi fi
RPMKEYS=('RPM-GPG-KEY-EPEL-9' 'SALT-PROJECT-GPG-PUBKEY-2023.pub' 'docker.pub' 'securityonion.pub') RPMKEYS=('RPM-GPG-KEY-rockyofficial' 'RPM-GPG-KEY-EPEL-9' 'SALT-PROJECT-GPG-PUBKEY-2023.pub' 'docker.pub' 'securityonion.pub')
for RPMKEY in "${RPMKEYS[@]}"; do for RPMKEY in "${RPMKEYS[@]}"; do
rpm --import $RPMKEYSLOC/$RPMKEY rpm --import $RPMKEYSLOC/$RPMKEY

View File

@@ -10,6 +10,7 @@
run_installer: run_installer:
cmd.script: cmd.script:
- name: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux - name: salt://elasticfleet/files/so_agent-installers/so-elastic-agent_linux
- cwd: /opt/so
- args: -token={{ GRIDNODETOKEN }} - args: -token={{ GRIDNODETOKEN }}
{% endif %} {% endif %}

View File

@@ -33,6 +33,7 @@ printf "\n### Stripping out unused components"
find /nsm/elastic-agent-workspace/elastic-agent-*/data/elastic-agent-*/components -regex '.*fleet.*\|.*packet.*\|.*apm*.*\|.*audit.*\|.*heart.*\|.*cloud.*' -delete find /nsm/elastic-agent-workspace/elastic-agent-*/data/elastic-agent-*/components -regex '.*fleet.*\|.*packet.*\|.*apm*.*\|.*audit.*\|.*heart.*\|.*cloud.*' -delete
printf "\n### Tarring everything up again" printf "\n### Tarring everything up again"
for OS in "${OSARCH[@]}" for OS in "${OSARCH[@]}"
do do
printf "\nCreating tarball for $OS..." printf "\nCreating tarball for $OS..."
@@ -44,6 +45,7 @@ done
GOTARGETOS=( "linux" "windows" "darwin" "darwin/arm64" ) GOTARGETOS=( "linux" "windows" "darwin" "darwin/arm64" )
GOARCH="amd64" GOARCH="amd64"
printf "\n### Generating OS packages using the cleaned up tarballs"for GOOS in "${GOTARGETOS[@]}" printf "\n### Generating OS packages using the cleaned up tarballs"for GOOS in "${GOTARGETOS[@]}"
do do
if [[ $GOOS == 'darwin/arm64' ]]; then GOOS="darwin" && GOARCH="arm64"; fi if [[ $GOOS == 'darwin/arm64' ]]; then GOOS="darwin" && GOARCH="arm64"; fi
printf "\n\n### Generating $GOOS/$GOARCH Installer...\n" printf "\n\n### Generating $GOOS/$GOARCH Installer...\n"

View File

@@ -12,7 +12,7 @@ printf "\n### Create ES Token ###\n"
ESTOKEN=$(curl -K /opt/so/conf/elasticsearch/curl.config -L -X POST "localhost:5601/api/fleet/service_tokens" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' | jq -r .value) ESTOKEN=$(curl -K /opt/so/conf/elasticsearch/curl.config -L -X POST "localhost:5601/api/fleet/service_tokens" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' | jq -r .value)
### Create Outputs & Fleet URLs ### ### Create Outputs & Fleet URLs ###
printf "\nAdd Manager Elasticsearch Ouput...\n" printf "\nAdd Manager Elasticsearch Output...\n"
ESCACRT=$(openssl x509 -in /etc/pki/tls/certs/intca.crt) ESCACRT=$(openssl x509 -in /etc/pki/tls/certs/intca.crt)
JSON_STRING=$( jq -n \ JSON_STRING=$( jq -n \
--arg ESCACRT "$ESCACRT" \ --arg ESCACRT "$ESCACRT" \

File diff suppressed because one or more lines are too long

View File

@@ -1,29 +1,31 @@
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
Version: resf.keykeeper.v1
Comment: Keykeeper
mQINBGAofzYBEAC6yS1azw6f3wmaVd//3aSy6O2c9+jeetulRQvg2LvhRRS1eNqp xsFNBGJ5RksBEADF/Lzssm7uryV6+VHAgL36klyCVcHwvx9Bk853LBOuHVEZWsme
/x9tbBhfohu/t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af6jUjfiEp5lLjqquzAyDPLlkzMr5RVa9n3/rI
V7SYxeXp3hNTuoUgiFkjh5/0yKWCwx7aQqlHar9GjpxmBDAO0kzOlgtTw//EqTwR R6OQp5loPVzCRZMgDLALBU2TcFXLVP+6hAW8qM77c+q/rOysP+Yd+N7GAd0fvEvA
KnYZLig9FW0PhwvZJUigr0cvs/XXTTb77z/i/dfHkrjVTTYenNyXogPtTtSyxqca mfeA4Y6dP0mMRu96EEAJ1qSKFWUul6K6nuqy+JTxktpw8F/IBAz44na17Tf02MJH
61fbPf0B/S3N43PW8URXBRS0sykpX4SxKu+PwKCqf+OJ7hMEVAapqzTt1q9T7zyB GCUWyM0n5vuO5kK+Ykkkwd+v43ZlqDnwG7akDkLwgj6O0QNx2TGkdgt3+C6aHN5S
QwvCVx8s7WWvXbs2d6ZUrArklgjHoHQcdxJKdhuRmD34AuXWCLW+gH8rJWZpuNl3 MiF0pi0qYbiN9LO0e05Ai2r3zTFC/pCaBWlG1ph2jx1pDy4yUVPfswWFNfe5I+4i
+WsPZX4PvjKDgMw6YMcV7zhWX6c0SevKtzt7WP3XoKDuPhK1PMGJQqQ7spegGB+5 CMHPRFsZNYxQnIA2Prtgt2YMwz3VIGI6DT/Z56Joqw4eOfaJTTQSXCANts/gD7qW
DZvsJS48Ip0S45Qfmj82ibXaCBJHTNZE8Zs+rdTjQ9DS5qvzRA1sRA1dBb/7OLYE D3SZXPc7wQD63TpDEjJdqhmepaTECbxN7x/p+GwIZYWJN+AYhvrfGXfjud3eDu8/
JmeWf4VZyebm+gc50szsg6Ut2yT8hw== i+YIbPKH1TAOMwiyxC106mIL705p+ORf5zATZMyB8Y0OvRIz5aKkBDFZM2QN6A==
=AiP8 =PzIf
-----END PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY BLOCK-----

View File

@@ -61,7 +61,7 @@ add_mngr_ip_to_hosts() {
add_socore_user_manager() { add_socore_user_manager() {
info "Adding socore user" info "Adding socore user"
logCmd "so_add_user 'socore' '939' '939' '/opt/so'" logCmd "so_add_user socore 939 939 /opt/so"
} }
add_web_user() { add_web_user() {
@@ -967,15 +967,15 @@ detect_os() {
} }
download_elastic_agent_artifacts() { download_elastic_agent_artifacts() {
#TODO - ISO
logCmd "mkdir -p /nsm/elastic-fleet/artifacts/beats/elastic-agent/" if [[ $is_iso ]]; then
logCmd "tar -xf /nsm/elastic-fleet/artifacts/beats/elastic-agent_SO-$SOVERSION.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
logCmd "curl --retry 5 --retry-delay 60 https://repo.securityonion.net/file/so-repo/prod/2.4/elasticagent/elastic-agent_SO-$SOVERSION.tar.gz --output /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz" else
logCmd "mkdir -p /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
logCmd "tar -xf /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/" logCmd "curl --retry 5 --retry-delay 60 https://repo.securityonion.net/file/so-repo/prod/2.4/elasticagent/elastic-agent_SO-$SOVERSION.tar.gz --output /nsm/elastic-fleet/artifacts/elastic-agent_SO-$SOVERSION.tar.gz"
logCmd "tar -xf /nsm/elastic-fleet/artifacts/beats/elastic-agent_SO-$SOVERSION.tar.gz -C /nsm/elastic-fleet/artifacts/beats/elastic-agent/"
} fi
}
installer_progress_loop() { installer_progress_loop() {
local i=0 local i=0
@@ -1946,9 +1946,11 @@ securityonion_repo() {
logCmd "dnf repolist all" logCmd "dnf repolist all"
fi fi
if [[ $waitforstate ]]; then if [[ $waitforstate ]]; then
# Build the repo locally so we can use it if [[ ! $is_airgap ]]; then
echo "Syncing Repo" # Build the repo locally so we can use it
repo_sync_local echo "Syncing Repo"
repo_sync_local
fi
fi fi
fi fi
} }
@@ -2194,12 +2196,12 @@ setup_salt_master_dirs() {
logCmd "rsync -avh --exclude 'TRANS.TBL' /home/$INSTALLUSERNAME/SecurityOnion/pillar/* $default_salt_dir/pillar/" logCmd "rsync -avh --exclude 'TRANS.TBL' /home/$INSTALLUSERNAME/SecurityOnion/pillar/* $default_salt_dir/pillar/"
logCmd "rsync -avh --exclude 'TRANS.TBL' /home/$INSTALLUSERNAME/SecurityOnion/salt/* $default_salt_dir/salt/" logCmd "rsync -avh --exclude 'TRANS.TBL' /home/$INSTALLUSERNAME/SecurityOnion/salt/* $default_salt_dir/salt/"
logCmd "mkdir -p $local_salt_dir/salt/zeek/policy/intel" logCmd "mkdir -p $local_salt_dir/salt/zeek/policy/intel"
logCmd "cp -Rv /home/$INSTALLUSERNAME/SecurityOnion/files/intel.dat $local_salt_dir/salt/zeek/policy/intel/" logCmd "touch $local_salt_dir/salt/zeek/policy/intel/intel.dat"
else else
logCmd "cp -Rv ../pillar/* $default_salt_dir/pillar/" logCmd "cp -Rv ../pillar/* $default_salt_dir/pillar/"
logCmd "cp -Rv ../salt/* $default_salt_dir/salt/" logCmd "cp -Rv ../salt/* $default_salt_dir/salt/"
logCmd "mkdir -p $local_salt_dir/salt/zeek/policy/intel" logCmd "mkdir -p $local_salt_dir/salt/zeek/policy/intel"
logCmd "cp -Rv files/intel.dat $local_salt_dir/salt/zeek/policy/intel/" logCmd "touch $local_salt_dir/salt/zeek/policy/intel/intel.dat"
fi fi
info "Chown the salt dirs on the manager for socore" info "Chown the salt dirs on the manager for socore"
@@ -2329,8 +2331,8 @@ so_add_user() {
if [ "$5" ]; then local pass=$5; fi if [ "$5" ]; then local pass=$5; fi
info "Add $username user" info "Add $username user"
logCmd "groupadd --gid '$gid' '$username'" logCmd "groupadd --gid $gid $username"
logCmd "useradd -m --uid '$uid' --gid '$gid' --home-dir '$home_dir' '$username'" logCmd "useradd -m --uid $uid --gid $gid --home-dir $home_dir $username"
# If a password has been passed in, set the password # If a password has been passed in, set the password
if [ "$pass" ]; then if [ "$pass" ]; then

View File

@@ -335,45 +335,53 @@ process_installtype
# If this is not an automated install prompt # If this is not an automated install prompt
if ! [[ -f $install_opt_file ]]; then if ! [[ -f $install_opt_file ]]; then
# If you are a manager ask ALL the manager things here. I know there is code re-use but this makes it easier to add new roles
# If you are a manager ask ALL the manager things here. I know there is code re-use but this makes it easier to add new roles.
if [[ $is_eval ]]; then if [[ $is_eval ]]; then
# waitforstate means we will run the full salt state at the end. This is for only nodes running the salt-master service
waitforstate=true waitforstate=true
#ubuntu_check # Does this role have monitoring interfaces?
monints=true monints=true
# Prompt the user to accept the elastic license
check_elastic_license check_elastic_license
# If it is an install from ISO is this airgap?
[[ $is_iso ]] && whiptail_airgap
# Make sure minimum requirements are met
check_requirements "manager" check_requirements "manager"
# Do networking things
networking_needful networking_needful
collect_net_method # Do we need a proxy?
[[ ! $is_airgap ]] && collect_net_method
# Do we need to change the dockernet subnet?
collect_dockernet collect_dockernet
if [[ $is_iso ]]; then # Are we in the clouds?
whiptail_airgap [[ ! $is_airgap ]] && detect_cloud
fi # Sets some minion info
detect_cloud
set_minion_info set_minion_info
set_default_log_size >> $setup_log 2>&1 set_default_log_size >> $setup_log 2>&1
info "Verifying all network devices are managed by Network Manager that should be" info "Verifying all network devices are managed by Network Manager that should be"
check_network_manager_conf check_network_manager_conf
set_network_dev_status_list set_network_dev_status_list
# What NIC for watching network traffic?
whiptail_sensor_nics whiptail_sensor_nics
# How many cores do we have?
calculate_useable_cores calculate_useable_cores
# What is the web user?
collect_webuser_inputs collect_webuser_inputs
# How are we accessing the UI?
get_redirect get_redirect
# Does the user want to allow access to the UI?
collect_so_allow collect_so_allow
whiptail_end_settings whiptail_end_settings
elif [[ $is_standalone ]]; then elif [[ $is_standalone ]]; then
waitforstate=true waitforstate=true
#ubuntu_check
monints=true monints=true
check_elastic_license check_elastic_license
[[ $is_iso ]] && whiptail_airgap
check_requirements "manager" check_requirements "manager"
networking_needful networking_needful
collect_net_method [[ ! $is_airgap ]] && collect_net_method
collect_dockernet collect_dockernet
if [[ $is_iso ]]; then [[ ! $is_airgap ]] && detect_cloud
whiptail_airgap
fi
detect_cloud
set_minion_info set_minion_info
set_default_log_size >> $setup_log 2>&1 set_default_log_size >> $setup_log 2>&1
info "Verifying all network devices are managed by Network Manager that should be" info "Verifying all network devices are managed by Network Manager that should be"
@@ -389,14 +397,12 @@ if ! [[ -f $install_opt_file ]]; then
check_elastic_license check_elastic_license
waitforstate=true waitforstate=true
#ubuntu_check #ubuntu_check
[[ $is_iso ]] && whiptail_airgap
check_requirements "manager" check_requirements "manager"
networking_needful networking_needful
collect_net_method [[ ! $is_airgap ]] && collect_net_method
collect_dockernet collect_dockernet
if [[ $is_iso ]]; then [[ ! $is_airgap ]] && detect_cloud
whiptail_airgap
fi
detect_cloud
set_minion_info set_minion_info
set_default_log_size >> $setup_log 2>&1 set_default_log_size >> $setup_log 2>&1
info "Verifying all network devices are managed by Network Manager that should be" info "Verifying all network devices are managed by Network Manager that should be"
@@ -410,15 +416,12 @@ if ! [[ -f $install_opt_file ]]; then
elif [[ $is_managersearch ]]; then elif [[ $is_managersearch ]]; then
check_elastic_license check_elastic_license
waitforstate=true waitforstate=true
#ubuntu_check [[ $is_iso ]] && whiptail_airgap
check_requirements "manager" check_requirements "manager"
networking_needful networking_needful
collect_net_method [[ ! $is_airgap ]] && collect_net_method
collect_dockernet collect_dockernet
if [[ $is_iso ]]; then [[ ! $is_airgap ]] && detect_cloud
whiptail_airgap
fi
detect_cloud
set_minion_info set_minion_info
set_default_log_size >> $setup_log 2>&1 set_default_log_size >> $setup_log 2>&1
info "Verifying all network devices are managed by Network Manager that should be" info "Verifying all network devices are managed by Network Manager that should be"
@@ -430,7 +433,6 @@ if ! [[ -f $install_opt_file ]]; then
collect_so_allow collect_so_allow
whiptail_end_settings whiptail_end_settings
elif [[ $is_sensor ]]; then elif [[ $is_sensor ]]; then
#ubuntu_check
installer_prereq_packages installer_prereq_packages
monints=true monints=true
check_requirements "sensor" check_requirements "sensor"
@@ -459,7 +461,6 @@ if ! [[ -f $install_opt_file ]]; then
whiptail_end_settings whiptail_end_settings
elif [[ $is_searchnode ]]; then elif [[ $is_searchnode ]]; then
#ubuntu_check
installer_prereq_packages installer_prereq_packages
check_requirements "elasticsearch" check_requirements "elasticsearch"
networking_needful networking_needful
@@ -473,7 +474,6 @@ if ! [[ -f $install_opt_file ]]; then
whiptail_end_settings whiptail_end_settings
elif [[ $is_heavynode ]]; then elif [[ $is_heavynode ]]; then
#ubuntu_check
installer_prereq_packages installer_prereq_packages
monints=true monints=true
check_requirements "heavynode" check_requirements "heavynode"
@@ -486,29 +486,26 @@ if ! [[ -f $install_opt_file ]]; then
whiptail_end_settings whiptail_end_settings
elif [[ $is_idh ]]; then elif [[ $is_idh ]]; then
#ubuntu_check
installer_prereq_packages installer_prereq_packages
check_requirements "idh" check_requirements "idh"
networking_needful networking_needful
collect_mngr_hostname collect_mngr_hostname
add_mngr_ip_to_hosts add_mngr_ip_to_hosts
check_manager_connection check_manager_connection
#collect_idh_services (this may be added back sometime in the future)
collect_idh_preferences collect_idh_preferences
set_minion_info set_minion_info
whiptail_end_settings whiptail_end_settings
elif [[ $is_import ]]; then elif [[ $is_import ]]; then
#ubuntu_check
waitforstate=true waitforstate=true
monints=true monints=true
[[ $is_iso ]] && whiptail_airgap
check_elastic_license check_elastic_license
check_requirements "import" check_requirements "import"
networking_needful networking_needful
if [[ $is_iso ]]; then [[ ! $is_airgap ]] && detect_cloud
whiptail_airgap collect_dockernet
fi [[ ! $is_airgap ]] && collect_net_method
detect_cloud
set_minion_info set_minion_info
set_default_log_size >> $setup_log 2>&1 set_default_log_size >> $setup_log 2>&1
info "Verifying all network devices are managed by Network Manager that should be" info "Verifying all network devices are managed by Network Manager that should be"
@@ -521,7 +518,6 @@ if ! [[ -f $install_opt_file ]]; then
whiptail_end_settings whiptail_end_settings
elif [[ $is_receiver ]]; then elif [[ $is_receiver ]]; then
#ubuntu_check
installer_prereq_packages installer_prereq_packages
check_requirements "receiver" check_requirements "receiver"
networking_needful networking_needful