This cookbook provides a secure overlay for apache configuration.
- chef
- Debian 7, 8
- Ubuntu 14.04, 16.04
- CentOS 6.8, 7.2
- OracleLinux 6.8, 7.2
A sample role may look like:
{
"name": "apache",
"default_attributes": { },
"override_attributes": { },
"json_class": "Chef::Role",
"description": "Apache Hardened Server Test Role",
"chef_type": "role",
"run_list": [
"recipe[apt]",
"recipe[apache2]",
"recipe[apache-hardening]"
]
}
This recipe is an overlay recipe for the apache2 cookbook and applies apache-hardening::hardening
Add the following to your runlist and customize security option attributes
"recipe[apache2]",
"recipe[apache-hardening]"
This hardening recipe installs the hardening but expects an existing installation of Apache2.
-
node['apache']['traceenable'] = 'Off'
This directive overrides the behavior of TRACE for both the core server and mod_proxy. See https://httpd.apache.org/docs/2.2/mod/core.html#traceenable for details Defaults to:Off
-
node['apache_hardening']['allowed_http_methods'] = %w( GET POST )
A list of HTTP methods that should be allowed in the server. See https://httpd.apache.org/docs/trunk/mod/mod_allowmethods.html for details Defaults to:GET POST
-
node['apache_hardening']['modules_to_disable'] = %w( cgi cgid )
This parameter sets a list of modules that should be disabled on the target server. See https://httpd.apache.org/docs/current/mod/ for details Defaults to:cgi cgid
For local testing you can use vagrant or docker to run tests locally. You will have to install Virtualbox and Vagrant or docker on your system. See Vagrant Downloads for a vagrant or Docker Downloads package suitable for your system. For all our tests we use test-kitchen
. If you are not familiar with test-kitchen
please have a look at their guide.
# Install dependencies
gem install bundler
bundle install
# Do lint checks
bundle exec rake lint
# fast test on one machine
bundle exec kitchen test default-ubuntu-1404
# test on all machines
bundle exec kitchen test
# for development
bundle exec kitchen create default-ubuntu-1404
bundle exec kitchen converge default-ubuntu-1404
bundle exec kitchen verify default-ubuntu-1204
- Dominik Richter arlimus
- Christoph Hartmann chris-rock
- Patrick Muench atomic111
- Edmund Haselwanter ehaselwanter
- Author:: Deutsche Telekom AG
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
https://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.