2015-05-13 00:08:15 -04:00
|
|
|
sudo_rules Cookbook
|
|
|
|
===================
|
|
|
|
Reads through a special data bag of sudo rules to compile a list of sudoers.d rules to create/remove.
|
|
|
|
|
|
|
|
Requirements
|
|
|
|
------------
|
|
|
|
#### packages
|
|
|
|
- sudo
|
|
|
|
|
|
|
|
Attributes
|
|
|
|
----------
|
|
|
|
|
|
|
|
#### sudo_rules::default
|
2015-05-13 12:23:45 -04:00
|
|
|
|
2015-05-18 10:36:51 -04:00
|
|
|
Key | Type | Description | Default
|
|
|
|
-------------------------------- | ------ | ---------------------------------------------------------- | ----------
|
|
|
|
`['sudo_rules']['data_bag']` | String | Name of data bag to use for entries. | sudo_rules
|
|
|
|
`['sudo_rules']['search_query']` | String | Custom search query for matching instead of just host:fqdn | None
|
2015-05-13 00:08:15 -04:00
|
|
|
|
2015-05-13 12:35:27 -04:00
|
|
|
#### data bag
|
|
|
|
|
2015-05-13 12:36:59 -04:00
|
|
|
Key | Type | Description | Default | Required?
|
|
|
|
---------- | ------ | ------------------------------------------------------------------------------------ | ---------- | ---------
|
|
|
|
`id` | String | Name of Data Bag item, and sudoers.d/Id filename. | None | Yes
|
|
|
|
`name` | String | Instead of using Id, you can choose the name of the file for sudoers.d/Name instead. | Same as Id | No
|
|
|
|
`hosts` | Array | List of hosts to apply this rule to by fqdn, can be wildcard matched. | [] | Yes
|
|
|
|
`action` | String | `create` or `remove` Sets whether to create or remove the entry. | `create` | No
|
|
|
|
`user` | String | Username or %Groupname to use for the sudo rule. | None | Yes
|
|
|
|
`runas` | String | Allowed colon-separated list of users for sudoers runas. | `ALL` | No
|
|
|
|
`commands` | Array | List of commands (and arguments) this rule adds for the user/group. | [] | Yes
|
|
|
|
`defaults` | Array | List of defaults this user has. | [] | No
|
2015-05-13 12:35:27 -04:00
|
|
|
|
2015-05-13 00:08:15 -04:00
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
#### sudo_rules::default
|
|
|
|
|
|
|
|
Include `sudo_rules` in your node's `run_list`:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name":"my_node",
|
|
|
|
"run_list": [
|
|
|
|
"recipe[sudo_rules]"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
And provide properly formatted data bag:
|
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": "Data Bag unique name, default value for name below",
|
2015-05-13 09:17:35 -04:00
|
|
|
"name": "Name of the sudoers.d file",
|
2015-05-13 00:08:15 -04:00
|
|
|
"hosts": [
|
|
|
|
"fqdn1",
|
|
|
|
"fqdn2",
|
|
|
|
...
|
|
|
|
],
|
|
|
|
"action": "create",
|
|
|
|
"user": "someuser",
|
|
|
|
"runas": "ALL",
|
|
|
|
"commands": [
|
|
|
|
"/usr/sbin/somecommand args",
|
|
|
|
"/usr/sbin/anothercommand",
|
|
|
|
...
|
|
|
|
],
|
|
|
|
"defaults": [
|
|
|
|
"env_reset"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Contributing
|
|
|
|
------------
|
2015-05-18 10:36:51 -04:00
|
|
|
1. Fork the repository on Github.
|
|
|
|
2. Switch to the develop branch.
|
2015-05-18 10:41:07 -04:00
|
|
|
3. Create a named feature branch off develop (like `githubusername/feature/add_component_x`).
|
2015-05-18 10:36:51 -04:00
|
|
|
4. Write your change.
|
2015-05-18 10:41:07 -04:00
|
|
|
5. Update documentation if appropriate.
|
|
|
|
6. Write tests for your change (if applicable).
|
|
|
|
7. Run the tests, ensuring they all pass.
|
|
|
|
8. Submit a Pull Request using Github to develop branch.
|
2015-05-13 00:08:15 -04:00
|
|
|
|
2015-05-13 12:34:09 -04:00
|
|
|
or
|
|
|
|
|
|
|
|
1. Report issue on Github
|
|
|
|
|
2015-05-13 00:08:15 -04:00
|
|
|
License and Authors
|
|
|
|
-------------------
|
2015-05-18 10:36:51 -04:00
|
|
|
Authors: Eric Renfro <erenfro@linux-help.org>
|
|
|
|
Contributers: Pieter Vogelaar
|
2015-05-13 00:08:15 -04:00
|
|
|
|