simp-beaker-helpers 1.23.2 → 1.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/pr_glci.yml +2 -2
- data/.github/workflows/pr_glci_cleanup.yml +1 -1
- data/.github/workflows/tag_deploy_rubygem.yml +1 -1
- data/.gitlab-ci.yml +6 -10
- data/CHANGELOG.md +29 -0
- data/Gemfile +1 -1
- data/files/pki/make.sh +1 -1
- data/lib/simp/beaker_helpers/inspec.rb +3 -1
- data/lib/simp/beaker_helpers/ssg.rb +36 -15
- data/lib/simp/beaker_helpers/version.rb +1 -1
- data/lib/simp/beaker_helpers.rb +46 -36
- data/spec/acceptance/nodesets/default.yml +3 -2
- data/spec/acceptance/nodesets/oel.yml +42 -0
- data/spec/acceptance/nodesets/ubuntu.yml +1 -1
- data/spec/acceptance/suites/ssg/00_default_spec.rb +10 -3
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bf9271df59bd88be59e1555cd5536c0906f7d09dcb2d1096df801302b1ebbd0d
         | 
| 4 | 
            +
              data.tar.gz: 967fb58eb7e5561c35b32899beb972d4b0f70a423239d05e5e12aad20b207658
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9dfd8dcd9bb759cd995aad0f33f072064537dccd5d96cd9b19e5193b069a8c62b5df860802c8a99f0478bbb596fa882cbd8f482d1d581ff9c72218049c3051f2
         | 
| 7 | 
            +
              data.tar.gz: bd0af0b10d2b743c2f8995821d00c64c4d3bf9d387ebefd3c6af81e4bb738b88ded50671214baf7c74e174fa5e4eb8f884722c5d34c4a06f831e4d79fd098b10
         | 
| @@ -63,7 +63,7 @@ jobs: | |
| 63 63 | 
             
              # we restrict ourselves to sending data elsewhere.
         | 
| 64 64 | 
             
              glci-syntax:
         | 
| 65 65 | 
             
                name: '.gitlab-ci.yml Syntax'
         | 
| 66 | 
            -
                runs-on: ubuntu- | 
| 66 | 
            +
                runs-on: ubuntu-latest
         | 
| 67 67 | 
             
                outputs:
         | 
| 68 68 | 
             
                  valid: ${{ steps.validate-glci-file.outputs.valid }}
         | 
| 69 69 | 
             
                steps:
         | 
| @@ -174,7 +174,7 @@ jobs: | |
| 174 174 | 
             
            ###  examine_contexts:
         | 
| 175 175 | 
             
            ###    name: 'Examine Context contents'
         | 
| 176 176 | 
             
            ###    if: always()
         | 
| 177 | 
            -
            ###    runs-on: ubuntu- | 
| 177 | 
            +
            ###    runs-on: ubuntu-latest
         | 
| 178 178 | 
             
            ###    needs: [ glci-syntax, contributor-permissions ]
         | 
| 179 179 | 
             
            ###    steps:
         | 
| 180 180 | 
             
            ###      - name: Dump contexts
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            #  | 
| 1 | 
            +
            # When SemVer tag is pushed: create GitHub release & publish gem to rubygems.org
         | 
| 2 2 | 
             
            #
         | 
| 3 3 | 
             
            # This workflow's jobs are only triggered in repos under the `simp` organization
         | 
| 4 4 | 
             
            # ------------------------------------------------------------------------------
         | 
    
        data/.gitlab-ci.yml
    CHANGED
    
    | @@ -273,10 +273,6 @@ variables: | |
| 273 273 | 
             
            # Unit Tests
         | 
| 274 274 | 
             
            #-----------------------------------------------------------------------
         | 
| 275 275 |  | 
| 276 | 
            -
            pup5.x-unit:
         | 
| 277 | 
            -
              <<: *pup_5_x
         | 
| 278 | 
            -
              <<: *unit_tests
         | 
| 279 | 
            -
             | 
| 280 276 | 
             
            pup6.x-unit:
         | 
| 281 277 | 
             
              <<: *pup_6_x
         | 
| 282 278 | 
             
              <<: *unit_tests
         | 
| @@ -292,12 +288,6 @@ pup7.x-unit: | |
| 292 288 | 
             
            #=======================================================================
         | 
| 293 289 | 
             
            # Packaging test
         | 
| 294 290 |  | 
| 295 | 
            -
            pup5.x-pkg:
         | 
| 296 | 
            -
              <<: *pup_5_x
         | 
| 297 | 
            -
              <<: *unit_tests
         | 
| 298 | 
            -
              script:
         | 
| 299 | 
            -
                'bundle exec rake pkg:gem'
         | 
| 300 | 
            -
             | 
| 301 291 | 
             
            pup6.x-pkg:
         | 
| 302 292 | 
             
              <<: *pup_6_x
         | 
| 303 293 | 
             
              <<: *unit_tests
         | 
