Commit Graph

44 Commits

Author SHA1 Message Date
Jonathan Rosser 0114e44f3e Add Centos-8 support
Make hardening compatible with CentOS-8. Dependant patch [1] already
passes hardening and another one resolves issue with installing
non-existent packages. So we should merge this one without passing
CentOS 8 tests not to create circular dependency

[1] https://review.opendev.org/689629

Change-Id: I33160b9a6e8331d6db39824e420033c7ab06780b
2020-05-22 11:03:22 +00:00
Major Hayden a10fae4fe1 Replace Fedora 26 with 27
Now that infra is moving from Fedora 26 to 27, we need to update
the role to reflect the changing support for Fedora releases.

Change-Id: Icce8fd7ee2f8c54e6eb33beec7af96c4d1d375d6
Signed-off-by: Major Hayden <major@mhtx.net>
2018-03-07 13:30:45 +00:00
Yifei Xue 8025799fe6 Fix the path of chrony.keys
The path of chrony.keys on CentOS is different
from the one on Ubuntu. So change the definition
of keyfile to use variable defined in vars.

Change-Id: Ibb54318d5fff452857d917e3b13af6bae26a1b55
Signed-off-by: Yifei Xue <xueyifei@huawei.com>
2017-12-22 10:01:58 +08:00
Markos Chandras a0810a9ca1 tasks: auth: Use standard Grub2 authentication mechanism
GRUB_PASSWORD is not understood by vanilla grub2 installations. As such,
we can use the recommended method by setting the superusers
environment variable and using the password_pbkdf2 command

Change-Id: I07df3decf5e70b85a7dc48b8a8d1ca86e8878d09
Link: https://www.gnu.org/software/grub/manual/grub/grub.html#Security
Closes-Bug: 1735709
2017-12-13 12:38:30 +00:00
Major Hayden 0c0767b3f1
Queens doc updates + removal of RHEL 6 STIG
This patch begins the teardown of the RHEL 6 STIG content from the
ansible-hardening repository. It will still be maintained in
Pike and earlier branches.

This patch also updates the ansible-hardening documentation for the
Queens release and notes that Pike is the latest stable version.

Closes-Bug: 1715745
Change-Id: Iaae52c97a35d82dd807ef78a1a6593ce3aa33540
2017-09-12 08:19:54 -06:00
Major Hayden b352760fd1
Fedora 26 support
This patch adds support for Fedora 26.

Depends-On: Ic4ea169908fec86623dbe91859ec524e48683ab7
Change-Id: I590bed829d9e3b7a6df477a00b65bfc10fc64dae
2017-08-28 07:33:16 -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 6c9c7fad66 Get a list of all users + interactive users
This patch adjusts main.yml to retrieve a list of all users and a
list of just interactive users using the get_users module.

Change-Id: I4ff3ceeb068e339c62456f2e5c62ec97b72751f4
2017-06-13 06:32:17 +00:00
Major Hayden 97186f8339 Initial Fedora 25 support
This patch adds the initial support for Fedora 25 in the security
role. A non-voting gate job is proposed in the following review:

  https://review.openstack.org/#/c/467297/

Docs and general cleanup for Fedora/Debian support is coming soon.

Change-Id: Ia6c551d2f33255f7f71f7ba9bb328fc8f17f61e0
2017-05-31 13:33:34 +00: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 701c0b1e32
Fix path to daemon init params file
Ubuntu 14.04 and CentOS 7 have their daemon inititalization
parameters file in different places. This fixes a bug where
the path in CentOS was incorrect.

Closes-Bug: 1662545
Change-Id: Ie0b30848a73f8a1fbc7fe6a475d93d87a72ce40f
2017-04-04 10:52:02 -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
Logan V dc8dc3dbf9 Install chrony when enabled in RHEL7 STIG
Chrony was not being installed by the RHEL7 STIG package list when
enabled, causing a failure when the service configuration was
attempted.

This fixes the following failure:
http://cdn.pasteraw.com/7vo74lbz1jyf9qm5010mfqa169a8zpf

