Commit Graph

18 Commits

Author SHA1 Message Date
Dmitriy Rabotyagov db5c6f2d66 Fix linters and metadata
With update of ansible-lint to version >=6.0.0 a lot of new
linters were added, that enabled by default. In order to comply
with linter rules we're applying changes to the role.

With that we also update metdata to reflect current state.

Change-Id: I1920cd05ac5b4d32ad12bce42d9161a568f288b6
2023-07-17 14:25:21 +02:00
Jonathan Rosser b9a9310d7c Use ansible_facts[] instead of fact variables
See https://github.com/ansible/ansible/issues/73654

Change-Id: I3dc2486a0666367d673b23403f2510c94c40eaf4
2021-03-10 16:54:58 +00:00
Jonathan Rosser c6703cd5e5 Fix linter errors
Work around the mutually incompatible W503 and W504.

Change-Id: I45d0ca8a911d9cf1af2df52a1cf911db817b13b3
2021-02-02 16:11:03 +02:00
Mohammed Naser b792753b34 cleanup: use updated conditionals
This role made use of conditionals that still used filters, this
patch removes them all and switches them to the new system.

Change-Id: I7c68f4e5f7248aedd3cdae734aac6d97a8ce058b
2019-01-07 12:56:12 -05:00
ZhijunWei ca8114438c Delete the unnecessary space
Change-Id: I776b0ac8b69ec1fdb0d7ef6402cfff52cf6b29fd
2018-07-17 16:54:03 -04:00
Jean-Philippe Evrard f07aba1662 Fix usage of "|" for tests
With the more recent versions of ansible, we should now use
"is" instead of the "|" sign for the tests.

This should fix it.

Change-Id: I8d78a2b4ba2a8746cbb809e4f8c9370abe211350
2018-07-12 16:58:21 +02:00
Major Hayden fcad8c23f5
Simplify SELinux check
The ansible_selinux variable is always populated with a 'status'
property, even if SELinux is not installed or configured. This
patch simplifies the check.

Change-Id: Ifddc385fc292ddb7d6c2758b199401c45de0f0f2
Signed-off-by: Major Hayden <major@mhtx.net>
2018-03-06 13:18:05 -06:00
Major Hayden 75c06173c7
Check apparmor_status output
This patch adds a check for the output of `apparmor_status` to
get a more accurate state of AppArmor's status. This should fix
idempotency issues that are plaguing the gate jobs.

Closes-Bug: 1715223
Change-Id: I10bb3212a3cc26ed27aa38cdc2e42ece722a6497
2017-09-05 15:53:58 -05:00
Major Hayden b866f49517 Fix AppArmor idempotency
This patch helps us work around the limitations of the SysV init
script for AppArmor that systemd calls.

Change-Id: Ic846942d8ef3b4a8ecc1d79bda11e29b7230e3cc
2017-08-28 14:42:58 +00:00
Major Hayden 78d37afccc
Manually check apparmor_status
The apparmor systemd unit file simply calls an old SysV init script
to load AppArmor profiles. The init script exits and systemd has no
idea if it's still running or not. This causes Ansible to start
the apparmor unit each time the playbook runs, which breaks the
idempotency checks.

This patch checks the apparmor_status output directly to see what the
status of AppArmor actually is. If the module is loaded, then we
should not try to start AppArmor with the unit file again.

This patch also includes the updates from the openstack-ansible-tests
repository that were included in
https://review.openstack.org/#/c/488489/ so that the gate can be
unblocked.

Partial-Bug: 1710675
Change-Id: If253714d0ca4b5a3d324255751e6f6615ca75dde
2017-08-16 09:02:42 -05:00
Markos Chandras f422da8599 Add support for the openSUSE Leap distributions
Add support for the openSUSE Leap distributions. The security rules
are similar to the RedHat and Ubuntu ones. We also replace
ansible_os_family with ansible_pkg_mgr since the former does not
return consistent results across different SUSE distributions especially
on older Ansible versions.

Change-Id: I20ffe17039bb641aad70d8123f0b7e7417a42cba
2017-06-27 15:43:53 +01:00
Major Hayden 5743ea86a0
Fix AppArmor dmesg grep task
The task that checks for AppArmor being disabled at boot time
fails if the line isn't present in dmesg. This patch ensures that
the output from dmesg is always maintained and the shell always
comes back with success.

Change-Id: Ib612cbf1ba3f3ec8284b41eab39d76cb5291c58e
Closes-Bug: 1694508
2017-05-30 13:27:08 -05:00
Major Hayden 4e9a8a1d6a Initial Debian 8 support
This patch sets up the security role so that it applies cleanly
to systems running Debian 8.

Change-Id: I15f003b8f57922b354143a86ccb34df77759e723
2017-05-23 07:31:18 -05:00
Major Hayden dccce1d5cc
Handle RHEL 7 STIG renumbering
This patch gets the docs adjusted to work with the new RHEL 7 STIG
version 1 release. The new STIG release has changed all of the
numbering, but it maintains a link to (most) of the old STIG IDs in
the XML.

Closes-bug: 1676865
Change-Id: I65023fe63163c9804a3aec9dcdbf23c69bedb604
2017-04-04 07:22:12 -05:00
Marc Gariepy 8f7d132e63 Fix selinux check when disabled
Change-Id: Ibd52b4c174e7b9eb6305dbcdb12c7d675b6fcf94
2017-03-06 13:28:49 +00:00
Major Hayden 3e908d3d7b Handle SELinux properly when it is disabled
This patch skips the `find` task that searches for unlabeled content on
systems with SELinux disabled. This fails because labels aren't loaded at that
time.

The patch also fixed an idempotent test failure that comes from the `selinux`
Ansible module repeatedly trying to get SELinux into enforcing mode when it
is disabled.

Closes-bug: 1649617
Change-Id: I7d30a07bd7e8a4461846660c281b9e53b0783461
2017-01-03 19:02:37 +00:00
Major Hayden 0e05d2ea6c Search for unlabeled device files [+Docs]
This patch adds tasks to search for device files without SELinux labels and
prints a list of those devices in the Ansible output.

Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: Ic870f91ead4e89189efb8ad93674798063c97ba8
2016-12-08 21:53:56 +00:00
Major Hayden 3efe849be8 Enable SELinux/AppArmor [+Docs]
This patch enables SELinux/AppArmor and sets the SELinux targeted policy
on CentOS/RHEL hosts. Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: I7e225bc10331e12d2405154d873a578e18532305
2016-11-29 15:42:16 -06:00