Skip to content

Commit

Permalink
Changing requirements file;Adding pre-commit-hooks and fixes (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-wasabi authored Oct 17, 2020
1 parent 1b57524 commit 4c455b1
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 59 deletions.
3 changes: 3 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Ignore certain ansible-lint error messages.
warn_list:
- '106'
2 changes: 1 addition & 1 deletion .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
curl -so requirements.txt 'https://raw.githubusercontent.com/dj-wasabi/ansible-ci-base/master/requirements.txt'
curl -so requirements.txt 'https://raw.githubusercontent.com/dj-wasabi/dj-wasabi-release/main/requirements.txt'
pip install -r requirements.txt
- name: Run role tests
Expand Down
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
repos:
- repo: local
hooks:
- id: ansible-lint
name: Ansible-lint
description: This hook runs ansible-lint.
entry: ansible-lint --force-color .
language: python
pass_filenames: false
always_run: true
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
101 changes: 56 additions & 45 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,76 @@
# ansible-ossec-server Release
# Changelog

Below an overview of all changes in the releases.
## [0.6.1](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.6.1) (2020-09-01)

Version (Release date)
[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.6.0...0.6.1)

0.6.1 (2020-09-01)
## [0.6.0](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.6.0) (2020-08-31)

* Allow to override GPG checking while installing release.rpm file.
[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.5.0...0.6.0)

0.6.0 (2020-08-31)
## [0.5.0](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.5.0) (2018-09-11)

* Update to current ansible/molecule/testinfra and fix CentOS7 init. #31 (By pull request: skyscooby (Thanks!))
* Amazon Linux & Local Postfix Relay #33 (By pull request: sblack4 (Thanks!))
* Moved from travis to Github Actions.
[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.4.0...0.5.0)

0.5.0 (2018-09-11)
**Closed issues:**

* Added tests;Removing pyc file #21
* Fixes #22 (By pull request: elrondvega (Thanks!))
* Use specific version of libraries #24
* Bunch of files #25
* Moved some client-syslog after the installation of the configuration … #26
* Added Ubuntu #27
* Fixes issue #28 (By pull request: dale-c-anderson (Thanks!))
* Fix check-mode with syslog-output configured #30 (By pull request: sigio (Thanks!))
- The `restart ossec-server` handler fails when using the `rules` tag [\#28](https://github.com/dj-wasabi/ansible-ossec-server/issues/28)
- Issue with syslog\_outputs [\#9](https://github.com/dj-wasabi/ansible-ossec-server/issues/9)

0.4.0 (2017-12-27)
## [0.4.0](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.4.0) (2017-12-27)

* Fix some formatting issues with the example config in the readme file #19 (By pull request: dale-c-anderson (Thanks!))
* Using Molecule V2 #18
* Update atomic-release #17 (By pull request: aarnaud (Thanks!))
[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.3.0...0.4.0)

0.3.0 (2017-05-14)
**Implemented enhancements:**

* refactor cis_distribution_filename usage to be more dry #16 (By pull request: s01ipsist (Thanks!))
* Fixing molecule #15
* Fix ossec upstream repository #14 (By pull request: s01ipsist (Thanks!))
* Fix debian repository + systemd daemon reload #13 (By pull request: s01ipsist (Thanks!))
- Define a variable for atomicorp repo version [\#20](https://github.com/dj-wasabi/ansible-ossec-server/issues/20)

0.2.0 (2017-02-14)
## [0.3.0](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.3.0) (2017-05-13)

* Added molecule testing
* do not look for specific key ID. It appears that OSSEC released a new… #3 (By pull request: recunius (Thanks!))
* Updates #4 (By pull request: recunius (Thanks!))
* allow providing own local_rules.xml template with var ossec_server_#5 (By pull request: recunius (Thanks!))
* Update CIS filename to CentOS & Redhat 7 #6 (By pull request: jlruizmlg (Thanks!))
* add ossec authd as service #7 (By pull request: jlruizmlg (Thanks!))
* Fix the permissions in the wazuh-authd in upstart system. #8 (By pull request: jlruizmlg (Thanks!))
* Remove ssl files and add task to generate them + Fix script init task #10 (By pull request: aarnaud (Thanks!))
[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.2.0...0.3.0)

0.1.0 (2015-11-16)
**Merged pull requests:**

* Fixes for CentOS/EL7 #1 (By pull request: andskli (Thanks!))
* Updates to support Ubuntu and also adds more configuration options #2 (By pull request: recunius (Thanks!))
* Added kitchen test and serverspec tests
- refactor cis\_distribution\_filename usage to be more dry [\#16](https://github.com/dj-wasabi/ansible-ossec-server/pull/16) ([s01ipsist](https://github.com/s01ipsist))
- Fixing molecule [\#15](https://github.com/dj-wasabi/ansible-ossec-server/pull/15) ([dj-wasabi](https://github.com/dj-wasabi))
- Fix debian repository + systemd daemon reload [\#13](https://github.com/dj-wasabi/ansible-ossec-server/pull/13) ([aarnaud](https://github.com/aarnaud))

0.0.2 (2014-12-11)
## [0.2.0](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.2.0) (2017-02-14)

* Added possibilty to use other mail settings
* Reworked module for better setup. Updated readme
[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.1.0...0.2.0)

0.0.1 (2014-12-04)
**Implemented enhancements:**

* Initial creation
- Enable testing with Molecule [\#11](https://github.com/dj-wasabi/ansible-ossec-server/issues/11)

**Merged pull requests:**

- Added molecule to test role [\#12](https://github.com/dj-wasabi/ansible-ossec-server/pull/12) ([dj-wasabi](https://github.com/dj-wasabi))
- Remove ssl files and add task to generate them + Fix script init task [\#10](https://github.com/dj-wasabi/ansible-ossec-server/pull/10) ([aarnaud](https://github.com/aarnaud))
- Fix the permissions in the wazuh-authd in upstart system. [\#8](https://github.com/dj-wasabi/ansible-ossec-server/pull/8) ([jlruizmlg](https://github.com/jlruizmlg))
- add ossec authd as service [\#7](https://github.com/dj-wasabi/ansible-ossec-server/pull/7) ([jlruizmlg](https://github.com/jlruizmlg))
- Update CIS filename to CentOS & Redhat 7 [\#6](https://github.com/dj-wasabi/ansible-ossec-server/pull/6) ([jlruizmlg](https://github.com/jlruizmlg))
- - allow providing own local\_rules.xml template with var ossec\_server\_[\#5](https://github.com/dj-wasabi/ansible-ossec-server/pull/5) ([recunius](https://github.com/recunius))
- Updates [\#4](https://github.com/dj-wasabi/ansible-ossec-server/pull/4) ([recunius](https://github.com/recunius))
- do not look for specific key ID. It appears that OSSEC released a new… [\#3](https://github.com/dj-wasabi/ansible-ossec-server/pull/3) ([recunius](https://github.com/recunius))

## [0.1.0](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.1.0) (2015-11-16)

[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.0.2...0.1.0)

**Merged pull requests:**

- Updates to support Ubuntu and also adds more configuration options [\#2](https://github.com/dj-wasabi/ansible-ossec-server/pull/2) ([recunius](https://github.com/recunius))
- Fixes for CentOS/EL7 [\#1](https://github.com/dj-wasabi/ansible-ossec-server/pull/1) ([andskli](https://github.com/andskli))

## [0.0.2](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.0.2) (2014-12-11)

[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/0.0.1...0.0.2)

## [0.0.1](https://github.com/dj-wasabi/ansible-ossec-server/tree/0.0.1) (2014-12-07)

[Full Changelog](https://github.com/dj-wasabi/ansible-ossec-server/compare/055ca4cfce21919e56a4135912d50efb83227dd5...0.0.1)



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
13 changes: 9 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Please note that this project is released with a Contributor Code of Conduct. By
2. Create a branch and apply your changes to this branch.

a. Make sure you have updated the documentation when adding new variables;

b. Don't forget to add/update tests so we can test the functionality during each Pull Request;

c. Make sure the tests will succeed.

3. Push the branch to your fork and submit a pull request.
Expand All @@ -44,13 +44,14 @@ Style guides are important because they ensure consistency in the content, look,

## (local) Development

This role make use of Molecule to test the execution of the role and verificate it. In the root of the repository, a file named `requirements.txt` exists and contains the versions used by the tests.
This role make use of Molecule to test the execution of the role and verificate it. In the repository https://github.com/dj-wasabi/dj-wasabi-release, a file named `requirements.txt` exists and contains the versions used by the tests.

### Requirements

You can install them with the following command:

```
wget https://raw.githubusercontent.com/dj-wasabi/dj-wasabi-release/main/requirements.txt
pip install -r requirements.txt
```

Expand All @@ -67,6 +68,10 @@ It should run without any issues.

# Other

## pre-commit

This repository contains a pre-commit hook. This means that when you want to commit the changes, 1 or more tests are executed to validate the changes. Please take a look at how to install the `pre-commit` package from the official [site](https://pre-commit.com/). Also make sure to install `ansible-lint` via `pip install ansible-lint` as this is 1 of the tools that is executed while a pre-commit hooks runs.

## Virtualenv

Suggestion is to create a virtualenv so you won't have issues with other projects.
Expand All @@ -85,4 +90,4 @@ Some web pages describing for virtual env:

[Molecule V2 with your own role](https://werner-dijkerman.nl/2017/09/05/using-molecule-v2-to-test-ansible-roles/)

**End note**: Have fun making changes. If a feature helps you, then others find it helpful too and I will happily have it merged.
**End note**: Have fun making changes. If a feature helps you, then others find it helpful too and I will happily have it merged.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ GPLv3
Author Information
------------------

Please send suggestion or pull requests to make this role better.
Please send suggestion or pull requests to make this role better.

Github: https://github.com/dj-wasabi/ansible-ossec-server

Expand Down
2 changes: 1 addition & 1 deletion molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
warn: False
when:
- ansible_os_family == "Debian"

- name: "Installing tools on NON-CentOS"
apt:
name:
Expand Down
1 change: 1 addition & 0 deletions tasks/Amazon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
path: /etc/yum.repos.d/atomic.repo
regexp: '^(?P<firstpart>.*)\$releasever(?P<lastpart>.*)$'
replace: '\g<firstpart>{{ corresponding_centos_version }}\g<lastpart>'
mode: '0644'


- name: "Amazon | Install ossec-hids-server"
Expand Down
1 change: 1 addition & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
template:
src: ossec-authd.service
dest: /lib/systemd/system/ossec-authd.service
mode: 0755
when:
- ansible_service_mgr == "systemd"
- ansible_os_family != "CoreOS"
Expand Down
1 change: 0 additions & 1 deletion templates/etc-yum.repos.d-rhel.repo.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ enabled={{ item.enabled }}
priority={{ item.priority }}
gpgcheck={{ item.gpgcheck }}
gpgkey={{ item.gpgkey }}

12 changes: 6 additions & 6 deletions templates/var-ossec-rules-local_rules.xml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@
<description>Example of rule that will ignore sshd </description>
<description>failed logins from IP 1.1.1.1.</description>
</rule>


<!-- This example will ignore ssh failed logins for the user name XYZABC.
-->
<!--
<!--
<rule id="100020" level="0">
<if_sid>5711</if_sid>
<user>XYZABC</user>
<description>Example of rule that will ignore sshd </description>
<description>failed logins for user XYZABC.</description>
</rule>
-->


<!-- Specify here a list of rules to ignore. -->
<!--
<rule id="100030" level="0">
<if_sid>12345, 23456, xyz, abc</if_sid>
<description>List of rules to be ignored.</description>
</rule>
-->

</group> <!-- SYSLOG,LOCAL -->


Expand Down

0 comments on commit 4c455b1

Please sign in to comment.