From b2d85b843ff59f8959b33ddb0ab9f250b4a53e37 Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Tue, 14 Feb 2023 09:00:10 -0500 Subject: [PATCH] reposync --- salt/common/tools/sbin/so-common | 14 +++++++++----- salt/common/tools/sbin/so-repo-sync | 16 ++++++++++++++++ setup/so-functions | 2 ++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 salt/common/tools/sbin/so-repo-sync diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index c4a3fdbaf..01e278a6a 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -366,12 +366,16 @@ run_check_net_err() { fi } +salt_minion_count() + local MINIONDIR="/opt/so/saltstack/local/pillar/minions" + MINIONCOUNT=$(ls -la $MINIONDIR/*.sls | grep sls | wc -l) + set_cron_service_name() { - if [[ "$OS" == "centos" ]]; then - cron_service_name="crond" - else - cron_service_name="cron" - fi + if [[ "$OS" == "centos" ]]; then + cron_service_name="crond" + else + cron_service_name="cron" + fi } set_os() { diff --git a/salt/common/tools/sbin/so-repo-sync b/salt/common/tools/sbin/so-repo-sync new file mode 100644 index 000000000..67adb46ff --- /dev/null +++ b/salt/common/tools/sbin/so-repo-sync @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one +# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at +# https://securityonion.net/license; you may not use this file except in compliance with the +# Elastic License 2.0. + +. /usr/sbin/so-common + +set_version +set_os +salt_minion_count + +curl --retry 5 --retry-delay 60 -A 'checkin/$VERSION/$OS/$(uname -r)/$MINIONCOUNT' https://sigs.securityonion.net/checkup --output /tmp/checkup" +reposync --norepopath -n -g -l -d -m -c /root/repodownload.conf -r securityonionsync --download-metadata -p /nsm/repo/" + \ No newline at end of file diff --git a/setup/so-functions b/setup/so-functions index 0dc4751bd..80ddfd68a 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -1973,6 +1973,8 @@ repo_sync_local() { info "We have what we need to sync" fi + # Make sure we can get to the sig repo + logCmd "curl --retry 5 --retry-delay 60 -A 'gridinstall/$SOVERSION/$OS/$(uname -r)' https://sigs.securityonion.net/checkup --output /tmp/checkup" logCmd "reposync --norepopath -n -g -l -d -m -c /root/repodownload.conf -r securityonionsync --download-metadata -p /nsm/repo/"