Change-Id: I6accac5504abe6fb1f2d0d0db5baa9b5a42a5c70
2017-01-21 18:52:09 -06:00
Major Hayden 1cf9fba0d3 Enable FIPS [+Docs]
This patch installs `dracut-fips` and checks to see if the deployer has FIPS
enabled at boot time. Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: I9a6da4dc753fbfc3949f0c78e53af3bb5e3083ef
2016-12-13 18:06:39 +00:00
Major Hayden 28cd87354d Check for pam_lastlogin [+Docs]
This patch adds a verification check for `pam_lastlogin` in PAM's
configuration.

Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: Ib2135331efc0cfb6dca581ac7c70fac6dc7d3224
2016-12-08 16:20:23 -06: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 e5db8521d9 Enable automatic package updates [+Docs]
This patch allows a deployer to optionally enable automatic package updates.

Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: I79d38971ea847096e7f20f0912363deaf5028a74
2016-12-08 16:20:23 -06:00
Major Hayden 505a4a9eb0 Enable AIDE [+Docs]
This patch installs AIDE and optionally initializes the AIDE database. A
cron job is also deployed for CentOS/RHEL since it doesn't come with
the AIDE package itself.

Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: Iae04c95903960deee2d750037c08b50c4ce4f800
2016-12-08 16:20:23 -06:00
Major Hayden fd4fa2d3d7 Set audisp failure options [+Docs]
This patch adds configurations for audisp when the disk is rull on the remote
server or when there is a network interruption between the local system and
the remote audisp server.

It also explicitly installs auditd/audisp-plugins to ensure that auditd and
the remote audisp log sender are installed on CentOS/RHEL.

Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: I589ae00a70582ee3f5d48453b3c20f23752adfa6
2016-12-08 14:24:03 +00:00
Jenkins 939c9e5189 Merge "Enable firewalld [+Docs]" 2016-12-01 06:16:58 +00:00
Major Hayden c777f734ac Enable firewalld [+Docs]
This patch allows deployers to opt-in for firewalld. The firewalld package
is installed and the service is enabled when `security_enable_firewalld` is
set to `yes`.

Documentation is included.

Implements: blueprint security-rhel7-stig
Change-Id: I641a8c7e468ed1b7908d2b62296fa309de6979b5
2016-11-30 13:00:23 -06: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
Major Hayden 4c792445d4 Move common variables to common.yml
This patch creates a common.yml variables file to hold variables
that apply to all distributions supported by the role. It also adds
comments into the existing vars file to instruct developers and
deployers about the proper location for variables.

Implements: blueprint security-rhel7-stig
Change-Id: Idad1cbfe0c6992a6333c4740080764a3ac776628
2016-11-20 17:11:12 +00:00
Jenkins 3b2c5bf47f Merge "Refactor auditd rules" 2016-11-18 19:57:42 +00:00
Jenkins 449bc820e6 Merge "Move clamav packages to rhel7 vars" 2016-11-18 19:27:49 +00:00
Major Hayden ff5bbe1233 Refactor auditd rules
This commit adds all of the remaining audit rules to the role and
refactors the audit rules (mostly) into a list that jinja2 can
loop over.

Docs will be in a follow-on patch.

Implements: blueprint security-rhel7-stig
Change-Id: I17ca6356ae7819f0721585850e4d70e0bac29ff1
2016-11-18 12:39:00 -06:00
Jenkins b199e4f070 Merge "Fix stig_packages_rhel7 typo" 2016-11-18 18:22:13 +00:00
Major Hayden 5c97321864 Move clamav packages to rhel7 vars
The package variables for clamav somehow ended up in the RHEL 6 vars. This
patch puts them in the right place.

Change-Id: I48705bbb79367fa60745e98850652c0331537322
2016-11-18 13:57:03 +00:00
Major Hayden 4c91f2123f Fix stig_packages_rhel7 typo
This patch fixes a typo where the RHEL 6 STIG packages list was
used by mistake.

