ansible-collection-hardening/CONTRIBUTING.md

99 lines
4.6 KiB
Markdown
Raw Normal View History

# Contributor Guideline
2015-05-04 21:37:22 +00:00
This document provides an overview of how you can participate in improving this project or extending it. We are grateful for all your help: bug reports and fixes, code contributions, documentation or ideas. Feel free to join, we appreciate your support!!
2015-05-04 21:37:22 +00:00
## Communication
2015-05-04 21:37:22 +00:00
### GitHub repositories
2015-05-04 21:37:22 +00:00
Much of the issues, goals and ideas are tracked in the respective projects in GitHub. Please use this channel to report bugs and post ideas.
2015-05-04 21:37:22 +00:00
## git and GitHub
2015-05-04 21:37:22 +00:00
In order to contribute code please:
2015-05-04 21:37:22 +00:00
1. Fork the project on GitHub
2. Clone the project
3. Add changes (and tests)
4. Commit, sign off and push your changes
5. Create a merge-request
2015-05-04 21:37:22 +00:00
To have your code merged, see the expectations listed below.
2015-05-04 21:37:22 +00:00
You can find a well-written guide [here](https://help.github.com/articles/fork-a-repo).
2015-05-04 21:37:22 +00:00
Please follow common commit best-practices. Be explicit, have a short summary, a well-written description and references. This is especially important for the merge-request.
2015-05-04 21:37:22 +00:00
Some great guidelines can be found [here](https://wiki.openstack.org/wiki/GitCommitMessages) and [here](http://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message).
2015-05-04 21:37:22 +00:00
## Expectations
2015-05-04 21:37:22 +00:00
## Sign off Your Work
The Developer Certificate of Origin (DCO) is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project.
[Here is the full text of the DCO](http://developercertificate.org/).
Contributors must sign-off that they adhere to these requirements by adding a `Signed-off-by` line to commit messages.
```text
This is my commit message
Signed-off-by: Random J Developer <random@developer.example.org>
```
Git even has a -s command line option to append this automatically to your commit message:
```text
git commit -s -m 'This is my commit message'
```
### Don't reinvent the wheel
2015-05-04 21:37:22 +00:00
This hardening project doesn't intend to reinvent the configuration stack for services. Aim to use official configuration projects first and provide hardening as a layer on top. The goal is remove the need for a user to configure all aspects of services and maintain security configuration. This way, the user can still configure a service using the interface provided by the official project.
2015-05-04 21:37:22 +00:00
2020-11-08 10:20:25 +00:00
- For Chef refer to the official [opscode community cookbooks](http://community.opscode.com/cookbooks).
- For Puppet head to the [Puppet Forge](https://forge.puppetlabs.com/) and take a node of the Puppet supported modules.
- For Ansible check the [Ansible Module Index](http://docs.ansible.com/list_of_all_modules.html)
2015-05-04 21:37:22 +00:00
These projects are generally hosted on GitHub as well.
2015-05-04 21:37:22 +00:00
In some cases, we in fact create the full rollout stack, but this is generally the exception ([os-hardening](https://github.com/TelekomLabs/chef-os-hardening), [nginx-hardening](https://github.com/TelekomLabs/chef-nginx-hardening)).
2015-05-04 21:37:22 +00:00
### Be explicit
2015-05-04 21:37:22 +00:00
2020-11-08 10:20:25 +00:00
- Please avoid using nonsensical property and variable names.
- Use self-describing attribute names for user configuration.
- In case of failures, communicate what happened and why a failure occurs to the user. Make it easy to track the code or action that produced the error. Try to catch and handle errors if possible to provide improved failure messages.
2015-05-04 21:37:22 +00:00
### Add tests
2015-05-04 21:37:22 +00:00
The security review of this project is done using integration tests.
2015-05-04 21:37:22 +00:00
Whenever you add a new security configuration, please start by writing a test that checks for this configuration. For example: If you want to set a new attribute in a configuration file, write a test that expects the value to be set first. Then implement your change.
2015-05-04 21:37:22 +00:00
You may add a new feature request by creating a test for whatever value you need.
2015-05-04 21:37:22 +00:00
All tests will be reviewed internally for their validity and overall project direction.
2015-05-04 21:37:22 +00:00
### Document your code
2015-05-04 21:37:22 +00:00
2020-11-08 10:20:25 +00:00
As code is more often read than written, please provide documentation in all projects.
2015-05-04 21:37:22 +00:00
Adhere to the respective guidelines for documentation:
2015-05-04 21:37:22 +00:00
2020-11-08 10:20:25 +00:00
- Chef generally documents code based explicit readme files. For code documentation please use [yard-chef](https://github.com/rightscale/yard-chef)
- [Puppet module documentation](http://docs.puppetlabs.com/puppet/latest/reference/modules_documentation.html)
2015-05-04 21:37:22 +00:00
### Follow coding styles
2015-05-04 21:37:22 +00:00
We generally include test for coding guidelines:
2015-05-04 21:37:22 +00:00
2020-11-08 10:20:25 +00:00
- Chef follows [Foodcritic](http://acrmp.github.io/foodcritic/)
- Puppet is checked with [puppet-lint](http://puppet-lint.com/checks/)
- Ansible is checked by running the playbook with the syntax-check option, e.g. `ansible-playbook foo.yml --syntax-check`
2015-05-04 21:37:22 +00:00
Remember: Code is generally read much more often than written.
2015-05-04 21:37:22 +00:00
### Use Markdown
2015-05-04 21:37:22 +00:00
Wherever possible, please refrain from any other formats and stick to simple markdown.