Compare commits
55
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0b9c87dc1 | ||
|
|
142782bad6 | ||
|
|
b3fbfcedbe | ||
|
|
88ef3cf3af | ||
|
|
ca25f50ba6 | ||
|
|
a82942a63a | ||
|
|
fc060376ac | ||
|
|
16f78bc6be | ||
|
|
764472ae33 | ||
|
|
395091c41d | ||
|
|
0a589e5f51 | ||
|
|
9d0cc42039 | ||
|
|
5a7783defe | ||
|
|
be0642bcfb | ||
|
|
b0454fade2 | ||
|
|
bb3c63e321 | ||
|
|
d3e6df3dbf | ||
|
|
e66c2eb6bb | ||
|
|
61e92aaaf6 | ||
|
|
ade6deeba2 | ||
|
|
66f5c6b131 | ||
|
|
7d1da63c94 | ||
|
|
03f3974f37 | ||
|
|
006e3bf75b | ||
|
|
98c645db5f | ||
|
|
dd97a90b65 | ||
|
|
d982a89cc1 | ||
|
|
681898bd96 | ||
|
|
e32d550e9b | ||
|
|
4df95e3733 | ||
|
|
05205eb413 | ||
|
|
d0407b17c4 | ||
|
|
1346e37e14 | ||
|
|
c2ee3105c7 | ||
|
|
613fbd82da | ||
|
|
9530615d5f | ||
|
|
24d0153815 | ||
|
|
99fe8b6969 | ||
|
|
f496b385dd | ||
|
|
f8295d5248 | ||
|
|
a1f75f877b | ||
|
|
901923bac2 | ||
|
|
c30ef42355 | ||
|
|
e2b963d711 | ||
|
|
414efd6125 | ||
|
|
87a461fc57 | ||
|
|
dac66f4a88 | ||
|
|
3b8b394f10 | ||
|
|
b27ffd08b0 | ||
|
|
8ee946a537 | ||
|
|
a176443f22 | ||
|
|
9d75e3b00e | ||
|
|
a1b80fe657 | ||
|
|
53be805099 | ||
|
|
464d8df8e8 |
No files matched your search
@@ -11,6 +11,7 @@ exclude_paths:
|
|||||||
|
|
||||||
skip_list:
|
skip_list:
|
||||||
- fqcn-builtins
|
- fqcn-builtins
|
||||||
|
- name[template]
|
||||||
|
|
||||||
mock_roles:
|
mock_roles:
|
||||||
- geerlingguy.git
|
- geerlingguy.git
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe the bug**
|
|
||||||
A clear and concise description of what the bug is.
|
|
||||||
|
|
||||||
**Expected behavior**
|
|
||||||
A clear and concise description of what you expected to happen.
|
|
||||||
|
|
||||||
**Actual behavior**
|
|
||||||
|
|
||||||
<!--- Paste verbatim command output between quotes -->
|
|
||||||
|
|
||||||
```paste below
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**Example Playbook**
|
|
||||||
|
|
||||||
<!--- Paste an example playbook that can be used to reproduce the problem between quotes -->
|
|
||||||
|
|
||||||
```paste below
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**OS / Environment**
|
|
||||||
|
|
||||||
<!--- Provide all relevant information below, e.g. target OS versions, network device firmware, etc. -->
|
|
||||||
|
|
||||||
**Ansible Version**
|
|
||||||
|
|
||||||
<!--- Paste verbatim output from "ansible --version" between quotes -->
|
|
||||||
|
|
||||||
```paste below
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**Role Version**
|
|
||||||
|
|
||||||
<!--- Paste version of the role between quotes -->
|
|
||||||
|
|
||||||
```paste below
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context about the problem here.
|
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
---
|
||||||
|
# reference: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests
|
||||||
|
name: "Bug report"
|
||||||
|
description: "Create a report to help us improve."
|
||||||
|
labels: [
|
||||||
|
"bug"
|
||||||
|
]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Reporting Bugs ld follow some simple rules:
|
||||||
|
|
||||||
|
- **Check**, if you can find similar bugs
|
||||||
|
- **Describe** what is happening and what should happen
|
||||||
|
- **Explain** how to reproduce the problem
|
||||||
|
- **Add** more details and attachments
|
||||||
|
- **Follow up**, if somebody is having questions or needs more details
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: "Description"
|
||||||
|
description: Describe the bug
|
||||||
|
placeholder: A clear and concise description of what the bug is.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: reprod
|
||||||
|
attributes:
|
||||||
|
label: "Reproduction steps"
|
||||||
|
render: Shell
|
||||||
|
description: Paste an example playbook that can be used to reproduce the problem. This will be automatically formatted into code, so no need for backticks.
|
||||||
|
value: |
|
||||||
|
...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: currentbehavior
|
||||||
|
attributes:
|
||||||
|
label: "Current Behavior"
|
||||||
|
description: Please describe the results you received
|
||||||
|
value: |
|
||||||
|
...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expectedbehavior
|
||||||
|
attributes:
|
||||||
|
label: "Expected Behavior"
|
||||||
|
description: Please describe the results you expect
|
||||||
|
value: |
|
||||||
|
...
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: "OS / Environment"
|
||||||
|
value: |
|
||||||
|
Provide all relevant information below, e.g. target OS versions, network device firmware, etc.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: ansible
|
||||||
|
attributes:
|
||||||
|
label: "Ansible Version"
|
||||||
|
render: Shell
|
||||||
|
value: |
|
||||||
|
Paste verbatim output from "ansible --version" between quotes. This will be automatically formatted into code, so no need for backticks.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: collection
|
||||||
|
attributes:
|
||||||
|
label: "Collection Version"
|
||||||
|
render: Shell
|
||||||
|
value: |
|
||||||
|
Paste version of the collection. This will be automatically formatted into code, so no need for backticks.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: additional
|
||||||
|
attributes:
|
||||||
|
label: "Additional information"
|
||||||
|
description: Please add information like the used software versions, outputs of logs, OS information, screenshots, etc. to enhance the report
|
||||||
|
value: |
|
||||||
|
...
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
---
|
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
|
||||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
---
|
||||||
|
# reference: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests
|
||||||
|
name: "Feature request"
|
||||||
|
description: "Suggest an idea for this project."
|
||||||
|
labels: [
|
||||||
|
"enhancement"
|
||||||
|
]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Requesting a new feature or enhancement is following some simple rules:
|
||||||
|
|
||||||
|
- **Check**, if the feature is already requested
|
||||||
|
- **Describe** what your feature will bring to the community
|
||||||
|
- **Explain** the criteria to fulfill the request
|
||||||
|
- **Add** more details like mock ups, attachments, lists, screenshots
|
||||||
|
- **Follow Up** in the discussion to the feature
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: "Description"
|
||||||
|
description: Is your feature request related to a problem? Please describe.
|
||||||
|
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: solution
|
||||||
|
attributes:
|
||||||
|
label: "Solution"
|
||||||
|
description: Describe the solution you'd like
|
||||||
|
placeholder: A clear and concise description of what you want to happen.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: alternatives
|
||||||
|
attributes:
|
||||||
|
label: "Alternatives"
|
||||||
|
description: Describe alternatives you've considered
|
||||||
|
placeholder: A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: additional
|
||||||
|
attributes:
|
||||||
|
label: "Additional information"
|
||||||
|
description: Add any other context or screenshots about the feature request here.
|
||||||
|
value: |
|
||||||
|
...
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
@@ -10,3 +10,8 @@ updates:
|
|||||||
directory: "/" # Location of package manifests
|
directory: "/" # Location of package manifests
|
||||||
schedule:
|
schedule:
|
||||||
interval: "daily"
|
interval: "daily"
|
||||||
|
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "daily"
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
- debian11
|
- debian11
|
||||||
# - amazon # geerlingguy.mysql does not support fedora
|
# - amazon # geerlingguy.mysql does not support fedora
|
||||||
# - arch # needs to be fixed
|
# - arch # needs to be fixed
|
||||||
# - opensuse_tumbleweed # needs to be fixed
|
- opensuse_tumbleweed # needs to be fixed
|
||||||
# - fedora # geerlingguy.mysql does not support fedora
|
# - fedora # geerlingguy.mysql does not support fedora
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
@@ -47,7 +47,7 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Set up Python 3.7
|
- name: Set up Python 3.7
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Set up Python 3.7
|
- name: Set up Python 3.7
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Set up Python 3.7
|
- name: Set up Python 3.7
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
|
|
||||||
|
|||||||
@@ -25,17 +25,17 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
molecule_distro:
|
molecule_distro:
|
||||||
- centos7
|
- centos7
|
||||||
- centosstream8
|
- centos8s
|
||||||
- centosstream9
|
# - centos9s # problems with vagrant
|
||||||
- rocky8
|
- rocky8
|
||||||
- rocky9
|
# - rocky9 # problems with vagrant
|
||||||
- ubuntu1804
|
- ubuntu1804
|
||||||
- ubuntu2004
|
- ubuntu2004
|
||||||
- ubuntu2204
|
- ubuntu2204
|
||||||
- debian10
|
- debian10
|
||||||
- debian11
|
- debian11
|
||||||
# - opensuse42 # opensuse currently cannot get an ip address
|
# - opensuse42 # opensuse currently cannot get an ip address
|
||||||
# - arch - arch is currently not supported by cinc-auditor
|
# - arch # arch is currently not supported by cinc-auditor
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ jobs:
|
|||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
|
|
||||||
- name: Prettify code
|
- name: Prettify code
|
||||||
uses: creyD/prettier_action@v3.1
|
uses: creyD/prettier_action@v4.2
|
||||||
with:
|
with:
|
||||||
prettier_options: --write {**/*,*}.md
|
prettier_options: --write {**/*,*}.md
|
||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Set up Python 3.7
|
- name: Set up Python 3.7
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ jobs:
|
|||||||
submodules: true
|
submodules: true
|
||||||
|
|
||||||
- name: Set up Python 3.7
|
- name: Set up Python 3.7
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.7
|
python-version: 3.7
|
||||||
|
|
||||||
|
|||||||
+52
-3
@@ -1,11 +1,58 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## [8.2.1](https://github.com/dev-sec/ansible-collection-hardening/tree/8.2.1) (2022-10-20)
|
## [9.0.0](https://github.com/dev-sec/ansible-collection-hardening/tree/9.0.0) (2023-01-19)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/8.2.0...8.2.1)
|
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/8.4.0...9.0.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Add support for /etc/auditd.conf num\_logs to go with max\_log\_file\_action [\#616](https://github.com/dev-sec/ansible-collection-hardening/issues/616)
|
||||||
|
- Add support for /etc/auditd.conf num\_logs to go with max\_log\_file\_action [\#617](https://github.com/dev-sec/ansible-collection-hardening/pull/617) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([richardlock](https://github.com/richardlock))
|
||||||
|
- Parametrize more auditd.conf options [\#535](https://github.com/dev-sec/ansible-collection-hardening/pull/535) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([kravietz](https://github.com/kravietz))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Bump actions/setup-python from 1 to 4 [\#611](https://github.com/dev-sec/ansible-collection-hardening/pull/611) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
- Bump creyD/prettier\_action from 3.1 to 4.2 [\#610](https://github.com/dev-sec/ansible-collection-hardening/pull/610) ([dependabot[bot]](https://github.com/apps/dependabot))
|
||||||
|
|
||||||
|
## [8.4.0](https://github.com/dev-sec/ansible-collection-hardening/tree/8.4.0) (2022-12-17)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/8.3.0...8.4.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- Implement Test for MySQL systemd service [\#606](https://github.com/dev-sec/ansible-collection-hardening/issues/606)
|
||||||
|
- Extended net hardening [\#607](https://github.com/dev-sec/ansible-collection-hardening/pull/607) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([DonEstefan](https://github.com/DonEstefan))
|
||||||
|
- Add OpenSUSE support [\#605](https://github.com/dev-sec/ansible-collection-hardening/pull/605) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
||||||
|
- Allow ssh\_allow\_tcp\_forwarding to be a boolean [\#600](https://github.com/dev-sec/ansible-collection-hardening/pull/600) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([crisbal](https://github.com/crisbal))
|
||||||
|
- OpenBSD does not support GSSAPI Authentication [\#598](https://github.com/dev-sec/ansible-collection-hardening/pull/598) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([dennisse](https://github.com/dennisse))
|
||||||
|
- add Ansible specific templates for issues [\#596](https://github.com/dev-sec/ansible-collection-hardening/pull/596) ([schurzi](https://github.com/schurzi))
|
||||||
|
- use github templates for new issues [\#595](https://github.com/dev-sec/ansible-collection-hardening/pull/595) ([schurzi](https://github.com/schurzi))
|
||||||
|
|
||||||
**Fixed bugs:**
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- os\_auth\_retries variable causes a comparison type error on pam tasks [\#593](https://github.com/dev-sec/ansible-collection-hardening/issues/593)
|
||||||
|
- ssh\_hardening: Install selinux dependencies fails on Oracle Linux \(RHEL\) 9 [\#585](https://github.com/dev-sec/ansible-collection-hardening/issues/585)
|
||||||
|
- OpenBSD does not set distributiuon\_major\_version [\#597](https://github.com/dev-sec/ansible-collection-hardening/pull/597) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([dennisse](https://github.com/dennisse))
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Check for github action updates daily [\#609](https://github.com/dev-sec/ansible-collection-hardening/pull/609) ([jlosito](https://github.com/jlosito))
|
||||||
|
- add verify-task to check if mysql is running and enabled [\#608](https://github.com/dev-sec/ansible-collection-hardening/pull/608) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
||||||
|
- Updates handlers for new ansible syntax and deprecated options for legacy commands [\#602](https://github.com/dev-sec/ansible-collection-hardening/pull/602) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([jsievertde](https://github.com/jsievertde))
|
||||||
|
- add notice to sign-off work to contributor guideline [\#601](https://github.com/dev-sec/ansible-collection-hardening/pull/601) ([schurzi](https://github.com/schurzi))
|
||||||
|
|
||||||
|
## [8.3.0](https://github.com/dev-sec/ansible-collection-hardening/tree/8.3.0) (2022-10-27)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/dev-sec/ansible-collection-hardening/compare/8.2.0...8.3.0)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- add hardening of root user account\(s\) [\#579](https://github.com/dev-sec/ansible-collection-hardening/pull/579) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([DonEstefan](https://github.com/DonEstefan))
|
||||||
|
|
||||||
|
**Fixed bugs:**
|
||||||
|
|
||||||
|
- cast expected int types in pam tasks [\#594](https://github.com/dev-sec/ansible-collection-hardening/pull/594) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([dlouzan](https://github.com/dlouzan))
|
||||||
- do not manage trusted user ca keys if none exist [\#580](https://github.com/dev-sec/ansible-collection-hardening/pull/580) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([hollow](https://github.com/hollow))
|
- do not manage trusted user ca keys if none exist [\#580](https://github.com/dev-sec/ansible-collection-hardening/pull/580) [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([hollow](https://github.com/hollow))
|
||||||
|
|
||||||
**Closed issues:**
|
**Closed issues:**
|
||||||
@@ -16,6 +63,8 @@
|
|||||||
|
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- adopt all current suggestions from ansible-lint [\#592](https://github.com/dev-sec/ansible-collection-hardening/pull/592) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] ([schurzi](https://github.com/schurzi))
|
||||||
|
- Support more os [\#588](https://github.com/dev-sec/ansible-collection-hardening/pull/588) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
||||||
- run tests only on pushes to master or to PRs [\#581](https://github.com/dev-sec/ansible-collection-hardening/pull/581) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
- run tests only on pushes to master or to PRs [\#581](https://github.com/dev-sec/ansible-collection-hardening/pull/581) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
||||||
|
|
||||||
## [8.2.0](https://github.com/dev-sec/ansible-collection-hardening/tree/8.2.0) (2022-09-08)
|
## [8.2.0](https://github.com/dev-sec/ansible-collection-hardening/tree/8.2.0) (2022-09-08)
|
||||||
@@ -43,7 +92,7 @@
|
|||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
- update supported OS in meta and fix linting [\#572](https://github.com/dev-sec/ansible-collection-hardening/pull/572) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
- update supported OS in meta and fix linting [\#572](https://github.com/dev-sec/ansible-collection-hardening/pull/572) [[mysql_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/mysql_hardening)] [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] [[ssh_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/ssh_hardening)] [[nginx_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/nginx_hardening)] ([rndmh3ro](https://github.com/rndmh3ro))
|
||||||
- fix misleading comment [\#571](https://github.com/dev-sec/ansible-collection-hardening/pull/571) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([donestefan](https://github.com/donestefan))
|
- fix misleading comment [\#571](https://github.com/dev-sec/ansible-collection-hardening/pull/571) [[os_hardening](https://github.com/dev-sec/ansible-collection-hardening/labels/os_hardening)] ([DonEstefan](https://github.com/DonEstefan))
|
||||||
- only run release actions on upstream-repo [\#568](https://github.com/dev-sec/ansible-collection-hardening/pull/568) ([rndmh3ro](https://github.com/rndmh3ro))
|
- only run release actions on upstream-repo [\#568](https://github.com/dev-sec/ansible-collection-hardening/pull/568) ([rndmh3ro](https://github.com/rndmh3ro))
|
||||||
|
|
||||||
## [8.0.0](https://github.com/dev-sec/ansible-collection-hardening/tree/8.0.0) (2022-08-22)
|
## [8.0.0](https://github.com/dev-sec/ansible-collection-hardening/tree/8.0.0) (2022-08-22)
|
||||||
|
|||||||
+19
-1
@@ -15,7 +15,7 @@ In order to contribute code please:
|
|||||||
1. Fork the project on GitHub
|
1. Fork the project on GitHub
|
||||||
2. Clone the project
|
2. Clone the project
|
||||||
3. Add changes (and tests)
|
3. Add changes (and tests)
|
||||||
4. Commit and push
|
4. Commit, sign off and push your changes
|
||||||
5. Create a merge-request
|
5. Create a merge-request
|
||||||
|
|
||||||
To have your code merged, see the expectations listed below.
|
To have your code merged, see the expectations listed below.
|
||||||
@@ -28,6 +28,24 @@ Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCom
|
|||||||
|
|
||||||
## Expectations
|
## Expectations
|
||||||
|
|
||||||
|
## Sign off Your Work
|
||||||
|
|
||||||
|
The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project.
|
||||||
|
[Here is the full text of the DCO](http://developercertificate.org/).
|
||||||
|
Contributors must sign-off that they adhere to these requirements by adding a `Signed-off-by` line to commit messages.
|
||||||
|
|
||||||
|
```text
|
||||||
|
This is my commit message
|
||||||
|
|
||||||
|
Signed-off-by: Random J Developer <[email protected]>
|
||||||
|
```
|
||||||
|
|
||||||
|
Git even has a -s command line option to append this automatically to your commit message:
|
||||||
|
|
||||||
|
```text
|
||||||
|
git commit -s -m 'This is my commit message'
|
||||||
|
```
|
||||||
|
|
||||||
### Don't reinvent the wheel
|
### Don't reinvent the wheel
|
||||||
|
|
||||||
This hardening project doesn't intend to reinvent the configuration stack for services. Aim to use official configuration projects first and provide hardening as a layer on top. The goal is remove the need for a user to configure all aspects of services and maintain security configuration. This way, the user can still configure a service using the interface provided by the official project.
|
This hardening project doesn't intend to reinvent the configuration stack for services. Aim to use official configuration projects first and provide hardening as a layer on top. The goal is remove the need for a user to configure all aspects of services and maintain security configuration. This way, the user can still configure a service using the interface provided by the official project.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
namespace: devsec
|
namespace: devsec
|
||||||
name: hardening
|
name: hardening
|
||||||
version: 8.2.0
|
version: 8.4.0
|
||||||
readme: README.md
|
readme: README.md
|
||||||
authors:
|
authors:
|
||||||
- dev-sec <[email protected]>
|
- dev-sec <[email protected]>
|
||||||
|
|||||||
@@ -24,6 +24,13 @@
|
|||||||
- mysql_python_package_debian is not defined
|
- mysql_python_package_debian is not defined
|
||||||
- ansible_distribution != "Ubuntu"
|
- ansible_distribution != "Ubuntu"
|
||||||
- ansible_distribution_major_version|int < 20
|
- ansible_distribution_major_version|int < 20
|
||||||
|
|
||||||
|
- name: Use Python 3 on Suse
|
||||||
|
set_fact:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
when:
|
||||||
|
- ansible_os_family == 'Suse'
|
||||||
|
|
||||||
- include_role:
|
- include_role:
|
||||||
name: mysql_hardening
|
name: mysql_hardening
|
||||||
vars:
|
vars:
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ platforms:
|
|||||||
container: docker
|
container: docker
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
options:
|
||||||
|
diff: true
|
||||||
config_options:
|
config_options:
|
||||||
defaults:
|
defaults:
|
||||||
interpreter_python: auto_silent
|
interpreter_python: auto_silent
|
||||||
|
|||||||
@@ -15,6 +15,12 @@
|
|||||||
- ansible_distribution == 'Debian'
|
- ansible_distribution == 'Debian'
|
||||||
- ansible_distribution_major_version|int >= 11
|
- ansible_distribution_major_version|int >= 11
|
||||||
|
|
||||||
|
- name: Use Python 3 on Suse
|
||||||
|
set_fact:
|
||||||
|
ansible_python_interpreter: /usr/bin/python3
|
||||||
|
when:
|
||||||
|
- ansible_os_family == 'Suse'
|
||||||
|
|
||||||
- name: Use Python 2 on Debian 10
|
- name: Use Python 2 on Debian 10
|
||||||
set_fact:
|
set_fact:
|
||||||
ansible_python_interpreter: /usr/bin/python
|
ansible_python_interpreter: /usr/bin/python
|
||||||
@@ -29,11 +35,9 @@
|
|||||||
update_cache: true
|
update_cache: true
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
- name: install required tools on SuSE
|
- name: Install required python packages on Suse
|
||||||
community.general.zypper:
|
ansible.builtin.shell: zypper -n install python-xml python3-rpm python3-PyMySQL
|
||||||
name: "python-xml"
|
when: ansible_os_family == 'Suse'
|
||||||
state: present
|
|
||||||
when: ansible_facts.os_family == 'Suse'
|
|
||||||
|
|
||||||
- name: create missing directory
|
- name: create missing directory
|
||||||
file:
|
file:
|
||||||
@@ -56,7 +60,6 @@
|
|||||||
- ansible_distribution != "Ubuntu"
|
- ansible_distribution != "Ubuntu"
|
||||||
- ansible_distribution_major_version|int < 20
|
- ansible_distribution_major_version|int < 20
|
||||||
|
|
||||||
|
|
||||||
- include_role:
|
- include_role:
|
||||||
name: dev-sec.mysql
|
name: dev-sec.mysql
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@
|
|||||||
update_cache: true
|
update_cache: true
|
||||||
when: ansible_distribution == 'Debian'
|
when: ansible_distribution == 'Debian'
|
||||||
|
|
||||||
|
- name: include tests for the service
|
||||||
|
include_tasks: verify_tasks/service.yml
|
||||||
|
|
||||||
- name: download cinc-auditor
|
- name: download cinc-auditor
|
||||||
get_url:
|
get_url:
|
||||||
url: https://omnitruck.cinc.sh/install.sh
|
url: https://omnitruck.cinc.sh/install.sh
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- name: Load variables from role to use the "mysql_daemon" variable
|
||||||
|
ansible.builtin.include_role:
|
||||||
|
name: devsec.hardening.mysql_hardening
|
||||||
|
apply:
|
||||||
|
tags:
|
||||||
|
- never
|
||||||
|
|
||||||
|
- name: Populate service facts
|
||||||
|
ansible.builtin.service_facts:
|
||||||
|
|
||||||
|
- name: Check if MySQL is running and enabled
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "ansible_facts.services[mysql_daemon + '.service'].state == 'running'"
|
||||||
|
- "ansible_facts.services[mysql_daemon + '.service'].status == 'enabled'"
|
||||||
@@ -25,6 +25,8 @@ platforms:
|
|||||||
container: docker
|
container: docker
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
options:
|
||||||
|
diff: true
|
||||||
config_options:
|
config_options:
|
||||||
defaults:
|
defaults:
|
||||||
interpreter_python: auto_silent
|
interpreter_python: auto_silent
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
vars:
|
vars:
|
||||||
os_security_users_allow: change_user
|
os_security_users_allow: change_user
|
||||||
os_security_kernel_enable_core_dump: false
|
os_security_kernel_enable_core_dump: false
|
||||||
|
os_auditd_num_logs: 10
|
||||||
os_security_suid_sgid_remove_from_unknown: true
|
os_security_suid_sgid_remove_from_unknown: true
|
||||||
os_auth_pam_passwdqc_enable: false
|
os_auth_pam_passwdqc_enable: false
|
||||||
os_auth_lockout_time: 15
|
os_auth_lockout_time: 15
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ platforms:
|
|||||||
container: docker
|
container: docker
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
options:
|
||||||
|
diff: true
|
||||||
config_options:
|
config_options:
|
||||||
defaults:
|
defaults:
|
||||||
interpreter_python: auto_silent
|
interpreter_python: auto_silent
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ platforms:
|
|||||||
cpus: 2
|
cpus: 2
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
options:
|
||||||
|
diff: true
|
||||||
env:
|
env:
|
||||||
ANSIBLE_PIPELINING: "True"
|
ANSIBLE_PIPELINING: "True"
|
||||||
config_options:
|
config_options:
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
- name: Run the equivalent of "apt-get update && apt-get upgrade"
|
- name: Run the equivalent of "apt-get update && apt-get upgrade"
|
||||||
apt:
|
apt:
|
||||||
name: "*"
|
|
||||||
state: latest
|
|
||||||
update_cache: true
|
update_cache: true
|
||||||
when: ansible_os_family == 'Debian'
|
when: ansible_os_family == 'Debian'
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ platforms:
|
|||||||
container: docker
|
container: docker
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
options:
|
||||||
|
diff: true
|
||||||
config_options:
|
config_options:
|
||||||
defaults:
|
defaults:
|
||||||
interpreter_python: auto_silent
|
interpreter_python: auto_silent
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"
|
shell: "bash /tmp/install.sh -s -- -P cinc-auditor -v 4"
|
||||||
|
|
||||||
- name: Execute cinc-auditor tests
|
- name: Execute cinc-auditor tests
|
||||||
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/ssh-baseline/archive/refs/heads/simplify_crypto.zip"
|
command: "/opt/cinc-auditor/bin/cinc-auditor exec --no-show-progress --no-color --no-distinct-exit https://github.com/dev-sec/ssh-baseline/archive/refs/heads/master.zip"
|
||||||
register: test_results
|
register: test_results
|
||||||
changed_when: false
|
changed_when: false
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ platforms:
|
|||||||
container: docker
|
container: docker
|
||||||
provisioner:
|
provisioner:
|
||||||
name: ansible
|
name: ansible
|
||||||
|
options:
|
||||||
|
diff: true
|
||||||
config_options:
|
config_options:
|
||||||
defaults:
|
defaults:
|
||||||
interpreter_python: auto_silent
|
interpreter_python: auto_silent
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ It configures:
|
|||||||
|
|
||||||
- Ansible 2.9.0
|
- Ansible 2.9.0
|
||||||
- An existing MySQL installation
|
- An existing MySQL installation
|
||||||
|
- python-jmespath on the ansible host
|
||||||
|
|
||||||
### Example playbook
|
### Example playbook
|
||||||
|
|
||||||
|
|||||||
@@ -59,12 +59,14 @@
|
|||||||
- mysql_version.version.full is version('8.0.3', '>=')
|
- mysql_version.version.full is version('8.0.3', '>=')
|
||||||
- mysql_distribution == "mysql"
|
- mysql_distribution == "mysql"
|
||||||
|
|
||||||
- include: configure.yml
|
- name: Include tasks for configuration
|
||||||
|
import_tasks: configure.yml
|
||||||
when: mysql_hardening_enabled | bool
|
when: mysql_hardening_enabled | bool
|
||||||
tags:
|
tags:
|
||||||
- mysql_hardening
|
- mysql_hardening
|
||||||
|
|
||||||
- include: mysql_secure_installation.yml
|
- name: Include tasks to secure mysql installation
|
||||||
|
import_tasks: mysql_secure_installation.yml
|
||||||
when: mysql_hardening_enabled | bool
|
when: mysql_hardening_enabled | bool
|
||||||
tags:
|
tags:
|
||||||
- mysql_hardening
|
- mysql_hardening
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
msg: 'ERROR - you have to change default mysql_root_password'
|
msg: 'ERROR - you have to change default mysql_root_password'
|
||||||
when: mysql_root_password == '-----====>SetR00tPa$$wordH3r3!!!<====-----'
|
when: mysql_root_password == '-----====>SetR00tPa$$wordH3r3!!!<====-----'
|
||||||
|
|
||||||
- name: ensure that the root password is present
|
- name: Ensure that the root password is present
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: 'root'
|
name: 'root'
|
||||||
host_all: true
|
host_all: true
|
||||||
@@ -19,14 +19,14 @@
|
|||||||
mode: '0400'
|
mode: '0400'
|
||||||
tags: my_cnf
|
tags: my_cnf
|
||||||
|
|
||||||
- name: ensure that the test database is absent
|
- name: Ensure that the test database is absent
|
||||||
community.mysql.mysql_db:
|
community.mysql.mysql_db:
|
||||||
name: test
|
name: test
|
||||||
state: absent
|
state: absent
|
||||||
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
||||||
when: mysql_remove_test_database
|
when: mysql_remove_test_database
|
||||||
|
|
||||||
- name: ensure that anonymous users are absent
|
- name: Ensure that anonymous users are absent
|
||||||
community.mysql.mysql_user:
|
community.mysql.mysql_user:
|
||||||
name: ''
|
name: ''
|
||||||
state: absent
|
state: absent
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
||||||
when: mysql_remove_anonymous_users
|
when: mysql_remove_anonymous_users
|
||||||
|
|
||||||
- name: ensure that root can only login from localhost
|
- name: Ensure that root can only login from localhost
|
||||||
community.mysql.mysql_query:
|
community.mysql.mysql_query:
|
||||||
query:
|
query:
|
||||||
- DELETE
|
- DELETE
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
login_unix_socket: "{{ login_unix_socket | default(omit) }}"
|
||||||
when: mysql_remove_remote_root
|
when: mysql_remove_remote_root
|
||||||
|
|
||||||
- name: get all users that have no authentication_string on MySQL version >= 5.7.6 or Mariadb version >= 10.4.0
|
- name: Get all users that have no authentication_string on MySQL version >= 5.7.6 or Mariadb version >= 10.4.0
|
||||||
community.mysql.mysql_query:
|
community.mysql.mysql_query:
|
||||||
query:
|
query:
|
||||||
- SELECT GROUP_CONCAT(QUOTE(USER), '@', QUOTE(HOST) SEPARATOR ', ') AS users
|
- SELECT GROUP_CONCAT(QUOTE(USER), '@', QUOTE(HOST) SEPARATOR ', ') AS users
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
- (mysql_distribution == "mysql" and mysql_version.version.full is version('5.7.6', '>=')) or
|
- (mysql_distribution == "mysql" and mysql_version.version.full is version('5.7.6', '>=')) or
|
||||||
(mysql_distribution == "mariadb" and mysql_version.version.full is version('10.4.0', '>='))
|
(mysql_distribution == "mariadb" and mysql_version.version.full is version('10.4.0', '>='))
|
||||||
|
|
||||||
- name: get all users that have no password or authentication_string on MySQL version < 5.7.6 or Mariadb version < 10.4.0
|
- name: Get all users that have no password or authentication_string on MySQL version < 5.7.6 or Mariadb version < 10.4.0
|
||||||
community.mysql.mysql_query:
|
community.mysql.mysql_query:
|
||||||
query:
|
query:
|
||||||
- SELECT GROUP_CONCAT(QUOTE(USER), '@', QUOTE(HOST) SEPARATOR ', ') AS users
|
- SELECT GROUP_CONCAT(QUOTE(USER), '@', QUOTE(HOST) SEPARATOR ', ') AS users
|
||||||
@@ -80,21 +80,21 @@
|
|||||||
- (mysql_distribution == "mysql" and mysql_version.version.full is version('5.7.6', '<')) or
|
- (mysql_distribution == "mysql" and mysql_version.version.full is version('5.7.6', '<')) or
|
||||||
(mysql_distribution == "mariadb" and mysql_version.version.full is version('10.4.0', '<'))
|
(mysql_distribution == "mariadb" and mysql_version.version.full is version('10.4.0', '<'))
|
||||||
|
|
||||||
- name: create a fact for users without password or authentication_string
|
- name: Create a fact for users without password or authentication_string
|
||||||
set_fact:
|
set_fact:
|
||||||
users_wo_auth: "{{ mysql_users_wo_passwords_or_auth_string.query_result.0.0 | community.general.json_query('users') }}"
|
users_wo_auth: "{{ mysql_users_wo_passwords_or_auth_string.query_result.0.0 | community.general.json_query('users') }}"
|
||||||
when:
|
when:
|
||||||
- mysql_users_wo_passwords_or_auth_string.query_result is defined
|
- mysql_users_wo_passwords_or_auth_string.query_result is defined
|
||||||
- mysql_users_wo_passwords_or_auth_string.query_result != "" # noqa empty-string-compare
|
- mysql_users_wo_passwords_or_auth_string.query_result != "" # noqa empty-string-compare
|
||||||
|
|
||||||
- name: create a fact for users without password
|
- name: Create a fact for users without password
|
||||||
set_fact:
|
set_fact:
|
||||||
users_wo_auth: "{{ mysql_users_wo_passwords.query_result.0.0 | community.general.json_query('users') }}"
|
users_wo_auth: "{{ mysql_users_wo_passwords.query_result.0.0 | community.general.json_query('users') }}"
|
||||||
when:
|
when:
|
||||||
- mysql_users_wo_passwords.query_result is defined
|
- mysql_users_wo_passwords.query_result is defined
|
||||||
- mysql_users_wo_passwords.query_result != "" # noqa empty-string-compare
|
- mysql_users_wo_passwords.query_result != "" # noqa empty-string-compare
|
||||||
|
|
||||||
- name: ensure that there are no users without password or authentication_string
|
- name: Ensure that there are no users without password or authentication_string
|
||||||
community.mysql.mysql_query:
|
community.mysql.mysql_query:
|
||||||
query:
|
query:
|
||||||
- "DROP USER {{ users_wo_auth }}"
|
- "DROP USER {{ users_wo_auth }}"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
mysql_daemon: mysql
|
mysql_daemon: mariadb
|
||||||
|
|
||||||
mysql_hardening_mysql_conf_file: '/etc/mysql/my.cnf'
|
mysql_hardening_mysql_conf_file: '/etc/mysql/my.cnf'
|
||||||
mysql_hardening_mysql_confd_dir: '/etc/mysql/conf.d'
|
mysql_hardening_mysql_confd_dir: '/etc/mysql/conf.d'
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
mysql_daemon: mariadb
|
||||||
|
mysql_hardening_mysql_conf_file: '/etc/my.cnf'
|
||||||
|
mysql_hardening_mysql_confd_dir: '/etc/my.cnf.d'
|
||||||
|
|
||||||
|
mysql_cnf_owner: 'root' # owner of /etc/my.cnf.d/*.cnf files
|
||||||
|
mysql_cnf_group: 'mysql' # owner of /etc/my.cnf.d/*.cnf files
|
||||||
|
|
||||||
|
mysql_hardening_group: 'mysql'
|
||||||
|
login_unix_socket: '/run/mysql/mysql.sock'
|
||||||
@@ -218,6 +218,9 @@ We know that this is the case on Raspberry Pi.
|
|||||||
- `os_auditd_max_log_file`
|
- `os_auditd_max_log_file`
|
||||||
- Default: `6`
|
- Default: `6`
|
||||||
- Description: This keyword specifies the maximum file size in megabytes. When this limit is reached, it will trigger a configurable action. The value given must be numeric.
|
- Description: This keyword specifies the maximum file size in megabytes. When this limit is reached, it will trigger a configurable action. The value given must be numeric.
|
||||||
|
- `os_auditd_num_logs`
|
||||||
|
- Default: `5`
|
||||||
|
- Description: This keyword specifies the number of log files to keep if `rotate` is given as the max_log_file_action. The value given must be numeric.
|
||||||
- `hidepid_option`
|
- `hidepid_option`
|
||||||
- Default: `2` (on RHEL/CentOS7 `0`, see known limitations)
|
- Default: `2` (on RHEL/CentOS7 `0`, see known limitations)
|
||||||
- Description: `0`: This is the default setting and gives you the default behaviour. `1`: With this option an normal user would not see other processes but their own about ps, top etc, but he is still able to see process IDs in /proc. `2`: Users are only able too see their own processes (like with hidepid=1), but also the other process IDs are hidden for them in /proc.
|
- Description: `0`: This is the default setting and gives you the default behaviour. `1`: With this option an normal user would not see other processes but their own about ps, top etc, but he is still able to see process IDs in /proc. `2`: Users are only able too see their own processes (like with hidepid=1), but also the other process IDs are hidden for them in /proc.
|
||||||
@@ -230,6 +233,15 @@ We know that this is the case on Raspberry Pi.
|
|||||||
- `os_ignore_home_folder_users`
|
- `os_ignore_home_folder_users`
|
||||||
- Default: `lost+found`
|
- Default: `lost+found`
|
||||||
- Description: specify user home folders in `/home` that shouldn't be chmodded to 700
|
- Description: specify user home folders in `/home` that shouldn't be chmodded to 700
|
||||||
|
- `os_chmod_rootuser_home_folder`
|
||||||
|
- Default: `true`
|
||||||
|
- Description: Set to `false` to disable "chmod 700" of root's home folder
|
||||||
|
- `os_rootuser_pw_ageing`
|
||||||
|
- Default: `false`
|
||||||
|
- Description: Set to true to enforce password age settings for root user(s)
|
||||||
|
- `os_remove_additional_root_users`
|
||||||
|
- Default: `false`
|
||||||
|
- Description: When enabled and there are multiple users with UID=0, only "root" will be kept. Others will be deleted.
|
||||||
- `os_cron_enabled`
|
- `os_cron_enabled`
|
||||||
- Default: `true`
|
- Default: `true`
|
||||||
- Description: Set to false to disable installing and configuring cron.
|
- Description: Set to false to disable installing and configuring cron.
|
||||||
@@ -241,7 +253,7 @@ We know that this is the case on Raspberry Pi.
|
|||||||
- Description: Set to false to disable installing and configuring limits.
|
- Description: Set to false to disable installing and configuring limits.
|
||||||
- `os_login_defs_enabled`
|
- `os_login_defs_enabled`
|
||||||
- Default: `true`
|
- Default: `true`
|
||||||
- Description: Set to false to disable installing and configuring login_defs.
|
- Description: Set to false to disable installing and configuring login_defs for newly created users.
|
||||||
- `os_minimize_access_enabled`
|
- `os_minimize_access_enabled`
|
||||||
- Default: `true`
|
- Default: `true`
|
||||||
- Description: Set to false to disable installing and configuring minimize_access.
|
- Description: Set to false to disable installing and configuring minimize_access.
|
||||||
@@ -287,6 +299,30 @@ We know that this is the case on Raspberry Pi.
|
|||||||
- `os_sha_crypt_max_rounds`
|
- `os_sha_crypt_max_rounds`
|
||||||
- Default: `640000`
|
- Default: `640000`
|
||||||
- Description: Define the number of maximum SHA rounds. With a lot of rounds brute forcing the password is more difficult. But note also that it more CPU resources will be needed to authenticate users. The values must be inside the 1000-999999999 range.
|
- Description: Define the number of maximum SHA rounds. With a lot of rounds brute forcing the password is more difficult. But note also that it more CPU resources will be needed to authenticate users. The values must be inside the 1000-999999999 range.
|
||||||
|
- `os_auditd_enabled`
|
||||||
|
- Default: `true`
|
||||||
|
- Description: Set to false to disable installing and configuring `auditd`.
|
||||||
|
- `os_auditd_flush`
|
||||||
|
- Default: `INCREMENTAL`
|
||||||
|
- Description: Valid values are none, incremental, incremental_async, data, and sync.
|
||||||
|
- `os_auditd_max_log_file`
|
||||||
|
- Default: 6
|
||||||
|
- Description: This keyword specifies the maximum file size in megabytes. When this limit is reached, it will trigger a configurable action.
|
||||||
|
- `os_auditd_max_log_file_action`
|
||||||
|
- Default: `keep_logs`
|
||||||
|
- Description: This parameter tells the system what action to take when the system has detected that the max file size limit has been reached. Valid values are ignore, syslog, suspend, rotate and keep_logs.
|
||||||
|
- `os_auditd_admin_space_left`
|
||||||
|
- Default: 50
|
||||||
|
- Description: This is a numeric value in megabytes that tells the audit daemon when to perform a configurable action because the system is running low on disk space.
|
||||||
|
- `os_auditd_space_left`
|
||||||
|
- Default: 75
|
||||||
|
- Description: If the free space in the filesystem containing log_file drops below this value, the audit daemon takes the action specified by space_left_action.
|
||||||
|
- `os_auditd_space_left_action`
|
||||||
|
- Default: SYSLOG
|
||||||
|
- Description: This parameter tells the system what action to take when the system has detected that it is starting to get low on disk space.
|
||||||
|
- `os_auditd_log_format`
|
||||||
|
- Default: `RAW`
|
||||||
|
- Description: The log format describes how the information should be stored on disk. There are 2 options: raw and enriched. If set to `RAW`, the audit records will be stored in a format exactly as the kernel sends it. The `ENRICHED` option will resolve all uid, gid, syscall, architecture, and socket address information before writing the event to disk. This aids in making sense of events created on one system but reported/analyzed on another system.
|
||||||
- `os_mnt_boot_dir_mode`
|
- `os_mnt_boot_dir_mode`
|
||||||
- Default: `0700`
|
- Default: `0700`
|
||||||
- Description: Set default perimissions for /boot
|
- Description: Set default perimissions for /boot
|
||||||
|
|||||||
@@ -15,13 +15,21 @@ os_auth_root_ttys: [console, tty1, tty2, tty3, tty4, tty5, tty6]
|
|||||||
|
|
||||||
os_chfn_restrict: ''
|
os_chfn_restrict: ''
|
||||||
|
|
||||||
# Set to false to disable chmod /home folders to 700
|
# Set to false to disable chmod userhome folders to 700
|
||||||
|
os_chmod_rootuser_home_folder: true
|
||||||
os_chmod_home_folders: true
|
os_chmod_home_folders: true
|
||||||
|
|
||||||
# May contain: change_user
|
# May contain: change_user
|
||||||
os_security_users_allow: []
|
os_security_users_allow: []
|
||||||
# Specify user home folders in /home that shouldn't be chmodded to 700
|
# Specify user home folders in /home that shouldn't be chmodded to 700
|
||||||
os_ignore_home_folder_users: ['lost+found']
|
os_ignore_home_folder_users: ['lost+found']
|
||||||
|
|
||||||
|
# Set to false to disable password age enforcement on existing users
|
||||||
|
os_rootuser_pw_ageing: false
|
||||||
|
|
||||||
|
# When enabled and there are multiple users with UID=0, only "root" will be kept. Others will be deleted.
|
||||||
|
os_remove_additional_root_users: false
|
||||||
|
|
||||||
# Specify system accounts whose login should not be disabled and password not changed
|
# Specify system accounts whose login should not be disabled and password not changed
|
||||||
os_ignore_users: ['vagrant', 'kitchen']
|
os_ignore_users: ['vagrant', 'kitchen']
|
||||||
os_security_kernel_enable_module_loading: true
|
os_security_kernel_enable_module_loading: true
|
||||||
@@ -253,6 +261,7 @@ sysctl_config:
|
|||||||
|
|
||||||
# Disable acceptance of IPv6 router solicitations messages | sysctl-21
|
# Disable acceptance of IPv6 router solicitations messages | sysctl-21
|
||||||
net.ipv6.conf.default.router_solicitations: 0
|
net.ipv6.conf.default.router_solicitations: 0
|
||||||
|
net.ipv6.conf.all.router_solicitations: 0
|
||||||
|
|
||||||
# Disable Accept Router Preference from router advertisement | sysctl-22
|
# Disable Accept Router Preference from router advertisement | sysctl-22
|
||||||
net.ipv6.conf.default.accept_ra_rtr_pref: 0
|
net.ipv6.conf.default.accept_ra_rtr_pref: 0
|
||||||
@@ -265,6 +274,7 @@ sysctl_config:
|
|||||||
|
|
||||||
# Disable IPv6 autoconfiguration | sysctl-26
|
# Disable IPv6 autoconfiguration | sysctl-26
|
||||||
net.ipv6.conf.default.autoconf: 0
|
net.ipv6.conf.default.autoconf: 0
|
||||||
|
net.ipv6.conf.all.autoconf: 0
|
||||||
|
|
||||||
# Disable neighbor solicitations to send out per address | sysctl-27
|
# Disable neighbor solicitations to send out per address | sysctl-27
|
||||||
net.ipv6.conf.default.dad_transmits: 0
|
net.ipv6.conf.default.dad_transmits: 0
|
||||||
@@ -318,8 +328,18 @@ os_hardening_enabled: true
|
|||||||
|
|
||||||
# Set to false to disable installing and configuring auditd.
|
# Set to false to disable installing and configuring auditd.
|
||||||
os_auditd_enabled: true
|
os_auditd_enabled: true
|
||||||
|
os_auditd_flush: INCREMENTAL
|
||||||
os_auditd_max_log_file: 6
|
os_auditd_max_log_file: 6
|
||||||
os_auditd_max_log_file_action: keep_logs
|
os_auditd_max_log_file_action: keep_logs
|
||||||
|
os_auditd_log_format: RAW
|
||||||
|
os_auditd_admin_space_left: 50
|
||||||
|
os_auditd_space_left: 75
|
||||||
|
os_auditd_space_left_action: SYSLOG
|
||||||
|
os_auditd_admin_space_left_action: SUSPEND
|
||||||
|
os_auditd_disk_full_action: SUSPEND
|
||||||
|
os_auditd_disk_error_action: SUSPEND
|
||||||
|
os_auditd_log_group: root
|
||||||
|
os_auditd_num_logs: 5
|
||||||
|
|
||||||
# Set the SELinux state, which can be either disabled, permissive, or enforcing.
|
# Set the SELinux state, which can be either disabled, permissive, or enforcing.
|
||||||
os_selinux_state: enforcing
|
os_selinux_state: enforcing
|
||||||
@@ -338,7 +358,7 @@ os_ctrlaltdel_disabled: false
|
|||||||
# Set to false to disable installing and configuring limits.
|
# Set to false to disable installing and configuring limits.
|
||||||
os_limits_enabled: true
|
os_limits_enabled: true
|
||||||
|
|
||||||
# Set to false to disable installing and configuring login_defs.
|
# Set to false to disable installing and configuring login_defs for newly created users.
|
||||||
os_login_defs_enabled: true
|
os_login_defs_enabled: true
|
||||||
|
|
||||||
# Set to false to disable installing and configuring minimize_access.
|
# Set to false to disable installing and configuring minimize_access.
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
---
|
---
|
||||||
- name: Update-initramfs
|
- name: Update-initramfs
|
||||||
command: 'update-initramfs -u'
|
ansible.builtin.command: 'update-initramfs -u'
|
||||||
|
|
||||||
- name: restart-auditd
|
- name: Restart auditd
|
||||||
command:
|
ansible.builtin.command:
|
||||||
cmd: 'service auditd restart' # rhel: see: https://access.redhat.com/solutions/2664811
|
cmd: 'service auditd restart' # rhel: see: https://access.redhat.com/solutions/2664811
|
||||||
warn: false # sadly 'service' module fails in that case also by using 'use: service'
|
|
||||||
when: molecule_yml is not defined # restarting auditd in a container does not work
|
when: molecule_yml is not defined # restarting auditd in a container does not work
|
||||||
|
|
||||||
- name: Reload systemd
|
- name: Reload systemd
|
||||||
systemd:
|
ansible.builtin.systemd:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Remount filesystems
|
- name: Remount filesystems
|
||||||
mount:
|
ansible.posix.mount:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: remounted
|
state: remounted
|
||||||
loop: "{{ mountpoints_changed }}"
|
loop: "{{ mountpoints_changed }}"
|
||||||
@@ -12,5 +12,5 @@
|
|||||||
owner: 'root'
|
owner: 'root'
|
||||||
group: 'root'
|
group: 'root'
|
||||||
mode: '0640'
|
mode: '0640'
|
||||||
notify: 'restart-auditd'
|
notify: Restart auditd
|
||||||
tags: auditd
|
tags: auditd
|
||||||
@@ -22,79 +22,97 @@
|
|||||||
with_dict: '{{ os_vars }}'
|
with_dict: '{{ os_vars }}'
|
||||||
tags: always
|
tags: always
|
||||||
|
|
||||||
- import_tasks: auditd.yml
|
- name: Import tasks for auditd
|
||||||
|
import_tasks: auditd.yml
|
||||||
tags: auditd
|
tags: auditd
|
||||||
when: os_auditd_enabled | bool
|
when: os_auditd_enabled | bool
|
||||||
|
|
||||||
- import_tasks: cron.yml
|
- name: Import tasks for cron
|
||||||
|
import_tasks: cron.yml
|
||||||
tags: cron
|
tags: cron
|
||||||
when: os_cron_enabled | bool
|
when: os_cron_enabled | bool
|
||||||
|
|
||||||
- import_tasks: ctrlaltdel.yml
|
- name: Import tasks to configure ctrl+alt+del
|
||||||
|
import_tasks: ctrlaltdel.yml
|
||||||
tags: ctrlaltdel
|
tags: ctrlaltdel
|
||||||
when: os_ctrlaltdel_disabled | bool
|
when: os_ctrlaltdel_disabled | bool
|
||||||
|
|
||||||
- import_tasks: limits.yml
|
- name: Import tasks to configure limits
|
||||||
|
import_tasks: limits.yml
|
||||||
tags: limits
|
tags: limits
|
||||||
when: os_limits_enabled | bool
|
when: os_limits_enabled | bool
|
||||||
|
|
||||||
- import_tasks: login_defs.yml
|
- name: Import tasks to configure login_defs
|
||||||
|
import_tasks: login_defs.yml
|
||||||
tags: login_defs
|
tags: login_defs
|
||||||
when: os_login_defs_enabled | bool
|
when: os_login_defs_enabled | bool
|
||||||
|
|
||||||
- import_tasks: minimize_access.yml
|
- name: Import tasks to minimize access permissions
|
||||||
|
import_tasks: minimize_access.yml
|
||||||
tags: minimize_access
|
tags: minimize_access
|
||||||
when: os_minimize_access_enabled | bool
|
when: os_minimize_access_enabled | bool
|
||||||
|
|
||||||
- import_tasks: pam.yml
|
- name: Import tasks to configure PAM
|
||||||
|
import_tasks: pam.yml
|
||||||
tags: pam
|
tags: pam
|
||||||
when: os_pam_enabled | bool
|
when: os_pam_enabled | bool
|
||||||
|
|
||||||
- import_tasks: modprobe.yml
|
- name: Import tasks to configure modules
|
||||||
|
import_tasks: modprobe.yml
|
||||||
tags: modprobe
|
tags: modprobe
|
||||||
when: os_modprobe_enabled | bool
|
when: os_modprobe_enabled | bool
|
||||||
|
|
||||||
- import_tasks: profile.yml
|
- name: Import tasks to configure profile
|
||||||
|
import_tasks: profile.yml
|
||||||
tags: profile
|
tags: profile
|
||||||
when: os_profile_enabled | bool
|
when: os_profile_enabled | bool
|
||||||
|
|
||||||
- import_tasks: securetty.yml
|
- name: Import tasks to configure securetty
|
||||||
|
import_tasks: securetty.yml
|
||||||
tags: securetty
|
tags: securetty
|
||||||
when: os_securetty_enabled | bool
|
when: os_securetty_enabled | bool
|
||||||
|
|
||||||
- import_tasks: suid_sgid.yml
|
- name: Import tasks to set suid and sgid
|
||||||
|
import_tasks: suid_sgid.yml
|
||||||
when: os_security_suid_sgid_enforce | bool
|
when: os_security_suid_sgid_enforce | bool
|
||||||
tags: suid_sgid
|
tags: suid_sgid
|
||||||
|
|
||||||
- import_tasks: sysctl.yml
|
- name: Import tasks to configure sysctl
|
||||||
|
import_tasks: sysctl.yml
|
||||||
tags: sysctl
|
tags: sysctl
|
||||||
when: os_sysctl_enabled | bool
|
when: os_sysctl_enabled | bool
|
||||||
|
|
||||||
- import_tasks: user_accounts.yml
|
- name: Import tasks to harden user accounts
|
||||||
|
import_tasks: user_accounts.yml
|
||||||
tags: user_accounts
|
tags: user_accounts
|
||||||
when: os_user_accounts_enabled | bool
|
when: os_user_accounts_enabled | bool
|
||||||
|
|
||||||
- import_tasks: rhosts.yml
|
- name: Import tasks to configure rhosts
|
||||||
|
import_tasks: rhosts.yml
|
||||||
tags: rhosts
|
tags: rhosts
|
||||||
when: os_rhosts_enabled | bool
|
when: os_rhosts_enabled | bool
|
||||||
|
|
||||||
- import_tasks: netrc.yml
|
- name: Import tasks to configure netrc
|
||||||
|
import_tasks: netrc.yml
|
||||||
tags: netrc
|
tags: netrc
|
||||||
when: os_netrc_enabled | bool
|
when: os_netrc_enabled | bool
|
||||||
|
|
||||||
- import_tasks: yum.yml
|
- name: Import tasks to configure yum
|
||||||
|
import_tasks: yum.yml
|
||||||
tags: yum
|
tags: yum
|
||||||
when:
|
when:
|
||||||
- ansible_facts.os_family == 'RedHat'
|
- ansible_facts.os_family == 'RedHat'
|
||||||
- os_yum_enabled | bool
|
- os_yum_enabled | bool
|
||||||
|
|
||||||
- import_tasks: apt.yml
|
- name: Import tasks to configure apt
|
||||||
|
import_tasks: apt.yml
|
||||||
tags: apt
|
tags: apt
|
||||||
when:
|
when:
|
||||||
- ansible_facts.os_family == 'Debian'
|
- ansible_facts.os_family == 'Debian'
|
||||||
- os_apt_enabled | bool
|
- os_apt_enabled | bool
|
||||||
|
|
||||||
- import_tasks: selinux.yml
|
- name: Import tasks to configure selinux
|
||||||
|
import_tasks: selinux.yml
|
||||||
tags: selinux
|
tags: selinux
|
||||||
when:
|
when:
|
||||||
- ansible_facts.selinux.status == 'enabled'
|
- ansible_facts.selinux.status == 'enabled'
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: disable coredumps
|
- name: Disable coredumps
|
||||||
|
when: not os_security_kernel_enable_core_dump | bool
|
||||||
block:
|
block:
|
||||||
- name: Create limits.d-directory if it does not exist | sysctl-31a, sysctl-31b
|
- name: Create limits.d-directory if it does not exist | sysctl-31a, sysctl-31b
|
||||||
file:
|
file:
|
||||||
@@ -28,7 +29,7 @@
|
|||||||
modification_time: preserve
|
modification_time: preserve
|
||||||
access_time: preserve
|
access_time: preserve
|
||||||
|
|
||||||
- name: create coredump.conf.d-directory if it does not exist
|
- name: Create coredump.conf.d-directory if it does not exist
|
||||||
file:
|
file:
|
||||||
path: '/etc/systemd/coredump.conf.d'
|
path: '/etc/systemd/coredump.conf.d'
|
||||||
owner: root
|
owner: root
|
||||||
@@ -37,7 +38,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
when: ansible_service_mgr == "systemd"
|
when: ansible_service_mgr == "systemd"
|
||||||
|
|
||||||
- name: create custom.conf for disabling coredumps
|
- name: Create custom.conf for disabling coredumps
|
||||||
template:
|
template:
|
||||||
src: 'etc/systemd/coredump.conf.d/coredumps.conf.j2'
|
src: 'etc/systemd/coredump.conf.d/coredumps.conf.j2'
|
||||||
dest: '/etc/systemd/coredump.conf.d/custom.conf'
|
dest: '/etc/systemd/coredump.conf.d/custom.conf'
|
||||||
@@ -47,9 +48,8 @@
|
|||||||
when: ansible_service_mgr == "systemd"
|
when: ansible_service_mgr == "systemd"
|
||||||
notify: Reload systemd
|
notify: Reload systemd
|
||||||
|
|
||||||
when: not os_security_kernel_enable_core_dump | bool
|
- name: Enable coredumps
|
||||||
|
when: os_security_kernel_enable_core_dump | bool
|
||||||
- name: enable coredumps
|
|
||||||
block:
|
block:
|
||||||
- name: Remove coredump.conf.d directory with files
|
- name: Remove coredump.conf.d directory with files
|
||||||
file:
|
file:
|
||||||
@@ -62,4 +62,3 @@
|
|||||||
file:
|
file:
|
||||||
path: /etc/security/limits.d/10.hardcore.conf
|
path: /etc/security/limits.d/10.hardcore.conf
|
||||||
state: absent
|
state: absent
|
||||||
when: os_security_kernel_enable_core_dump | bool
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: hardening.yml
|
- name: Include hardening tasks
|
||||||
|
include_tasks: hardening.yml
|
||||||
when: os_hardening_enabled | bool
|
when: os_hardening_enabled | bool
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
@@ -17,11 +17,13 @@
|
|||||||
when:
|
when:
|
||||||
- ansible_facts.os_family != 'Archlinux'
|
- ansible_facts.os_family != 'Archlinux'
|
||||||
|
|
||||||
- import_tasks: pam_debian.yml
|
- name: Import tasks for Debian PAM
|
||||||
|
import_tasks: pam_debian.yml
|
||||||
when:
|
when:
|
||||||
- ansible_facts.os_family == 'Debian'
|
- ansible_facts.os_family == 'Debian'
|
||||||
|
|
||||||
- import_tasks: pam_rhel.yml
|
- name: Import tasks for RedHat PAM
|
||||||
|
import_tasks: pam_rhel.yml
|
||||||
when:
|
when:
|
||||||
- ansible_facts.os_family == 'RedHat'
|
- ansible_facts.os_family == 'RedHat'
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,12 @@
|
|||||||
name: 'libpam-modules'
|
name: 'libpam-modules'
|
||||||
state: 'present'
|
state: 'present'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries > 0
|
- os_auth_retries|int > 0
|
||||||
|
|
||||||
- name: Manage tally on Debian stable
|
- name: Manage tally on Debian stable
|
||||||
|
when:
|
||||||
|
- "'libpam-modules' in ansible_facts.packages"
|
||||||
|
- "ansible_facts.packages['libpam-modules'][0].version is version('1.4.0', '<')"
|
||||||
block:
|
block:
|
||||||
- name: Configure tally2
|
- name: Configure tally2
|
||||||
template:
|
template:
|
||||||
@@ -34,26 +37,26 @@
|
|||||||
owner: 'root'
|
owner: 'root'
|
||||||
group: 'root'
|
group: 'root'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries > 0
|
- os_auth_retries|int > 0
|
||||||
|
|
||||||
- name: Delete tally2 when retries is 0
|
- name: Delete tally2 when retries is 0
|
||||||
file:
|
file:
|
||||||
path: '{{ tally2_path }}'
|
path: '{{ tally2_path }}'
|
||||||
state: 'absent'
|
state: 'absent'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries == 0
|
- os_auth_retries|int == 0
|
||||||
when:
|
|
||||||
- "'libpam-modules' in ansible_facts.packages"
|
|
||||||
- "ansible_facts.packages['libpam-modules'][0].version is version('1.4.0', '<')"
|
|
||||||
|
|
||||||
- name: Manage tally/faillock on Debian unstable
|
- name: Manage tally/faillock on Debian unstable
|
||||||
|
when:
|
||||||
|
- "'libpam-modules' in ansible_facts.packages"
|
||||||
|
- "ansible_facts.packages['libpam-modules'][0].version is version('1.4.0', '>=')"
|
||||||
block:
|
block:
|
||||||
- name: Delete tally2
|
- name: Delete tally2
|
||||||
file:
|
file:
|
||||||
path: '{{ tally2_path }}'
|
path: '{{ tally2_path }}'
|
||||||
state: 'absent'
|
state: 'absent'
|
||||||
|
|
||||||
- name: create tally directory
|
- name: Create tally directory
|
||||||
file:
|
file:
|
||||||
path: '/var/run/faillock'
|
path: '/var/run/faillock'
|
||||||
state: 'directory'
|
state: 'directory'
|
||||||
@@ -77,7 +80,7 @@
|
|||||||
owner: 'root'
|
owner: 'root'
|
||||||
group: 'root'
|
group: 'root'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries > 0
|
- os_auth_retries|int > 0
|
||||||
|
|
||||||
- name: Configure faillock pam authfail
|
- name: Configure faillock pam authfail
|
||||||
template:
|
template:
|
||||||
@@ -87,24 +90,21 @@
|
|||||||
owner: 'root'
|
owner: 'root'
|
||||||
group: 'root'
|
group: 'root'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries > 0
|
- os_auth_retries|int > 0
|
||||||
|
|
||||||
- name: Delete faillock when retries is 0
|
- name: Delete faillock when retries is 0
|
||||||
file:
|
file:
|
||||||
path: '/usr/share/pam-configs/faillock'
|
path: '/usr/share/pam-configs/faillock'
|
||||||
state: 'absent'
|
state: 'absent'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries == 0
|
- os_auth_retries|int == 0
|
||||||
|
|
||||||
- name: Delete faillock authfail when retries is 0
|
- name: Delete faillock authfail when retries is 0
|
||||||
file:
|
file:
|
||||||
path: '/usr/share/pam-configs/faillock_authfail'
|
path: '/usr/share/pam-configs/faillock_authfail'
|
||||||
state: 'absent'
|
state: 'absent'
|
||||||
when:
|
when:
|
||||||
- os_auth_retries == 0
|
- os_auth_retries|int == 0
|
||||||
when:
|
|
||||||
- "'libpam-modules' in ansible_facts.packages"
|
|
||||||
- "ansible_facts.packages['libpam-modules'][0].version is version('1.4.0', '>=')"
|
|
||||||
|
|
||||||
- name: Update pam on Debian systems
|
- name: Update pam on Debian systems
|
||||||
command: 'pam-auth-update --package'
|
command: 'pam-auth-update --package'
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
register: initramfs
|
register: initramfs
|
||||||
|
|
||||||
- name: Change sysctls
|
- name: Change sysctls
|
||||||
|
when: ansible_virtualization_type not in ['docker', 'lxc', 'openvz']
|
||||||
block:
|
block:
|
||||||
- name: Create a combined sysctl-dict if os-dependent sysctls are defined
|
- name: Create a combined sysctl-dict if os-dependent sysctls are defined
|
||||||
set_fact:
|
set_fact:
|
||||||
@@ -69,7 +70,6 @@
|
|||||||
ignoreerrors: true
|
ignoreerrors: true
|
||||||
with_dict: '{{ sysctl_config }}'
|
with_dict: '{{ sysctl_config }}'
|
||||||
when: item.key not in sysctl_unsupported_entries | default()
|
when: item.key not in sysctl_unsupported_entries | default()
|
||||||
when: ansible_virtualization_type not in ['docker', 'lxc', 'openvz']
|
|
||||||
|
|
||||||
- name: Apply ufw defaults
|
- name: Apply ufw defaults
|
||||||
template:
|
template:
|
||||||
|
|||||||
@@ -1,4 +1,45 @@
|
|||||||
---
|
---
|
||||||
|
- name: Read local linux user database
|
||||||
|
getent:
|
||||||
|
database: passwd
|
||||||
|
# creates a dict for each user containing UID/HOMEDIR etc...
|
||||||
|
when: getent_passwd is undefined # skip this task if "getent" has run before
|
||||||
|
|
||||||
|
- name: Extract root account(s) from local user database
|
||||||
|
loop: "{{ getent_passwd.keys() | list }}"
|
||||||
|
when:
|
||||||
|
- getent_passwd[item][1]|int == 0
|
||||||
|
set_fact:
|
||||||
|
root_users: "{{ root_users | default([]) + [item] }}"
|
||||||
|
|
||||||
|
- name: Set ownership of root user home directory(s) to 0700
|
||||||
|
file:
|
||||||
|
mode: 0700
|
||||||
|
owner: "{{ item }}"
|
||||||
|
path: "{{ getent_passwd[item][4] }}"
|
||||||
|
state: directory
|
||||||
|
loop: "{{ root_users }}"
|
||||||
|
when:
|
||||||
|
- os_chmod_rootuser_home_folder | bool
|
||||||
|
|
||||||
|
- name: Set password ageing for root user(s)
|
||||||
|
user:
|
||||||
|
name: "{{ item }}"
|
||||||
|
password_expire_min: "{{ os_auth_pw_min_age }}"
|
||||||
|
password_expire_max: "{{ os_auth_pw_max_age }}"
|
||||||
|
loop: "{{ root_users }}"
|
||||||
|
when: os_rootuser_pw_ageing|bool
|
||||||
|
|
||||||
|
- name: Remove additional users with UID=0 ("root" user is not touched)
|
||||||
|
user:
|
||||||
|
name: "{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ root_users }}"
|
||||||
|
when:
|
||||||
|
- os_remove_additional_root_users|bool
|
||||||
|
- root_users|length > 1
|
||||||
|
- item != "root"
|
||||||
|
|
||||||
- name: Get UID_MIN from login.defs
|
- name: Get UID_MIN from login.defs
|
||||||
shell: awk '/^\s*UID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs
|
shell: awk '/^\s*UID_MIN\s*([0-9]*).*?$/ {print $2}' /etc/login.defs
|
||||||
args:
|
args:
|
||||||
@@ -25,7 +66,7 @@
|
|||||||
when: uid_max is not defined
|
when: uid_max is not defined
|
||||||
|
|
||||||
- name: Get all system accounts
|
- name: Get all system accounts
|
||||||
command: awk -F'':'' '{ if ( $3 <= {{ uid_max|quote }} ) print $1}' /etc/passwd
|
command: awk -F'':'' '{ if ( $3 <= {{ uid_max | quote }} ) print $1}' /etc/passwd
|
||||||
args:
|
args:
|
||||||
removes: /etc/passwd
|
removes: /etc/passwd
|
||||||
changed_when: false
|
changed_when: false
|
||||||
@@ -46,7 +87,7 @@
|
|||||||
with_community.general.flattened:
|
with_community.general.flattened:
|
||||||
- '{{ sys_accs_cond | default([]) | difference(os_ignore_users) | list }}'
|
- '{{ sys_accs_cond | default([]) | difference(os_ignore_users) | list }}'
|
||||||
|
|
||||||
- name: get all home directories in /home, but skip ignored users
|
- name: Get all home directories in /home, but skip ignored users
|
||||||
find:
|
find:
|
||||||
paths: /home/
|
paths: /home/
|
||||||
recurse: false
|
recurse: false
|
||||||
@@ -55,7 +96,7 @@
|
|||||||
register: home_directories
|
register: home_directories
|
||||||
when: os_chmod_home_folders | bool
|
when: os_chmod_home_folders | bool
|
||||||
|
|
||||||
- name: set ownership of /home directories to 0700
|
- name: Set ownership of /home directories to 0700
|
||||||
file:
|
file:
|
||||||
mode: 0700
|
mode: 0700
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
|
|||||||
@@ -2,30 +2,26 @@
|
|||||||
# Generated by Ansible role {{ ansible_role_name }}
|
# Generated by Ansible role {{ ansible_role_name }}
|
||||||
|
|
||||||
log_file = /var/log/audit/audit.log
|
log_file = /var/log/audit/audit.log
|
||||||
log_format = RAW
|
log_format = {{ os_auditd_log_format }}
|
||||||
log_group = root
|
log_group = {{ os_auditd_log_group }}
|
||||||
priority_boost = 4
|
priority_boost = 4
|
||||||
flush = INCREMENTAL
|
flush = {{ os_auditd_flush }}
|
||||||
freq = 20
|
freq = 20
|
||||||
num_logs = 5
|
num_logs = {{ os_auditd_num_logs }}
|
||||||
disp_qos = lossy
|
disp_qos = lossy
|
||||||
dispatcher = /sbin/audispd
|
dispatcher = /sbin/audispd
|
||||||
name_format = NONE
|
name_format = NONE
|
||||||
##name = mydomain
|
|
||||||
max_log_file = {{ os_auditd_max_log_file }}
|
max_log_file = {{ os_auditd_max_log_file }}
|
||||||
max_log_file_action = {{ os_auditd_max_log_file_action }}
|
max_log_file_action = {{ os_auditd_max_log_file_action }}
|
||||||
space_left = 75
|
space_left = {{ os_auditd_space_left }}
|
||||||
space_left_action = SYSLOG
|
space_left_action = {{ os_auditd_space_left_action }}
|
||||||
action_mail_acct = root
|
action_mail_acct = root
|
||||||
admin_space_left = 50
|
admin_space_left = {{ os_auditd_admin_space_left }}
|
||||||
admin_space_left_action = SUSPEND
|
admin_space_left_action = {{ os_auditd_admin_space_left_action }}
|
||||||
disk_full_action = SUSPEND
|
disk_full_action = {{ os_auditd_disk_full_action }}
|
||||||
disk_error_action = SUSPEND
|
disk_error_action = {{ os_auditd_disk_error_action }}
|
||||||
##tcp_listen_port =
|
|
||||||
tcp_listen_queue = 5
|
tcp_listen_queue = 5
|
||||||
tcp_max_per_addr = 1
|
tcp_max_per_addr = 1
|
||||||
##tcp_client_ports = 1024-65535
|
|
||||||
tcp_client_max_idle = 0
|
tcp_client_max_idle = 0
|
||||||
enable_krb5 = no
|
enable_krb5 = no
|
||||||
krb5_principal = auditd
|
krb5_principal = auditd
|
||||||
##krb5_key_file = /etc/audit/audit.key
|
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
#%PAM-1.0
|
#%PAM-1.0
|
||||||
auth required pam_env.so
|
auth required pam_env.so
|
||||||
auth required pam_faildelay.so delay=2000000
|
auth required pam_faildelay.so delay=2000000
|
||||||
{% if os_auth_retries > 0 %}
|
{% if os_auth_retries|int > 0 %}
|
||||||
auth required pam_faillock.so preauth silent audit even_deny_root deny={{ os_auth_retries }} unlock_time={{ os_auth_lockout_time }}
|
auth required pam_faillock.so preauth silent audit even_deny_root deny={{ os_auth_retries }} unlock_time={{ os_auth_lockout_time }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if (os_auth_pam_sssd_enable | bool) %}
|
{% if (os_auth_pam_sssd_enable | bool) %}
|
||||||
@@ -16,12 +16,12 @@ auth sufficient pam_unix.so nullok try_first_pass
|
|||||||
auth [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet
|
auth [default=1 ignore=ignore success=ok] pam_succeed_if.so uid >= 1000 quiet
|
||||||
auth sufficient pam_sss.so forward_pass
|
auth sufficient pam_sss.so forward_pass
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if os_auth_retries > 0 %}
|
{% if os_auth_retries|int > 0 %}
|
||||||
auth required pam_faillock.so authfail audit even_deny_root deny={{ os_auth_retries }} unlock_time={{ os_auth_lockout_time }}
|
auth required pam_faillock.so authfail audit even_deny_root deny={{ os_auth_retries }} unlock_time={{ os_auth_lockout_time }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
auth required pam_deny.so
|
auth required pam_deny.so
|
||||||
|
|
||||||
{% if os_auth_retries > 0 %}
|
{% if os_auth_retries|int > 0 %}
|
||||||
account required pam_faillock.so
|
account required pam_faillock.so
|
||||||
{% endif %}
|
{% endif %}
|
||||||
account required pam_unix.so
|
account required pam_unix.so
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ As this role requires root-privileges, we added `become: true` to all tasks. So
|
|||||||
- Description: Disable root-login. Set to `'without-password'` or `'yes'` to enable root-login - The quotes are required!
|
- Description: Disable root-login. Set to `'without-password'` or `'yes'` to enable root-login - The quotes are required!
|
||||||
- `ssh_allow_tcp_forwarding`
|
- `ssh_allow_tcp_forwarding`
|
||||||
- Default: `no`
|
- Default: `no`
|
||||||
- Description: `'no'` to disable TCP Forwarding. Set to `'yes'` to allow TCP Forwarding. If you are using OpenSSH >= 6.2 version, you can specify `'yes'`, `'no'`, `'all'`, `'local'`or`'remote'`. <br> _Note_: values passed to this variable must be strings, thus values `'yes'`and`'no'` should be passed with quotes.
|
- Description: `'no'` or `False` to disable TCP Forwarding. Set to `'yes'` or `True` to allow TCP Forwarding. If you are using OpenSSH >= 6.2 version, you can specify `'yes'`, `'no'`, `'all'`, `'local'`or`'remote'`.
|
||||||
- `ssh_gateway_ports`
|
- `ssh_gateway_ports`
|
||||||
- Default: `false`
|
- Default: `false`
|
||||||
- Description: `false` to disable binding forwarded ports to non-loopback addresses. Set to `true` to force binding on wildcard address. Set to `clientspecified` to allow the client to specify which address to bind to.
|
- Description: `false` to disable binding forwarded ports to non-loopback addresses. Set to `true` to force binding on wildcard address. Set to `clientspecified` to allow the client to specify which address to bind to.
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
name: 'os_vars'
|
name: 'os_vars'
|
||||||
with_first_found:
|
with_first_found:
|
||||||
- files:
|
- files:
|
||||||
- '{{ ansible_facts.distribution }}_{{ ansible_facts.distribution_major_version }}.yml'
|
- '{{ ansible_facts.distribution }}_{{ ansible_facts.distribution_major_version | default() }}.yml'
|
||||||
- '{{ ansible_facts.distribution }}.yml'
|
- '{{ ansible_facts.distribution }}.yml'
|
||||||
- '{{ ansible_facts.os_family }}_{{ ansible_facts.distribution_major_version }}.yml'
|
- '{{ ansible_facts.os_family }}_{{ ansible_facts.distribution_major_version | default() }}.yml'
|
||||||
- '{{ ansible_facts.os_family }}.yml'
|
- '{{ ansible_facts.os_family }}.yml'
|
||||||
skip: true
|
skip: true
|
||||||
tags: always
|
tags: always
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
- include_tasks: hardening.yml
|
- name: Include hardening tasks
|
||||||
|
include_tasks: hardening.yml
|
||||||
args:
|
args:
|
||||||
apply:
|
apply:
|
||||||
become: true
|
become: true
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
# The following tasks only get executed when selinux is in state enforcing,
|
# The following tasks only get executed when selinux is in state enforcing,
|
||||||
# UsePam is 'no' and the ssh_password module is not installed. See this issue for
|
# UsePam is 'no' and the ssh_password module is not installed. See this issue for
|
||||||
# more info: https://github.com/hardening-io/ansible-ssh-hardening/issues/23
|
# more info: https://github.com/hardening-io/ansible-ssh-hardening/issues/23
|
||||||
- name: run selinux tasks
|
- name: Run selinux tasks
|
||||||
when:
|
when:
|
||||||
- not (ssh_use_pam | bool)
|
- not (ssh_use_pam | bool)
|
||||||
- ('ssh_password' not in ssh_password_module.stdout)
|
- ('ssh_password' not in ssh_password_module.stdout)
|
||||||
|
|||||||
@@ -106,10 +106,13 @@ RSAAuthentication yes
|
|||||||
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
|
# Disable password-based authentication, it can allow for potentially easier brute-force attacks.
|
||||||
PasswordAuthentication {{ 'yes' if ssh_client_password_login else 'no' }}
|
PasswordAuthentication {{ 'yes' if ssh_client_password_login else 'no' }}
|
||||||
|
|
||||||
|
{# OpenBSD does not support GSSAPIAuthentication, so leave this out if on OpenBSD #}
|
||||||
|
{% if ansible_facts.os_family != 'OpenBSD' %}
|
||||||
# Only use GSSAPIAuthentication if implemented on the network.
|
# Only use GSSAPIAuthentication if implemented on the network.
|
||||||
GSSAPIAuthentication {{ 'yes' if (ssh_gssapi_support|bool) else 'no' }}
|
GSSAPIAuthentication {{ 'yes' if (ssh_gssapi_support|bool) else 'no' }}
|
||||||
GSSAPIDelegateCredentials {{ 'yes' if (ssh_gssapi_delegation|bool) else 'no' }}
|
GSSAPIDelegateCredentials {{ 'yes' if (ssh_gssapi_delegation|bool) else 'no' }}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
# Disable tunneling
|
# Disable tunneling
|
||||||
Tunnel no
|
Tunnel no
|
||||||
|
|
||||||
|
|||||||
@@ -143,10 +143,13 @@ KerberosTicketCleanup yes
|
|||||||
#KerberosGetAFSToken no
|
#KerberosGetAFSToken no
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{# OpenBSD does not support GSSAPIAuthentication, so leave this out if on OpenBSD #}
|
||||||
|
{% if ansible_facts.os_family != 'OpenBSD' -%}
|
||||||
# Only enable GSSAPI authentication if it is configured.
|
# Only enable GSSAPI authentication if it is configured.
|
||||||
GSSAPIAuthentication {{ 'yes' if ssh_gssapi_support else 'no' }}
|
GSSAPIAuthentication {{ 'yes' if ssh_gssapi_support else 'no' }}
|
||||||
GSSAPICleanupCredentials yes
|
GSSAPICleanupCredentials yes
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
{% if ssh_deny_users %}
|
{% if ssh_deny_users %}
|
||||||
# In case you don't use PAM (`UsePAM no`), you can alternatively restrict users and groups here.
|
# In case you don't use PAM (`UsePAM no`), you can alternatively restrict users and groups here.
|
||||||
# For key-based authentication this is not necessary, since all keys must be explicitely enabled.
|
# For key-based authentication this is not necessary, since all keys must be explicitely enabled.
|
||||||
@@ -194,9 +197,9 @@ PermitTunnel {{ 'yes' if (ssh_permit_tunnel|bool) else 'no' }}
|
|||||||
# Disable forwarding tcp connections.
|
# Disable forwarding tcp connections.
|
||||||
# no real advantage without denied shell access
|
# no real advantage without denied shell access
|
||||||
{% if sshd_version is version('6.2', '>=') %}
|
{% if sshd_version is version('6.2', '>=') %}
|
||||||
AllowTcpForwarding {{ ssh_allow_tcp_forwarding if (ssh_allow_tcp_forwarding in ('yes', 'no', 'local', 'all', 'remote')) else 'no' }}
|
AllowTcpForwarding {{ ssh_allow_tcp_forwarding if (ssh_allow_tcp_forwarding in ('yes', 'no', 'local', 'all', 'remote')) else ('yes' if (ssh_allow_tcp_forwarding|bool) else 'no') }}
|
||||||
{% else %}
|
{% else %}
|
||||||
AllowTcpForwarding {{ ssh_allow_tcp_forwarding if (ssh_allow_tcp_forwarding in ('yes', 'no')) else 'no' }}
|
AllowTcpForwarding {{ ssh_allow_tcp_forwarding if (ssh_allow_tcp_forwarding in ('yes', 'no')) else ('yes' if (ssh_allow_tcp_forwarding|bool) else 'no') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
# Disable agent forwarding, since local agent could be accessed through forwarded connection.
|
# Disable agent forwarding, since local agent could be accessed through forwarded connection.
|
||||||
|
|||||||
Reference in new issue
Block a user