| @@ -360,6 +350,12 @@ puppet7_collections: | |
| 360 350 | 
             
              script:
         | 
| 361 351 | 
             
                - bundle exec rake beaker:suites[puppet_collections]
         | 
| 362 352 |  | 
| 353 | 
            +
            oel_ssg:
         | 
| 354 | 
            +
              <<: *pup_6_x
         | 
| 355 | 
            +
              <<: *acceptance_base
         | 
| 356 | 
            +
              script:
         | 
| 357 | 
            +
                - bundle exec rake beaker:suites[ssg,oel]
         | 
| 358 | 
            +
             | 
| 363 359 | 
             
            windows:
         | 
| 364 360 | 
             
              <<: *pup_6_x
         | 
| 365 361 | 
             
              <<: *acceptance_base
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,32 @@ | |
| 1 | 
            +
            ### 1.24.1 / 2021-10-27
         | 
| 2 | 
            +
            * Fixed:
         | 
| 3 | 
            +
              * Worked around a bug in 'puppet lookup' - PUP-11402
         | 
| 4 | 
            +
              * Updated calls to the operating system fact when connecting to RHSM
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            ### 1.24.0 / 2021-10-05
         | 
| 7 | 
            +
            * Fixed:
         | 
| 8 | 
            +
              * Pinned the version of inspec to 4.39.0 since 4.41 broke tag processing
         | 
| 9 | 
            +
              * Only call `activate_interfaces` once per test run instead of at each context
         | 
| 10 | 
            +
                which saves quite a bit of time during testing
         | 
| 11 | 
            +
              * SSG tag selection logic
         | 
| 12 | 
            +
              * Use `sed -ci` which works with docker volume mounts
         | 
| 13 | 
            +
            * Added:
         | 
| 14 | 
            +
              * Modified the `activate_interfaces` method to use the `networking` fact if
         | 
| 15 | 
            +
                available which shaves quite a bit of time off of each test run
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ### 1.23.4 / 2021-07-07
         | 
| 18 | 
            +
            * Fixed:
         | 
| 19 | 
            +
              * Ensure that the openscap-scanner package is installed during SSG runs
         | 
| 20 | 
            +
            * Added:
         | 
| 21 | 
            +
              * A function to fetch the available SSG profiles on a target system
         | 
| 22 | 
            +
            * Changed:
         | 
| 23 | 
            +
              * Added OEL nodeset
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            ### 1.23.3 / 2021-06-30
         | 
| 26 | 
            +
            * Fixed:
         | 
| 27 | 
            +
              * Removed the Streams kernel update for EL 8.3 since it now causes issues
         | 
| 28 | 
            +
              * Use `pfact_on` to select the interface facts to fix Puppet 7 issues
         | 
| 29 | 
            +
             | 
| 1 30 | 
             
            ### 1.23.2 / 2021-05-29
         | 
| 2 31 | 
             
            * Fixed:
         | 
| 3 32 | 
             
              * Fail an acceptance test when an explicitly-specified nodeset for an
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/files/pki/make.sh
    CHANGED
    
    | @@ -73,7 +73,7 @@ for hosts in $*; do | |
| 73 73 | 
             
                  done
         | 
| 74 74 | 
             
                done
         | 
| 75 75 |  | 
| 76 | 
            -
                sed - | 
| 76 | 
            +
                sed -ci "s/# subjectAltName = #ALTNAMES#/subjectAltName = ${altnames}/" "working/${hname}.cnf"
         | 
| 77 77 | 
             
              fi
         | 
| 78 78 |  | 
| 79 79 | 
             
              echo "-- running openssl req"
         | 
| @@ -34,7 +34,9 @@ module Simp::BeakerHelpers | |
| 34 34 | 
             
                #   The name of the profile against which to run
         | 
| 35 35 | 
             
                #
         | 
| 36 36 | 
             
                def initialize(sut, profile)
         | 
| 37 | 
            -
                   | 
| 37 | 
            +
                  # The 4.41 release is currently broken
         | 
| 38 | 
            +
                  # @inspec_version = ENV['BEAKER_inspec_version'] || 'latest'
         | 
| 39 | 
            +
                  @inspec_version = ENV['BEAKER_inspec_version'] || '4.39.0'
         | 
| 38 40 |  | 
| 39 41 | 
             
                  @sut = sut
         | 
| 40 42 |  | 
| @@ -19,10 +19,11 @@ module Simp::BeakerHelpers | |
| 19 19 | 
             
                  GIT_BRANCH = ENV['BEAKER_ssg_branch']
         | 
| 20 20 | 
             
                end
         | 
| 21 21 |  | 
| 22 | 
            -
                 | 
