From 3f007f102686f7036a274bc8b1480a059cb55526 Mon Sep 17 00:00:00 2001 From: William Wernert Date: Tue, 20 Apr 2021 15:18:06 -0400 Subject: [PATCH] Disable fastestmirror during setup + soup --- salt/common/tools/sbin/so-common | 4 ++++ salt/common/tools/sbin/soup | 3 ++- setup/so-functions | 22 +++++++++++----------- setup/so-setup | 2 ++ 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 97e61e6e2..a425bf7bd 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -122,6 +122,10 @@ check_elastic_license() { fi } +disable_fastestmirror() { + sed -i 's/enabled=1/enabled=0/' /etc/yum/pluginconf.d/fastestmirror.conf +} + elastic_license() { read -r -d '' message <<- EOM diff --git a/salt/common/tools/sbin/soup b/salt/common/tools/sbin/soup index 2a1ddab1c..f17c180b8 100755 --- a/salt/common/tools/sbin/soup +++ b/salt/common/tools/sbin/soup @@ -425,8 +425,9 @@ up_2.3.3X_to_2.3.50_repo() { if [[ "$OS" == "centos" ]]; then # Import GPG Keys gpg_rpm_import - if [ $is_airgap -eq 1 ]; then + echo "Disabling fastestmirror." + disable_fastestmirror echo "Deleting unneeded repo files." DELREPOS=('CentOS-Base' 'CentOS-CR' 'CentOS-Debuginfo' 'docker-ce' 'CentOS-fasttrack' 'CentOS-Media' 'CentOS-Sources' 'CentOS-Vault' 'CentOS-x86_64-kernel' 'epel' 'epel-testing' 'saltstack' 'wazuh') diff --git a/setup/so-functions b/setup/so-functions index fcdb66c15..c6925b778 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -2321,24 +2321,24 @@ secrets_pillar(){ securityonion_repo() { # Remove all the current repos if [[ "$OS" == "centos" ]]; then - if [[ "$INTERWEBS" == "AIRGAP" ]]; then - echo "This is airgap I don't need to add this repo" + if [[ "$INTERWEBS" == "AIRGAP" ]]; then + echo "This is airgap I don't need to add this repo" else - mkdir -p /root/oldrepos - mv -v /etc/yum.repos.d/* /root/oldrepos/ + mkdir -p /root/oldrepos + mv -v /etc/yum.repos.d/* /root/oldrepos/ ls -la /etc/yum.repos.d/ - rm -rf /etc/yum.repos.d + rm -rf /etc/yum.repos.d yum clean all yum repolist all mkdir -p /etc/yum.repos.d - if [[ ! $is_manager && "$MANAGERUPDATES" == "1" ]]; then - cp -f ../salt/repo/client/files/centos/securityonioncache.repo /etc/yum.repos.d/ - else - cp -f ../salt/repo/client/files/centos/securityonion.repo /etc/yum.repos.d/ - fi + if [[ ! $is_manager && "$MANAGERUPDATES" == "1" ]]; then + cp -f ../salt/repo/client/files/centos/securityonioncache.repo /etc/yum.repos.d/ + else + cp -f ../salt/repo/client/files/centos/securityonion.repo /etc/yum.repos.d/ + fi fi else - echo "This is Ubuntu" + echo "This is Ubuntu" fi } diff --git a/setup/so-setup b/setup/so-setup index e75bfd8c8..d7dd3b660 100755 --- a/setup/so-setup +++ b/setup/so-setup @@ -634,6 +634,8 @@ echo "1" > /root/accept_changes set_progress_str 2 'Updating packages' # Import the gpg keys gpg_rpm_import >> $setup_log 2>&1 + info "Disabling fastestmirror" + [[ $OS == 'centos' ]] && disable_fastestmirror if [[ ! $is_airgap ]]; then securityonion_repo >> $setup_log 2>&1 update_packages >> $setup_log 2>&1