Skip to content

Commit

Permalink
Closes #69, #68, #67, #66, #65
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerSchill committed Oct 12, 2019
1 parent 78fc870 commit b73d432
Show file tree
Hide file tree
Showing 14 changed files with 183 additions and 121 deletions.
65 changes: 65 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
lint_and_unit: &lint_and_unit
- delivery
- danger
- lint-yaml
- lint-markdown
version: 2.1
orbs:
kitchen: sous-chefs/kitchen@2
workflows:
kitchen:
jobs:
- kitchen/yamllint:
name: lint-yaml
- kitchen/mdlint:
name: lint-markdown
- kitchen/danger:
name: danger
context: Danger
- kitchen/delivery:
name: delivery
- kitchen/dokken-single:
name: default-amazonlinux
suite: default-amazonlinux
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-amazonlinux-2
suite: default-amazonlinux-2
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-debian-9
suite: default-debian-9
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-debian-10
suite: default-debian-10
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-centos-6
suite: default-centos-6
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-centos-7
suite: default-centos-7
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-fedora-latest
suite: default-fedora-latest
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-ubuntu-1604
suite: default-ubuntu-1604
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-ubuntu-1804
suite: default-ubuntu-1804
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-opensuse-leap-42
suite: default-opensuse-leap-42
requires: *lint_and_unit
- kitchen/dokken-single:
name: default-opensuse-leap-15
suite: default-opensuse-leap-15
requires: *lint_and_unit
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rules "~MD013", "~MD024", "~MD033"
47 changes: 0 additions & 47 deletions .travis.yml

This file was deleted.

8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# fail2ban Cookbook CHANGELOG
# Changelog
All notable changes to this project will be documented in this file.

This file is used to list changes made in each version of the fail2ban cookbook.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## 6.0.0 (2019-05-08)

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
<https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD>
40 changes: 40 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Reference: http://danger.systems/reference.html

# A pull request summary is required. Add a description of the pull request purpose.
# Changelog must be updated for each pull request that changes code.
# Warnings will be issued for:
# Pull request with more than 400 lines of code changed
# Pull reqest that change more than 5 lines without test changes
# Failures will be issued for:
# Pull request without summary
# Pull requests with code changes without changelog entry

def code_changes?
code = %w(libraries attributes recipes resources files templates)
code.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end

def test_changes?
tests = %w(spec test .kitchen.yml .kitchen.dokken.yml)
tests.each do |location|
return true unless git.modified_files.grep(/#{location}/).empty?
end
false
end

failure 'Please provide a summary of your Pull Request.' if github.pr_body.length < 10

warn 'This is a big Pull Request.' if git.lines_of_code > 400

# Require a CHANGELOG entry for non-test changes.
if !git.modified_files.include?('CHANGELOG.md') && code_changes?
failure 'Please include a CHANGELOG entry.'
end

# A sanity check for tests.
if git.lines_of_code > 5 && code_changes? && !test_changes?
warn 'This Pull Request is probably missing tests.'
end
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Installs and configures `fail2ban`, a utility that watches logs for failed login
- OpenSUSE

### Chef

- Chef 13.0+

### Cookbooks
Expand Down Expand Up @@ -42,7 +43,6 @@ The `CRITICAL` and `NOTICE` log levels are only available on fail2ban >= 0.9.x.

The `syslogsocket`, `dbfile`, and `dbpurgeage` options are only applicable to fail2ban >= 0.9.x


This cookbook has a set of configuration options for jail.conf

- default['fail2ban']['ignoreip'] = '127.0.0.1/8'
Expand Down Expand Up @@ -115,8 +115,7 @@ Then you will get notifications like this:

> [hostname] Banned 🇳🇬 217.117.13.12 in the jail sshd after 5 attempts
Issues related to rsyslog
==========================
## Issues related to rsyslog

If you are using rsyslog parameter "$RepeatedMsgReduction on" in rsyslog.conf file
then you can get "Last message repeated N times" in system log file (for example auth.log).
Expand Down
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD
<https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD>
107 changes: 54 additions & 53 deletions kitchen.dokken.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
privileged: true # because Docker and SystemD/Upstart
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>

transport:
Expand All @@ -15,65 +16,65 @@ verifier:
name: inspec

platforms:
- name: amazonlinux
driver:
image: dokken/amazonlinux
pid_one_command: /sbin/init
- name: amazonlinux
driver:
image: dokken/amazonlinux
pid_one_command: /sbin/init

- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd

- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init
- name: centos-6
driver:
image: dokken/centos-6
pid_one_command: /sbin/init

- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd

- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd

- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- 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-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: opensuse-leap-42
driver:
image: dokken/opensuse-leap-42
pid_one_command: /bin/systemd
- name: opensuse-leap-42
driver:
image: dokken/opensuse-leap-42
pid_one_command: /bin/systemd

- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd
- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd
3 changes: 2 additions & 1 deletion kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
driver:
name: vagrant

Expand Down Expand Up @@ -26,4 +27,4 @@ platforms:
suites:
- name: default
run_list:
recipe[test::default]
recipe[test::default]
4 changes: 1 addition & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Installs and configures fail2ban'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '6.0.0'

recipe 'default', 'Installs and configures fail2ban'
version '6.0.0'

depends 'yum-epel'

Expand Down
6 changes: 3 additions & 3 deletions spec/unit/recipes/centos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'default recipe on CentOS 5' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '5.11')
runner.node.normal['packages']['fail2ban'] = {
runner.node.default['packages']['fail2ban'] = {
epoch: '0',
version: '0.8.14',
release: '1.el5',
Expand All @@ -25,7 +25,7 @@
describe 'default recipe on CentOS 6' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '6.9')
runner.node.normal['packages']['fail2ban'] = {
runner.node.default['packages']['fail2ban'] = {
epoch: '0',
version: '0.9.6',
release: '1.el6.1',
Expand All @@ -50,7 +50,7 @@
describe 'default recipe on CentOS 7' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7.3.1611')
runner.node.normal['packages']['fail2ban'] = {
runner.node.default['packages']['fail2ban'] = {
epoch: '0',
version: '0.9.7',
release: '1.el7',
Expand Down
Loading

0 comments on commit b73d432

Please sign in to comment.