Change-Id: I5ce7de15aa9c5f0caaa20375c14008adb976ed4b
2016-11-17 14:43:00 -06:00
Jenkins 598923356c Merge "Disable repo GPG checks by default" 2016-11-17 03:02:20 +00:00
Major Hayden 8868011d4c Disable repo GPG checks by default
Enable repo GPG checks causes some CentOS systems to become unable to
retrieve yum metadata. It also causes the security gate jobs to balloon
out to 12 minutes (normally 3-4 mins).

Closes-Bug: 1641729
Change-Id: I229b471bbd9fbe39776b9022671b03da0a659163
2016-11-14 15:20:04 -06: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 8daae8cd7e Transmit audit logs to other servers
This patch adds docs and tasks for RHEL-07-030330. Deployers should
specify a host to receive audit logs. The tasks will only take action
when a host is specified with `security_audisp_remote_server`.

Implements: blueprint security-rhel7-stig
Change-Id: Ic37764766f3e254e46bad6b81f274c0a8677ab6a
2016-11-09 17:43:58 +00:00
Major Hayden 9d74dbd915 Install screen and ssh client/server
This patch ensures that screen and ssh packages are installed. It
fulfills the requirmeents of these two STIGs:

* RHEL-07-010072
* RHEL-07-040260

Implements: blueprint security-rhel7-stig
Change-Id: Id30d586bfff8b34554195845a565d491c2ac76e2
2016-11-07 21:53:26 +00:00
Major Hayden e5f35284fc Remove packages according to STIG
This patch removes packages per the requirements of these STIGs:

* RHEL-07-040500
* RHEL-07-020010
* RHEL-07-020000
* RHEL-07-021910
* RHEL-07-040560

Implements: blueprint security-rhel7-stig
Change-Id: I52459d54c578c4e14392bf647268a2237f8df24a
2016-11-07 21:47:35 +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 784a38ec4c Speed up package install/removal
Instead of breaking up package installations and removals into separate
tasks, this patch moves them all under one task that does two execution
steps.

In addition, the security_enable_chrony variable was added to control the
installation and configuration of chrony. The tox tests for the role were
configured to skip chrony in the gate using a skipped tag, but this caused
the package install/removal task to get skipped.

Docs/release notes are included for the chrony change.

Change-Id: I1def033953b50be3911cd932fd17b10dd2c658b7
2016-11-03 13:30:56 -05: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 822ffad0bc Add AIDE cron job in CentOS 7
This patch ensures that the AIDE cron job is present on CentOS 7
and RHEL 7 servers.

Closes-bug: 1614532

Change-Id: I4ce25cb4fcfffcadf5c19fef429488f5f9d8aa8f
2016-08-18 15:12:36 +00:00
Jean-Philippe Evrard b5b92c1abe Fix chrony daemon name for rh derivatives
RH/Centos 7 uses chronyd instead of chrony as service name.

Closes-Bug: 1604042

Change-Id: I69fbba7ea2d7c108f51d36b9fd4ed8cf547c517b
Signed-off-by: Jean-Philippe Evrard <jean-philippe.evrard@rackspace.co.uk>
2016-07-19 15:45:48 +01:00
Mark Hooper 03d436f864 Fix grub configuration file path in RHEL/CentOS 7
CentOS and RHEL 7 both use /boot/grub2/grub.cfg, but the tasks in the
security role expect it to be in /boot/grub/grub.cfg. This patch
adds a variable for the grub configuration file path.

Closes-bug: 1590102

Change-Id: I724d6eb3b716bd9b0006d0d2e5ad201481d52e59
2016-06-07 19:48:11 +00:00
Major Hayden 6476ef7635 Ensure V-38574 works reliably on CentOS
This patch ensures that the tasks can find the right PAM
files to do the checks for V-38574. CentOS systems usually
symlink password-auth to password-auth-ac, but this symlink
is missing in the gate image.

The tasks now look for the password-auth file and this will work
properly on a generic CentOS 7 system as well as within the gate image.

Change-Id: I24281530df8bc939a823ffcc6187882574d266f6
2016-05-31 15:39:56 +00: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