| 22 | 
            +
                EL7_PACKAGES = [
         | 
| 23 23 | 
             
                  'PyYAML',
         | 
| 24 24 | 
             
                  'cmake',
         | 
| 25 25 | 
             
                  'git',
         | 
| 26 | 
            +
                  'openscap-scanner',
         | 
| 26 27 | 
             
                  'openscap-python',
         | 
| 27 28 | 
             
                  'openscap-utils',
         | 
| 28 29 | 
             
                  'python-jinja2',
         | 
| @@ -35,16 +36,18 @@ module Simp::BeakerHelpers | |
| 35 36 | 
             
                  'make',
         | 
| 36 37 | 
             
                  'openscap-python3',
         | 
| 37 38 | 
             
                  'openscap-utils',
         | 
| 39 | 
            +
                  'openscap-scanner',
         | 
| 38 40 | 
             
                  'python3',
         | 
| 39 41 | 
             
                  'python3-jinja2',
         | 
| 40 42 | 
             
                  'python3-lxml',
         | 
| 41 | 
            -
                  'python3-pyyaml'
         | 
| 43 | 
            +
                  'python3-pyyaml',
         | 
| 44 | 
            +
                  'libarchive'
         | 
| 42 45 | 
             
                ]
         | 
| 43 46 |  | 
| 44 47 | 
             
                OS_INFO = {
         | 
| 45 48 | 
             
                  'RedHat' => {
         | 
| 46 49 | 
             
                    '6' => {
         | 
| 47 | 
            -
                      'required_packages' =>  | 
| 50 | 
            +
                      'required_packages' => EL7_PACKAGES,
         | 
| 48 51 | 
             
                      'ssg' => {
         | 
| 49 52 | 
             
                        'profile_target' => 'rhel6',
         | 
| 50 53 | 
             
                        'build_target'   => 'rhel6',
         | 
| @@ -52,7 +55,7 @@ module Simp::BeakerHelpers | |
| 52 55 | 
             
                      }
         | 
| 53 56 | 
             
                    },
         | 
| 54 57 | 
             
                    '7' => {
         | 
| 55 | 
            -
                      'required_packages' =>  | 
| 58 | 
            +
                      'required_packages' => EL7_PACKAGES,
         | 
| 56 59 | 
             
                      'ssg' => {
         | 
| 57 60 | 
             
                        'profile_target' => 'rhel7',
         | 
| 58 61 | 
             
                        'build_target'   => 'rhel7',
         | 
| @@ -70,7 +73,7 @@ module Simp::BeakerHelpers | |
| 70 73 | 
             
                  },
         | 
| 71 74 | 
             
                  'CentOS' => {
         | 
| 72 75 | 
             
                    '6' => {
         | 
| 73 | 
            -
                      'required_packages' =>  | 
| 76 | 
            +
                      'required_packages' => EL7_PACKAGES,
         | 
| 74 77 | 
             
                      'ssg' => {
         | 
| 75 78 | 
             
                        'profile_target' => 'rhel6',
         | 
| 76 79 | 
             
                        'build_target'   => 'centos6',
         | 
| @@ -78,7 +81,7 @@ module Simp::BeakerHelpers | |
| 78 81 | 
             
                      }
         | 
| 79 82 | 
             
                    },
         | 
| 80 83 | 
             
                    '7' => {
         | 
| 81 | 
            -
                      'required_packages' =>  | 
| 84 | 
            +
                      'required_packages' => EL7_PACKAGES,
         | 
| 82 85 | 
             
                      'ssg' => {
         | 
| 83 86 | 
             
                        'profile_target' => 'centos7',
         | 
| 84 87 | 
             
                        'build_target'   => 'centos7',
         | 
| @@ -94,14 +97,25 @@ module Simp::BeakerHelpers | |
| 94 97 | 
             
                      }
         | 
| 95 98 | 
             
                    }
         | 
| 96 99 | 
             
                  },
         | 
| 100 | 
            +
                  'Rocky' => {
         | 
| 101 | 
            +
                    '8' => {
         | 
| 102 | 
            +
                      'required_packages' => EL8_PACKAGES,
         | 
| 103 | 
            +
                      'ssg' => {
         | 
| 104 | 
            +
                        'profile_target' => 'centos8',
         | 
| 105 | 
            +
                        'build_target'   => 'centos8',
         | 
| 106 | 
            +
                        'datastream'     => 'ssg-centos8-ds.xml'
         | 
| 107 | 
            +
                      }
         | 
| 108 | 
            +
                    }
         | 
| 109 | 
            +
                  },
         | 
| 97 110 | 
             
                  'OracleLinux' => {
         | 
| 98 111 | 
             
                    '7' => {
         | 
| 99 | 
            -
                      'required_packages' =>  | 
| 112 | 
            +
                      'required_packages' => EL7_PACKAGES,
         | 
| 100 113 | 
             
                      'ssg' => {
         | 
| 101 114 | 
             
                        'profile_target' => 'ol7',
         | 
| 102 115 | 
             
                        'build_target'   => 'ol7',
         | 
| 103 116 | 
             
                        'datastream'     => 'ssg-ol7-ds.xml'
         | 
| 104 117 | 
             
                      },
         | 
| 118 | 
            +
                    },
         | 
| 105 119 | 
             
                    '8' => {
         | 
| 106 120 | 
             
                      'required_packages' => EL8_PACKAGES,
         | 
| 107 121 | 
             
                      'ssg' => {
         | 
| @@ -110,7 +124,6 @@ module Simp::BeakerHelpers | |
| 110 124 | 
             
                        'datastream'     => 'ssg-ol8-ds.xml'
         | 
| 111 125 | 
             
                      }
         | 
| 112 126 | 
             
                    }
         | 
| 113 | 
            -
                    }
         | 
| 114 127 | 
             
                  }
         | 
| 115 128 | 
             
                }
         | 
| 116 129 |  | 
| @@ -124,8 +137,8 @@ module Simp::BeakerHelpers | |
| 124 137 | 
             
                def initialize(sut)
         | 
| 125 138 | 
             
                  @sut = sut
         | 
| 126 139 |  | 
| 127 | 
            -
                  @os =  | 
| 128 | 
            -
                  @os_rel =  | 
| 140 | 
            +
                  @os = pfact_on(@sut, 'os.name')
         | 
| 141 | 
            +
                  @os_rel = pfact_on(@sut, 'os.release.major')
         | 
| 129 142 |  | 
| 130 143 | 
             
                  sut.mkdir_p('scap_working_dir')
         | 
| 131 144 |  | 
| @@ -136,7 +149,7 @@ module Simp::BeakerHelpers | |
| 136 149 | 
             
                  end
         | 
| 137 150 |  | 
| 138 151 | 
             
                  OS_INFO[@os][@os_rel]['required_packages'].each do |pkg|
         | 
| 139 | 
            -
                    @sut | 
| 152 | 
            +
                    install_latest_package_on(@sut, pkg)
         | 
| 140 153 | 
             
                  end
         | 
| 141 154 |  | 
| 142 155 | 
             
                  @output_dir = File.absolute_path('sec_results/ssg')
         | 
| @@ -147,7 +160,6 @@ module Simp::BeakerHelpers | |
| 147 160 |  | 
| 148 161 | 
             
                  @result_file = "#{@sut.hostname}-ssg-#{Time.now.to_i}"
         | 
| 149 162 |  | 
| 150 | 
            -
             | 
| 151 163 | 
             
                  get_ssg_datastream
         | 
| 152 164 | 
             
                end
         | 
| 153 165 |  | 
| @@ -155,6 +167,15 @@ module Simp::BeakerHelpers | |
| 155 167 | 
             
                  OS_INFO[@os][@os_rel]['ssg']['profile_target']
         | 
| 156 168 | 
             
                end
         | 
| 157 169 |  | 
| 170 | 
            +
                def get_profiles
         | 
| 171 | 
            +
                  cmd = "cd #{@scap_working_dir}; oscap info --profiles"
         | 
| 172 | 
            +
                  on(@sut, "#{cmd} #{OS_INFO[@os][@os_rel]['ssg']['datastream']}")
         | 
| 173 | 
            +
                    .stdout
         | 
| 174 | 
            +
                    .strip
         | 
| 175 | 
            +
                    .lines
         | 
| 176 | 
            +
                    .map{|x| x.split(':').first}
         | 
| 177 | 
            +
                end
         | 
| 178 | 
            +
             | 
| 158 179 | 
             
                def remediate(profile)
         | 
| 159 180 | 
             
                  evaluate(profile, true)
         | 
| 160 181 | 
             
                end
         | 
| @@ -166,7 +187,7 @@ module Simp::BeakerHelpers | |
| 166 187 | 
             
                    cmd += ' --remediate'
         | 
| 167 188 | 
             
                  end
         | 
| 168 189 |  | 
| 169 | 
            -
                  cmd += %( -- | 
| 190 | 
            +
                  cmd += %( --profile #{profile} --results #{@result_file}.xml --report #{@result_file}.html #{OS_INFO[@os][@os_rel]['ssg']['datastream']})
         | 
| 170 191 |  | 
| 171 192 | 
             
                  # We accept all exit codes here because there have occasionally been
         | 
| 172 193 | 
             
                  # failures in the SSG content and we're not testing that.
         | 
| @@ -386,7 +407,7 @@ module Simp::BeakerHelpers | |
| 386 407 | 
             
                    else
         | 
| 387 408 | 
             
                      tags = on(@sut, %(cd scap-content; git tag -l)).output
         | 
| 388 409 | 
             
                      target_tag = tags.lines.map(&:strip)
         | 
| 389 | 
            -
                        .select{|x| x. | 
| 410 | 
            +
                        .select{|x| x.match?(/^v(\d+\.)+\d+$/)}
         | 
| 390 411 | 
             
                        .sort.last
         | 
| 391 412 |  | 
| 392 413 | 
             
                      on(@sut, %(cd scap-content; git checkout #{target_tag}))
         | 
| @@ -398,7 +419,7 @@ module Simp::BeakerHelpers | |
| 398 419 | 
             
                    #
         | 
| 399 420 | 
             
                    # This isn't 100% correct but it's "good enough" for an automated CI
         | 
| 400 421 | 
             
                    # environment to tell us if something is critically out of alignment.
         | 
| 401 | 
            -
                    on(@sut, %(cd scap-content/build-scripts; sed - | 
| 422 | 
            +
                    on(@sut, %(cd scap-content/build-scripts; sed -ci 's/ssg.build_derivatives.profile_handling/#ssg.build_derivatives.profile_handling/g' enable_derivatives.py))
         | 
| 402 423 |  | 
| 403 424 | 
             
                    on(@sut, %(cd scap-content/build; cmake ../; make -j4 #{OS_INFO[@os][@os_rel]['ssg']['build_target']}-content && cp *ds.xml #{@scap_working_dir}))
         | 
| 404 425 | 
             
                  end
         | 
    
        data/lib/simp/beaker_helpers.rb
    CHANGED
    
    | @@ -248,7 +248,7 @@ module Simp::BeakerHelpers | |
| 248 248 | 
             
                  rescue StandardError
         | 
| 249 249 | 
             
                    # If *anything* fails, we need to fall back to `puppet facts`
         | 
| 250 250 |  | 
| 251 | 
            -
                    facts_json =  | 
| 251 | 
            +
                    facts_json = retry_on(sut, 'puppet facts find garbage_xxx', :silent => true, :max_retries => 4).stdout
         | 
| 252 252 | 
             
                    facts = JSON.parse(facts_json)['values']
         | 
| 253 253 | 
             
                  end
         | 
| 254 254 |  | 
| @@ -483,7 +483,7 @@ module Simp::BeakerHelpers | |
| 483 483 | 
             
                  #      that doesn't break vagrant access and is appropriate for
         | 
| 484 484 | 
             
                  #      typical module tests.)
         | 
| 485 485 | 
             
                  fips_ssh_ciphers = [ 'aes256-ctr','aes192-ctr','aes128-ctr']
         | 
| 486 | 
            -
                  on(sut, %(sed - | 
| 486 | 
            +
                  on(sut, %(sed -ci '/Ciphers /d' /etc/ssh/sshd_config))
         | 
| 487 487 | 
             
                  on(sut, %(echo 'Ciphers #{fips_ssh_ciphers.join(',')}' >> /etc/ssh/sshd_config))
         | 
| 488 488 |  | 
| 489 489 | 
             
                  fips_enable_modulepath = ''
         | 
| @@ -688,7 +688,7 @@ module Simp::BeakerHelpers | |
| 688 688 | 
             
                  if current_domain.empty?
         | 
| 689 689 | 
             
                    new_fqdn = hostname + '.beaker.test'
         | 
| 690 690 |  | 
| 691 | 
            -
                    on(sut, "sed - | 
| 691 | 
            +
                    on(sut, "sed -ci 's/#{hostname}.*/#{new_fqdn} #{hostname}/' /etc/hosts")
         | 
| 692 692 | 
             
                    on(sut, "echo '#{new_fqdn}' > /etc/hostname", :accept_all_exit_codes => true)
         | 
| 693 693 | 
             
                    on(sut, "hostname #{new_fqdn}", :accept_all_exit_codes => true)
         | 
| 694 694 |  | 
| @@ -771,15 +771,6 @@ module Simp::BeakerHelpers | |
| 771 771 | 
             
                        apply_manifest_on(sut, pp, :catch_failures => false)
         | 
| 772 772 | 
             
                      end
         | 
| 773 773 |  | 
| 774 | 
            -
                      unless sut[:hypervisor] == 'docker'
         | 
| 775 | 
            -
                        if (os_info['name'] == 'CentOS') && (os_info['release']['major'].to_i >= 8)
         | 
| 776 | 
            -
                          if os_info['release']['minor'].to_i == 3
         | 
| 777 | 
            -
                            update_package_from_centos_stream(sut, 'kernel')
         | 
| 778 | 
            -
                            sut.reboot
         | 
| 779 | 
            -
                          end
         | 
| 780 | 
            -
                        end
         | 
| 781 | 
            -
                      end
         | 
| 782 | 
            -
             | 
| 783 774 | 
             
                      # Clean up YUM prior to starting our test runs.
         | 
| 784 775 | 
             
                      on(sut, 'yum clean all')
         | 
| 785 776 | 
             
                    end
         | 
| @@ -819,8 +810,8 @@ module Simp::BeakerHelpers | |
| 819 810 | 
             
                    rhsm_opts.merge!(opts)
         | 
| 820 811 | 
             
                  end
         | 
| 821 812 |  | 
| 822 | 
            -
                  os = fact_on(sut, ' | 
| 823 | 
            -
                  os_release = fact_on(sut, ' | 
| 813 | 
            +
                  os = fact_on(sut, 'os.name').strip
         | 
| 814 | 
            +
                  os_release = fact_on(sut, 'os.release.major').strip
         | 
| 824 815 |  | 
| 825 816 | 
             
                  if os == 'RedHat'
         | 
| 826 817 | 
             
                    unless rhsm_opts[:username] && rhsm_opts[:password]
         | 
| @@ -962,21 +953,31 @@ module Simp::BeakerHelpers | |
| 962 953 | 
             
                  host_entry[fqdn] << host.name if (host[:hypervisor] == 'docker')
         | 
| 963 954 |  | 
| 964 955 | 
             
                  # Ensure that all interfaces are active prior to collecting data
         | 
| 965 | 
            -
                  activate_interfaces(host) | 
| 956 | 
            +
                  activate_interfaces(host)
         | 
| 966 957 |  | 
| 967 | 
            -
                   | 
| 968 | 
            -
                   | 
| 969 | 
            -
             | 
| 970 | 
            -
             | 
| 958 | 
            +
                  networking_fact = pfact_on(host, 'networking')
         | 
| 959 | 
            +
                  if networking_fact && networking_fact['interfaces']
         | 
| 960 | 
            +
                    networking_fact['interfaces'].each do |iface, data|
         | 
| 961 | 
            +
                      next unless data['ip']
         | 
| 962 | 
            +
                      next if data['ip'].start_with?('127.')
         | 
| 971 963 |  | 
| 972 | 
            -
             | 
| 964 | 
            +
                      host_entry[fqdn] << data['ip'].strip
         | 
| 965 | 
            +
                    end
         | 
| 966 | 
            +
                  else
         | 
| 967 | 
            +
                    # Gather the IP Addresses for the host to embed in the cert
         | 
| 968 | 
            +
                    interfaces = fact_on(host, 'interfaces').strip.split(',')
         | 
| 969 | 
            +
                    interfaces.each do |interface|
         | 
| 970 | 
            +
                      ipaddress = fact_on(host, "ipaddress_#{interface}")
         | 
| 973 971 |  | 
| 974 | 
            -
             | 
| 972 | 
            +
                      next if ipaddress.nil? || ipaddress.empty? || ipaddress.start_with?('127.')
         | 
| 975 973 |  | 
| 976 | 
            -
             | 
| 977 | 
            -
                      suts_network_info[fqdn] = host_entry[fqdn].sort.uniq
         | 
| 974 | 
            +
                      host_entry[fqdn] << ipaddress.strip
         | 
| 978 975 | 
             
                    end
         | 
| 979 976 | 
             
                  end
         | 
| 977 | 
            +
             | 
| 978 | 
            +
                  unless host_entry[fqdn].empty?
         | 
| 979 | 
            +
                    suts_network_info[fqdn] = host_entry[fqdn].sort.uniq
         | 
| 980 | 
            +
                  end
         | 
| 980 981 | 
             
                end
         | 
| 981 982 |  | 
| 982 983 | 
             
                # Get all of the repeated SUT IP addresses:
         | 
| @@ -1081,7 +1082,6 @@ module Simp::BeakerHelpers | |
| 1081 1082 | 
             
                on ca_sut, "chgrp -R puppet #{host_keydist_dir}"
         | 
| 1082 1083 | 
             
              end
         | 
| 1083 1084 |  | 
| 1084 | 
            -
             | 
| 1085 1085 | 
             
              # Activate all network interfaces on the target system
         | 
| 1086 1086 | 
             
              #
         | 
| 1087 1087 | 
             
              # This is generally needed if the upstream vendor does not activate all
         | 
| @@ -1089,6 +1089,8 @@ module Simp::BeakerHelpers | |
| 1089 1089 | 
             
              #
         | 
| 1090 1090 | 
             
              # Can be passed any number of hosts either singly or as an Array
         | 
| 1091 1091 | 
             
              def activate_interfaces(hosts)
         | 
| 1092 | 
            +
                return if ENV['BEAKER_no_fix_interfaces']
         | 
| 1093 | 
            +
             | 
| 1092 1094 | 
             
                parallel = (ENV['BEAKER_SIMP_parallel'] == 'yes')
         | 
| 1093 1095 | 
             
                block_on(hosts, :run_in_parallel => parallel) do |host|
         | 
| 1094 1096 | 
             
                  if host[:platform] =~ /windows/
         | 
| @@ -1096,14 +1098,22 @@ module Simp::BeakerHelpers | |
| 1096 1098 | 
             
                    next
         | 
| 1097 1099 | 
             
                  end
         | 
| 1098 1100 |  | 
| 1099 | 
            -
                   | 
| 1101 | 
            +
                  networking_fact = pfact_on(host, 'networking')
         | 
| 1102 | 
            +
                  if networking_fact && networking_fact['interfaces']
         | 
| 1103 | 
            +
                    networking_fact['interfaces'].each do |iface, data|
         | 
| 1104 | 
            +
                      next if ( ( data['ip'] && !data['ip'].empty? ) || ( data['ip6'] && !data['ip6'].empty? ) )
         | 
| 1105 | 
            +
                      on(host, "ifup #{iface}", :accept_all_exit_codes => true)
         | 
| 1106 | 
            +
                    end
         | 
| 1107 | 
            +
                  else
         | 
| 1108 | 
            +
                    interfaces_fact = pfact_on(host, 'interfaces')
         | 
| 1100 1109 |  | 
| 1101 | 
            -
             | 
| 1102 | 
            -
             | 
| 1110 | 
            +
                    interfaces = interfaces_fact.strip.split(',')
         | 
| 1111 | 
            +
                    interfaces.delete_if { |x| x =~ /^lo/ }
         | 
| 1103 1112 |  | 
| 1104 | 
            -
             | 
| 1105 | 
            -
             | 
| 1106 | 
            -
             | 
| 1113 | 
            +
                    interfaces.each do |iface|
         | 
| 1114 | 
            +
                      if pfact_on(host, "ipaddress_#{iface}")
         | 
| 1115 | 
            +
                        on(host, "ifup #{iface}", :accept_all_exit_codes => true)
         | 
| 1116 | 
            +
                      end
         | 
| 1107 1117 | 
             
                    end
         | 
| 1108 1118 | 
             
                  end
         | 
| 1109 1119 | 
             
                end
         | 
| @@ -1120,12 +1130,9 @@ module Simp::BeakerHelpers | |
| 1120 1130 | 
             
              RSpec.configure do |c|
         | 
| 1121 1131 | 
             
                c.before(:all) do
         | 
| 1122 1132 | 
             
                  @temp_hieradata_dirs = @temp_hieradata_dirs || []
         | 
| 1123 | 
            -
                end
         | 
| 1124 1133 |  | 
| 1125 | 
            -
             | 
| 1126 | 
            -
             | 
| 1127 | 
            -
                c.before(:context) do
         | 
| 1128 | 
            -
                  activate_interfaces(hosts) unless ENV['BEAKER_no_fix_interfaces']
         | 
| 1134 | 
            +
                  # We can't guarantee that the upstream vendor isn't disabling interfaces
         | 
| 1135 | 
            +
                  activate_interfaces(hosts)
         | 
| 1129 1136 | 
             
                end
         | 
| 1130 1137 |  | 
| 1131 1138 | 
             
                c.after(:all) do
         | 
| @@ -1237,8 +1244,11 @@ module Simp::BeakerHelpers | |
| 1237 1244 | 
             
              #
         | 
| 1238 1245 | 
             
              # @returns [String] Path to the Hieradata directory on the target system
         | 
| 1239 1246 | 
             
              def hiera_datadir(sut)
         | 
| 1247 | 
            +
                # A workaround for PUP-11042
         | 
| 1248 | 
            +
                sut_environment = sut.puppet_configprint['environment']
         | 
| 1249 | 
            +
             | 
| 1240 1250 | 
             
                # This output lets us know where Hiera is configured to look on the system
         | 
| 1241 | 
            -
                puppet_lookup_info = on(sut,  | 
| 1251 | 
            +
                puppet_lookup_info = on(sut, "puppet lookup --explain --environment #{sut_environment} test__simp__test", :silent => true).output.strip.lines
         | 
| 1242 1252 |  | 
| 1243 1253 | 
             
                if sut.puppet_configprint['manifest'].nil? || sut.puppet_configprint['manifest'].empty?
         | 
| 1244 1254 | 
             
                  fail("No output returned from `puppet config print manifest` on #{sut}")
         | 
| @@ -18,7 +18,7 @@ HOSTS: | |
| 18 18 | 
             
                roles:
         | 
| 19 19 | 
             
                  - el8
         | 
| 20 20 | 
             
                platform: el-8-x86_64
         | 
| 21 | 
            -
                box:  | 
| 21 | 
            +
                box: generic/centos8
         | 
| 22 22 | 
             
                hypervisor: <%= hypervisor %>
         | 
| 23 23 |  | 
| 24 24 | 
             
              el8-0:
         | 
| @@ -32,7 +32,8 @@ HOSTS: | |
| 32 32 | 
             
            CONFIG:
         | 
| 33 33 | 
             
              log_level: verbose
         | 
| 34 34 | 
             
              type: aio
         | 
| 35 | 
            -
              vagrant_memsize:  | 
| 35 | 
            +
              vagrant_memsize: 512
         | 
| 36 | 
            +
              vagrant_cpus: 2
         | 
| 36 37 | 
             
            <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
         | 
| 37 38 | 
             
              puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
         | 
| 38 39 | 
             
            <% end -%>
         | 
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            <%
         | 
| 2 | 
            +
              if ENV['BEAKER_HYPERVISOR']
         | 
| 3 | 
            +
                hypervisor = ENV['BEAKER_HYPERVISOR']
         | 
| 4 | 
            +
              else
         | 
| 5 | 
            +
                hypervisor = 'vagrant'
         | 
| 6 | 
            +
              end
         | 
| 7 | 
            +
            -%>
         | 
| 8 | 
            +
            HOSTS:
         | 
| 9 | 
            +
              oel7:
         | 
| 10 | 
            +
                roles:
         | 
| 11 | 
            +
                  - el7
         | 
| 12 | 
            +
                  - master
         | 
| 13 | 
            +
                platform: el-7-x86_64
         | 
| 14 | 
            +
                box: generic/oracle7
         | 
| 15 | 
            +
                hypervisor: <%= hypervisor %>
         | 
| 16 | 
            +
             | 
| 17 | 
            +
              oel8:
         | 
| 18 | 
            +
                roles:
         | 
| 19 | 
            +
                  - el8
         | 
| 20 | 
            +
                platform: el-8-x86_64
         | 
| 21 | 
            +
                box: generic/oracle8
         | 
| 22 | 
            +
                hypervisor: <%= hypervisor %>
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            CONFIG:
         | 
| 25 | 
            +
              log_level: verbose
         | 
| 26 | 
            +
              type: aio
         | 
| 27 | 
            +
              vagrant_memsize: 1024
         | 
| 28 | 
            +
              vagrant_cpus: 2
         | 
| 29 | 
            +
            <% if ENV['BEAKER_PUPPET_COLLECTION'] -%>
         | 
| 30 | 
            +
              puppet_collection: <%= ENV['BEAKER_PUPPET_COLLECTION'] %>
         | 
| 31 | 
            +
            <% end -%>
         | 
| 32 | 
            +
              ssh:
         | 
| 33 | 
            +
                keepalive: true
         | 
| 34 | 
            +
                keepalive_interval: 10
         | 
| 35 | 
            +
                host_key:
         | 
| 36 | 
            +
                  - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:host_key].join("\n#{' '*6}- ") %>
         | 
| 37 | 
            +
                kex:
         | 
| 38 | 
            +
                  - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:kex].join("\n#{' '*6}- ") %>
         | 
| 39 | 
            +
                encryption:
         | 
| 40 | 
            +
                  - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:encryption].join("\n#{' '*6}- ") %>
         | 
| 41 | 
            +
                hmac:
         | 
| 42 | 
            +
                  - <%= Net::SSH::Transport::Algorithms::ALGORITHMS[:hmac].join("\n#{' '*6}- ") %>
         | 
| @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            require 'spec_helper_acceptance'
         | 
| 2 2 |  | 
| 3 | 
            -
            test_name 'SSG  | 
| 3 | 
            +
            test_name 'SSG Functionality Validation'
         | 
| 4 4 |  | 
| 5 | 
            -
            describe 'run the SSG against  | 
| 5 | 
            +
            describe 'run the SSG against an SCAP profile' do
         | 
| 6 6 |  | 
| 7 7 | 
             
              hosts.each do |host|
         | 
| 8 8 | 
             
                context "on #{host}" do
         | 
| @@ -14,8 +14,15 @@ describe 'run the SSG against the STIG profile' do | |
| 14 14 | 
             
                  end
         | 
| 15 15 |  | 
| 16 16 | 
             
                  it 'should run the SSG' do
         | 
| 17 | 
            -
                     | 
| 17 | 
            +
                    profiles = @ssg.get_profiles
         | 
| 18 18 |  | 
| 19 | 
            +
                    profile = profiles.find{|x| x =~ /_stig/} ||
         | 
| 20 | 
            +
                      profiles.find{|x| x =~ /_cui/} ||
         | 
| 21 | 
            +
                      profiles.find{|x| x =~ /_ospp/} ||
         | 
| 22 | 
            +
                      profiles.find{|x| x =~ /_standard/} ||
         | 
| 23 | 
            +
                      profiles.last
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                    expect(profile).not_to be_nil
         | 
| 19 26 | 
             
                    @ssg.evaluate(profile)
         | 
| 20 27 | 
             
                  end
         | 
| 21 28 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: simp-beaker-helpers
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.24.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Chris Tessmer
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2022-01-11 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: beaker
         | 
| @@ -221,6 +221,7 @@ files: | |
| 221 221 | 
             
            - simp-beaker-helpers.gemspec
         | 
| 222 222 | 
             
            - spec/acceptance/nodesets/default.yml
         | 
| 223 223 | 
             
            - spec/acceptance/nodesets/docker.yml
         | 
| 224 | 
            +
            - spec/acceptance/nodesets/oel.yml
         | 
| 224 225 | 
             
            - spec/acceptance/nodesets/ubuntu.yml
         | 
| 225 226 | 
             
            - spec/acceptance/suites/default/check_puppet_version_spec.rb
         | 
| 226 227 | 
             
            - spec/acceptance/suites/default/enable_fips_spec.rb
         |