Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

os-hardening (13) Versions 2.0.0

Installs and configures operating system hardening

Berkshelf/Librarian
Policyfile
Knife
cookbook 'os-hardening', '= 2.0.0'
cookbook 'os-hardening', '= 2.0.0', :supermarket
knife cookbook site install os-hardening
knife cookbook site download os-hardening
README
Dependencies
Changelog
Quality

os-hardening (Chef cookbook)

Supermarket Build Status Code Coverage Dependencies Gitter Chat

Description

This cookbook provides numerous security-related configurations, providing all-round base protection.

It configures:

  • Configures package management e.g. allows only signed packages
  • Remove packages with known issues
  • Configures pam and pam_limits module
  • Shadow password suite configuration
  • Configures system path permissions
  • Disable core dumps via soft limits
  • Restrict Root Logins to System Console
  • Set SUIDs
  • Configures kernel parameters via sysctl

It will not:

  • Update system packages
  • Install security patches

Requirements

  • Chef >= 12.5.1
  • Cookbooks:
    • Sander van Zoest sysctl https://github.com/svanzoest-cookbooks/sysctl

Attributes

  • ['os-hardening']['desktop']['enable'] = false true if this is a desktop system, ie Xorg, KDE/GNOME/Unity/etc
  • ['os-hardening']['network']['forwarding'] = false true if this system requires packet forwarding (eg Router), false otherwise
  • ['os-hardening']['network']['ipv6']['enable'] = false
  • ['os-hardening']['network']['arp']['restricted'] = true true if you want the behavior of announcing and replying to ARP to be restricted, false otherwise
  • ['os-hardening']['env']['extra_user_paths'] = [] add additional paths to the user's PATH variable (default is empty).
  • ['os-hardening']['env']['umask'] = "027"
  • ['os-hardening']['env']['root_path'] = "/" where root is mounted
  • ['os-hardening']['auth']['pw_max_age'] = 60 maximum password age
  • ['os-hardening']['auth']['pw_min_age'] = 7 minimum password age (before allowing any other password change)
  • ['os-hardening']['auth']['pw_warn_age'] = 7 number of days before maximum password age occurs to warn of impending change
  • ['os-hardening']['auth']['retries'] = 5 the maximum number of authentication attempts, before the account is locked for some time
  • ['os-hardening']['auth']['lockout_time'] = 600 time in seconds that needs to pass, if the account was locked due to too many failed authentication attempts
  • ['os-hardening']['auth']['timeout'] = 60 authentication timeout in seconds, so login will exit if this time passes
  • ['os-hardening']['auth']['allow_homeless'] = false true if to allow users without home to login
  • ['os-hardening']['auth']['pam']['passwdqc']['enable'] = true true if you want to use strong password checking in PAM using passwdqc
  • ['os-hardening']['auth']['pam']['passwdqc']['options'] = "min=disabled,disabled,16,12,8" set to any option line (as a string) that you want to pass to passwdqc
  • ['os-hardening']['security']['users']['allow'] = [] list of things, that a user is allowed to do. May contain: change_user
  • ['os-hardening']['security']['kernel']['enable_module_loading'] = true true if you want to allowed to change kernel modules once the system is running (eg modprobe, rmmod)
  • ['os-hardening']['security']['kernel']['enable_sysrq'] = false
  • ['os-hardening']['security']['kernel']['enable_core_dump'] = false
  • ['os-hardening']['security']['suid_sgid']['enforce'] = true true if you want to reduce SUID/SGID bits. There is already a list of items which are searched for configured, but you can also add your own
  • ['os-hardening']['security']['suid_sgid']['blacklist'] = [] a list of paths which should have their SUID/SGID bits removed
  • ['os-hardening']['security']['suid_sgid']['whitelist'] = [] a list of paths which should not have their SUID/SGID bits altered
  • ['os-hardening']['security']['suid_sgid']['remove_from_unknown'] = false true if you want to remove SUID/SGID bits from any file, that is not explicitly configured in a blacklist. This will make every Chef run search through the mounted filesystems looking for SUID/SGID bits that are not configured in the default and user blacklist. If it finds an SUID/SGID bit, it will be removed, unless this file is in your whitelist.
  • ['os-hardening']['security']['suid_sgid']['dry_run_on_unknown'] = false like remove_from_unknown above, only that SUID/SGID bits aren't removed. It will still search the filesystems to look for SUID/SGID bits but it will only print them in your log. This option is only ever recommended, when you first configure remove_from_unknown for SUID/SGID bits, so that you can see the files that are being changed and make adjustments to your whitelist and blacklist.
  • ['os-hardening']['security']['packages']['clean'] = true removes packages with known issues.
  • ['os-hardening']['security']['packages']['list'] = ['xinetd','inetd','ypserv','telnet-server','rsh-server'] list of packages to remove, by default we remove the following packages:
    • xinetd (NSA, Chapter 3.2.1)
    • inetd (NSA, Chapter 3.2.1)
    • tftp-server (NSA, Chapter 3.2.5)
    • ypserv (NSA, Chapter 3.2.4)
    • telnet-server (NSA, Chapter 3.2.2)
    • rsh-server (NSA, Chapter 3.2.3)

