From ba9b79fad22f26990a97fb23408f1e220e6988ff Mon Sep 17 00:00:00 2001 From: Dan Webb Date: Thu, 17 Feb 2022 11:20:05 +0000 Subject: [PATCH] Update tested platforms and add unified_mode Signed-off-by: Dan Webb --- .github/workflows/ci.yml | 51 ++++++++++++------------------------- .overcommit.yml | 4 --- CHANGELOG.md | 2 ++ kitchen.dokken.yml | 55 +++++++++++++++++++++++++++------------- kitchen.yml | 23 +++++++++++------ metadata.rb | 2 +- resources/compile.rb | 2 ++ resources/config.rb | 2 ++ resources/install.rb | 20 ++------------- resources/rules.rb | 2 ++ resources/service.rb | 2 ++ 11 files changed, 81 insertions(+), 84 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ebd11f..cd4a1e2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,49 +4,30 @@ name: ci "on": pull_request: push: - branches: - - main + branches: [main] jobs: - delivery: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run Chef Delivery - uses: actionshub/chef-delivery@main - env: - CHEF_LICENSE: accept-no-persist - - yamllint: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run yaml Lint - uses: actionshub/yamllint@main - - mdl: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Run Markdown Lint - uses: actionshub/markdownlint@main + lint-unit: + uses: sous-chefs/.github/.github/workflows/lint-unit.yml@0.0.3 integration: - needs: [mdl, yamllint, delivery] + needs: lint-unit runs-on: ubuntu-latest strategy: matrix: os: - - 'debian-8' - - 'debian-9' - - 'centos-7' - - 'ubuntu-1604' - - 'ubuntu-1804' - suite: - - 'default' + - almalinux-8 + - amazonlinux-2 + - centos-7 + - centos-stream-8 + - debian-10 + - debian-11 + - fedora-latest + - opensuse-leap-15 + - rockylinux-8 + - ubuntu-1804 + - ubuntu-2004 + suite: [default] fail-fast: false steps: diff --git a/.overcommit.yml b/.overcommit.yml index 1d27ed8..cd8682a 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -11,10 +11,6 @@ PreCommit: enabled: true required_executable: 'cookstyle' command: ["cookstyle"] - Delivery: - enabled: true - required_executable: 'delivery' - flags: ['local', 'all'] CommitMsg: HardTabs: enabled: true diff --git a/CHANGELOG.md b/CHANGELOG.md index ae2753a..974061f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ This file is used to list changes made in each version of the snort cookbook. - resolved cookstyle error: resources/service.rb:44:77 refactor: `Chef/Modernize/UseChefLanguageSystemdHelper` - resolved cookstyle error: resources/service.rb:48:1 refactor: `Chef/Modernize/ClassEvalActionClass` - resolved cookstyle error: resources/service.rb:50:8 refactor: `Chef/Modernize/UseChefLanguageSystemdHelper` +- Update tested platforms +- Enable unified_mode ## 5.0.3 - *2022-02-08* diff --git a/kitchen.dokken.yml b/kitchen.dokken.yml index 9803344..16b534c 100644 --- a/kitchen.dokken.yml +++ b/kitchen.dokken.yml @@ -2,46 +2,65 @@ driver: name: dokken privileged: true - chef_version: <%= ENV['CHEF_VERSION'] || 'current' %> - env: [CHEF_LICENSE=accept] transport: name: dokken provisioner: name: dokken - deprecations_as_errors: true platforms: - - name: debian-8 + - name: almalinux-8 driver: - image: dokken/debian-8 + image: dokken/almalinux-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: amazonlinux-2 + driver: + image: dokken/amazonlinux-2 + pid_one_command: /usr/lib/systemd/systemd + + - name: debian-10 + driver: + image: dokken/debian-10 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - - name: debian-9 + - name: debian-11 driver: - image: dokken/debian-9 + image: dokken/debian-11 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update - name: centos-7 driver: image: dokken/centos-7 pid_one_command: /usr/lib/systemd/systemd - - name: ubuntu-16.04 + - name: centos-stream-8 driver: - image: dokken/ubuntu-16.04 - pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update + image: dokken/centos-stream-8 + pid_one_command: /usr/lib/systemd/systemd + + - name: fedora-latest + driver: + image: dokken/fedora-latest + pid_one_command: /usr/lib/systemd/systemd - name: ubuntu-18.04 driver: image: dokken/ubuntu-18.04 pid_one_command: /bin/systemd - intermediate_instructions: - - RUN /usr/bin/apt-get update + + - name: ubuntu-20.04 + driver: + image: dokken/ubuntu-20.04 + pid_one_command: /bin/systemd + + - name: opensuse-leap-15 + driver: + image: dokken/opensuse-leap-15 + pid_one_command: /usr/lib/systemd/systemd + + - name: rockylinux-8 + driver: + image: dokken/rockylinux-8 + pid_one_command: /usr/lib/systemd/systemd diff --git a/kitchen.yml b/kitchen.yml index 0310841..b642f28 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -3,22 +3,29 @@ driver: name: vagrant provisioner: - name: chef_zero + name: chef_infra + deprecations_as_errors: true + chef_license: accept product_name: chef product_version: <%= ENV['CHEF_VERSION'] || 'latest' %> - install_strategy: once - deprecations_as_errors: true + install_strategy: always + chef_log_level: <%= ENV['CHEF_LOG_LEVEL'] || 'auto' %> verifier: name: inspec platforms: + - name: almalinux-8 + - name: amazonlinux-2 - name: centos-7 - - name: debian-8 - - name: debian-9 - - name: fedora-27 - - name: ubuntu-14.04 - - name: ubuntu-16.04 + - name: centos-stream-8 + - name: debian-10 + - name: debian-11 + - name: fedora-latest + - name: opensuse-leap-15 + - name: rockylinux-8 + - name: ubuntu-18.04 + - name: ubuntu-20.04 suites: - name: default diff --git a/metadata.rb b/metadata.rb index 8342bd6..c6b7980 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache-2.0' description 'Installs Snort IDS packages' version '5.0.3' -chef_version '>= 15.0' +chef_version '>= 15.5' source_url 'https://github.com/sous-chefs/snort' issues_url 'https://github.com/sous-chefs/snort/issues' diff --git a/resources/compile.rb b/resources/compile.rb index d39714a..1865bf3 100644 --- a/resources/compile.rb +++ b/resources/compile.rb @@ -1,3 +1,5 @@ +unified_mode true + property :daq_tar, String, required: true property :snort_tar, String, required: true property :snort_version, String, required: true diff --git a/resources/config.rb b/resources/config.rb index cf8781d..40f5e17 100644 --- a/resources/config.rb +++ b/resources/config.rb @@ -1,3 +1,5 @@ +unified_mode true + property :home_net, String, default: 'any' property :external_net, String, default: 'any' property :http_ports, String, default: '80,81,311,383,591,593,901,1220,1414,1741,1830,2301,2381,2809,3037,3128,3702,4343,4848,5250,6988,7000,7001,7144,7145,7510,7777,7779,8000,8008,8014,8028,8080,8085,8088,8090,8118,8123,8180,8181,8243,8280,8300,8800,8888,8899,9000,9060,9080,9090,9091,9443,9999,11371,34443,34444,41080,50002,55555' diff --git a/resources/install.rb b/resources/install.rb index b2f8cfe..4f47f66 100644 --- a/resources/install.rb +++ b/resources/install.rb @@ -1,21 +1,5 @@ -# -# Cookbook:: snort -# Resource:: install -# -# Copyright:: 2010-2017, Chef Software, Inc -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# +unified_mode true + property :database, String, equal_to: %w(none snort-mysql postgresql pgsql postgres), name_property: true property :home_net, [String, nil], default: lazy { case node['platform_family'] diff --git a/resources/rules.rb b/resources/rules.rb index 4dac265..1c11deb 100644 --- a/resources/rules.rb +++ b/resources/rules.rb @@ -1,3 +1,5 @@ +unified_mode true + property :oinkcode, [String, nil] # Supply this to download registered/subscriber rules property :tar_name, String, default: 'community-rules.tar.gz' # Override this if you have an Oink code and know the tar you want to download property :conf_dir, String, default: '/etc/snort' diff --git a/resources/service.rb b/resources/service.rb index a7a5ae3..adc9346 100644 --- a/resources/service.rb +++ b/resources/service.rb @@ -1,3 +1,5 @@ +unified_mode true + property :options, Array, default: ['-q'] action :start do