Commit Graph

25 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
Dmitriy Rabotyagov 2c7889852c Remove warn argument for command/shell
Since ansible-core 2.14 you can't use warn as module argument.

Instead, noqa should be used to instruct ansible-lint to
supress alerts.

Change-Id: Ie448fa182db8c1c9f64744ea72f27f285aa64366
2023-06-30 15:05:50 +02:00
Major Hayden 91f19e9eb3
Always quote the filesystem permissions
Change-Id: If221aae8a6cbf99bd0892e198eeb7d141d4ffa44
2017-11-08 10:56:07 -06:00
Jean-Philippe Evrard 9361a146e4 Do not update grub if grub not used
The security check should be skipped if GRUB update tool does not
exist (grub isn't installed).

Change-Id: I99a3b372e12e264cbc40bdc3ae6b6b60bf3c1c79
2017-04-13 12:34:22 +00:00
Major Hayden 280e797a4e Set grub2 password [+Docs]
This patch allows deployers to optionally set a GRUB 2 password for accessing
single-user and maintenance runlevels. Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: I33d1ef4dec72d196deaca142169675aa5077740b
2016-12-08 16:20:23 -06:00
Major Hayden 40ca9cf990 Disable ctrl-alt-del key sequence [+Docs]
This patch masks the systemd unit that controls the C-A-D key sequence.

Implements: blueprint security-rhel7-stig
Change-Id: I9bd01641fd8787fab90921e360e5933953871d51
2016-11-30 12:49:38 -06:00
Jenkins 9723173119 Merge "Set graphical session locks" 2016-11-17 03:02:03 +00:00
Major Hayden 3c0cc41969 Enable virus scanner
The STIG requires that a virus scanner is installed and running. This
won't be popular on many hypervisors or OpenStack control plane servers,
so the tasks are disabled by default.

Implements: blueprint security-rhel7-stig
Change-Id: I3b4803139e63aae3b740e8e150cb552a298c4ece
2016-11-14 08:23:38 -06:00
Major Hayden 5fbc456807 Set graphical session locks
This patch applies the graphical session lock settings from the following
STIG controls:

  - RHEL-07-010060
  - RHEL-07-010070
  - RHEL-07-010071
  - RHEL-07-010073
  - RHEL-07-010074

Docs will be provided in a follow-on patch.

Implements: blueprint security-rhel7-stig
Change-Id: I306ea5e2e274a2ca63158ba8b039686b27a5d923
2016-11-14 08:15:49 -06:00
Jenkins cca0da44a0 Merge "Add conf file entry for chrony" 2016-11-07 21:45:57 +00:00
Marc Gariepy fec2cb36eb Add conf file entry for chrony
On CentOS the chrony.conf is in /etc/. adding a var to  define it.

Depends-On: I1aa3faf88f5953c230693600fcbcb786d49a35e0
Change-Id: Id6afe700f0d908396b4441e6c92dc79e29b228bf
2016-11-07 15:55:05 -05:00
Major Hayden 23af709fff Fix auditd restart handler
It is not possible to restart auditd with systemctl. Using the service
interface is required. There are chef cookbooks[1] with the same
workaround.

This patch also includes a `cache_valid_time` addition to test.yml to
unblock the gate.

[1] https://github.com/chef-cookbooks/auditd/pull/22/files

Change-Id: I1aa3faf88f5953c230693600fcbcb786d49a35e0
2016-11-07 10:59:04 -06:00
Major Hayden 2aca8287dc Adding V-38438 (auditd during boot)
This patch adds a task and handlers for enabling the audit daemon
during the boot sequence to comply with V-38438. Deployers have
the option to opt-out of the entire change, or they can apply the
change without updating the active grub.cfg file.

Change-Id: Ia8702b8439a5993516397363b21356f1216be403
2016-09-06 13:21:11 +00:00
Major Hayden 578ce32998 Ensure AIDE initializes on subsequent runs
If a deployer installs AIDE the first time they apply the role
without initializing AIDE and they want to initialize it later,
the handler that does the initialization never fires.

This patch does a few things:

  - Ensures AIDE initialization if the initialize_aide bool is True
  - Doesn't intialize the AIDE db if it already exists
  - Moves the new db into place on Red Hat systems
  - Moves the AIDE tasks into its own file with tags
  - Prevents AIDE from trawling through /var

Closes-bug: 1616281

Change-Id: I85d65738fde064b06b1147c529b22c3f44a33e94
2016-08-25 12:56:35 +00:00
Major Hayden 809b6cb52d Restart auditd after running augenrules
The augenrules command joins together all of the audit rules from
rules.d and it is run any time the audit rules template changes. However,
the augenrules handler didn't actually restart auditd to apply the
changes to the system.

This patch fires off the auditd restart handler anytime the augenrules
handler is notified.

Closes-bug: 1590916

Change-Id: Ice83fe17ebb0e9edff9da897e435ae96c1778580
2016-06-09 15:14:42 -05:00
Major Hayden 22c4c21583 Add CentOS 7 and Ubuntu 16.04 support
This patch adds initial support for CentOS 7 and Ubuntu 16.04
to the security role. Documentation and tests still need updates
in subsequent patches.

Release notes are included.

Change-Id: Iae936bb307a5938651c55e703d68d39a7716d178
2016-05-13 14:57:28 -05:00
Major Hayden fa2800419e Migrate to unique variable names
This patch migrates all of the remaining non-unique variable names
in the security role to a pattern that begins with `security_*`.
This will reduce potential variable collisions with other roles.

This is a breaking change for deployers and users who are moving
from the liberty or stable/mitaka branches to master. Release notes
are included with additional details to help with the transition.

Closes-Bug: 1578326

Change-Id: Ib716e81e6fed971b21dc5579ae1a871736e21189
2016-05-09 16:18:48 -05:00
Major Hayden 99d1bc39ac Skip AIDE initialization by default
The AIDE database initialization consumes a lot of CPU time and I/O resources.
We shouldn't initialize the database by default, but this should be
configurable by the deployer.

Closes-bug: 1534658

Change-Id: If680000619c35914e58ed8b7883c7eaa7928cec4
2016-01-15 10:30:46 -06:00
Jenkins 933fb5e64a Merge "V-3865{6,7}: Samba" 2015-10-27 13:11:29 +00:00
Major Hayden 53f9b60e58 V-51391: Initialize AIDE
Closes-bug: 1505793

Implements: blueprint security-hardening

Change-Id: Ia15368c0af184054c5be60c893c751e449b8770a
2015-10-19 07:32:22 -05:00
Major Hayden 4506933796 V-38501, V-38573: Disable accounts after failed logins
This requirement is not easily translated for Ubuntu 14.04. As a mitigation,
fail2ban will be installed and configured to block IP addresses with failed
login attempts for 15 minutes.

Change-Id: Icb469896c55acc8b18dfb64ebf642fe7d48e86fc
2015-10-16 11:27:25 -05:00
Major Hayden 27be343296 V-3865{6,7}: Samba
Implements: blueprint security-hardening

Change-Id: I260cb84e543cad201e281f70adfcb181f54645be
2015-10-15 16:27:13 -05:00
Major Hayden 9363a17f0f V-38623: rsyslog file permissions
Implements: blueprint security-hardening

Change-Id: I168d588f3f1672c600f381ec47909819b122c412
2015-10-15 07:43:48 -05:00
Major Hayden 4bcfe2e26c V-38622: Restricted mail relaying
This option is configurable and documented.

Implements: blueprint security-hardening

Change-Id: I315fb71dc9495c805cf1c799469418cbcb06136d
2015-10-14 12:54:39 -05:00
Jesse Pretorius 58ac7a8a7a Enable role testing and make structure ansible-galaxy compatible
This patch adds the bits needed to implement automated syntax/lint
role testing. It also moves the role into the base repository so
that the role becomes fully compatible with ansible-galaxy to
improve the role's consumability.

Change-Id: Ia79cd5dedbbe50dfdf46688830a989ff0897832a
2015-10-09 11:47:23 +00:00