Usage

Add the recipes to the run_list, it should be last:

"recipe[os-hardening]"

Configure attributes:

"security" : {
  "kernel" : {
    "enable_module_loading" : true
  }
},

Local Testing

Local testing

Please install chef-dk, VirtualBox or VMware Workstation and Vagrant.

Linting is checked with rubocop and foodcritic:

$ chef exec rake lint
.....

Unit/spec tests are done with chefspec:

$ chef exec rake spec
.....

Integration tests are done with test-kitchen:

$ chef exec rake kitchen
.....
# or you can use the kitchen directly
$ kitchen test

CI testing of forks

You can enable testing of your fork in Travis CI. By default you will get linting and spec tests.

Integration tests of this repository are conducted using DigitalOcean.

If you want to have integration tests for your fork, you will have to add following environment variables in the settings of your fork: - DIGITALOCEAN_ACCESS_TOKEN - access token for DigitalOcean - CI_SSH_KEY - private part of some ssh key, available on DigitalOcean for your instances, in base64 encoded form (e.g. cat id_rsa | base64 -w0 ; echo) - DIGITALOCEAN_SSH_KEY_IDS - ID in DigitalOcean of CI_SSH_KEY, see this for more information

Contributors + Kudos

This cookbook is mostly based on guides by:

Thanks to all of you!!

Contributing

See contributor guideline.

License and Author

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Dependent cookbooks

compat_resource >= 12.16.3
sysctl >= 0.6.0

Contingent cookbooks

There are no cookbooks that are contingent upon this one.

Change Log

v2.0.0 (2017-04-06)

Full Changelog

Implemented enhancements:

Closed issues:

  • pam_passwdqc package install idempotence #134
  • Openhub is not up to date #129
  • login.defs.erb contains a non-ASCII character which causes a knife cookbook upload failure #122
  • fixing the 4 rspec failure #121
  • pam node attribute namespace error #118
  • Use travis for integration testing #115
  • attributes need to be localized to the node\['chef-os-hardening'\] namespace #113

Merged pull requests:

v1.4.1 (2016-05-29)

Full Changelog

Implemented enhancements:

Closed issues:

  • pam recipe failing with chef client > 12.8.1 #112
  • pam_passwdqc installation fails on CentOS 7.1 #102
  • tests fail in travis #94
  • Fails when used in conjunction with openldap::auth recipe #91
  • packages with known issues are not actually removed on debian/ubuntu #90
  • Actually log martians? #89
  • Archlinux doesn't have a limits.d directory by default #84
  • Support Centos 7 #79

Merged pull requests:

v1.3.1 (2015-07-04)

Full Changelog

Closed issues:

  • 1.3.0 release on supermarket is broken #83

v1.3.0 (2015-06-29)

Full Changelog

Closed issues:

  • possible incompatibility with Chef client release 12.4 #82
  • ERROR: No resource or method named File' forChef::Recipe "sysctl"' #80
  • update tutorial.md #67
  • Installation doesnt work #66

Merged pull requests:

v1.2.0 (2015-01-08)

Full Changelog

Fixed bugs:

  • Chef::Exceptions::Exec: yum_package[xinetd] (os-hardening::yum line 50) #57

Closed issues:

  • deactivate pw_max_age #58
  • can't convert String into Integer for package 'pam-ccreds' #54
  • Better error handling for cpu detection #42
  • ChefSpec and Ohai/Fauxhai: cpu #41

Merged pull requests:

v1.1.2 (2014-09-08)

Full Changelog

Closed issues:

  • sysctl dependency #44

Merged pull requests:

v1.1.1 (2014-07-28)

Full Changelog

v1.1.0 (2014-07-28)

Implemented enhancements:

  • Conservative package update #10

Closed issues:

  • Tagged Release #34
  • passwordless users not able to log in #32
  • remove ntp #19
  • Tests for suid bits #15
  • forwarding isnt configured #9
  • properly handle sysctl again #8
  • enfore security updates #7
  • enable_sysrq-check is faulty #6
  • Validate suid-bit removal from /bin/screen #5

Merged pull requests:

* This Change Log was automatically generated by github_changelog_generator

Collaborator Number Metric
            

2.0.0 passed this metric

Contributing File Metric
            

2.0.0 passed this metric

Foodcritic Metric
            

2.0.0 passed this metric

License Metric
            

2.0.0 failed this metric

os-hardening does not have a valid open source license.
Acceptable licenses include Apache-2.0, apachev2, MIT, mit, GPL-2.0, gplv2, GPL-3.0, gplv3.

No Binaries Metric
            

2.0.0 passed this metric

Publish Metric
            

2.0.0 passed this metric

Supported Platforms Metric
            

2.0.0 passed this metric

Testing File Metric
            

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of http://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

2.0.0 passed this metric