项目作者: avectris

项目描述 :
Chef Cookbook for sudo managed from data bag items
高级语言: Ruby
项目地址: git://github.com/avectris/chef_sudo_databag.git
创建时间: 2018-08-06T11:30:58Z
项目社区:https://github.com/avectris/chef_sudo_databag

开源协议:GNU General Public License v3.0

下载


build

sudo_databag Cookbook

Configure the sudo program.

Requirements

Cookbooks

Platforms

The following platforms are supported and tested with Test Kitchen:

  • Ubuntu 14.04+
  • CentOS 6+

Other Debian and RHEL family distributions are assumed to work.

Chef

  • Chef 14.3+

Attributes

Node attributes for this cookbook are logically separated into different files. Some attributes are set only via a specific recipe.

project::option

These attributes are used in the project::option recipe.

  • node['sudo_databag']['databag']['name'] - Data Bag name
  • node['sudo_databag']['databag']['items'] - Data Bag item names

Data Bags

Item Basic

There is a minimum one data bag item. The name of this data bag item must be basic. In this item, you define the least common denominator.

example of basic

  1. {
  2. "id": "basic",
  3. "include_sudoers_d": true,
  4. "defaults": {
  5. "env_reset": null,
  6. "secure_path": "/sbin:/bin:/usr/sbin:/usr/bin",
  7. "env_keep": "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
  8. "user": {
  9. "ressl_robert": [
  10. "!requiretty",
  11. "!env_reset"
  12. ]
  13. }
  14. },
  15. "aliases": {
  16. "cmnd": {
  17. "shutdown": [
  18. "/sbin/poweroff",
  19. "/sbin/reboot",
  20. "/sbin/halt"
  21. ],
  22. "printing": [
  23. "/usr/sbin/lpc",
  24. "/usr/sbin/lprm"
  25. ]
  26. },
  27. "user": {
  28. "admins": [
  29. "%admin",
  30. "%whell"
  31. ],
  32. "users": [
  33. "robert",
  34. "roland"
  35. ]
  36. },
  37. "runas": {
  38. "root": [
  39. "#0"
  40. ],
  41. "admins": [
  42. "%admin",
  43. "root"
  44. ]
  45. },
  46. "host": {
  47. "servers": [
  48. "192.168.0.1",
  49. "192.168.0.2",
  50. "server1"
  51. ],
  52. "network": [
  53. "192.168.0.0/255.255.255.0"
  54. ],
  55. "workstations": [
  56. "NETWORK",
  57. "!SERVER"
  58. ]
  59. }
  60. },
  61. "groups": {
  62. "wheel_all": {
  63. "group": "wheel",
  64. "host": "ALL",
  65. "operator": "ALL",
  66. "tag": "nopasswd",
  67. "command": [
  68. "ALL"
  69. ]
  70. },
  71. "ressl_ls-cat": {
  72. "group": "ressl",
  73. "host": "ALL",
  74. "operator": "ALL",
  75. "tag": null,
  76. "command": [
  77. "/bin/ls",
  78. "/bin/cat"
  79. ]
  80. }
  81. },
  82. "users": {
  83. "wheel_all": {
  84. "user": "wheel",
  85. "host": "ALL",
  86. "operator": "ALL",
  87. "tag": "nopasswd",
  88. "command": [
  89. "ALL"
  90. ]
  91. },
  92. "robert_ressl_ls-cat": {
  93. "user": "robert_ressl",
  94. "host": "ALL",
  95. "operator": "ALL",
  96. "tag": null,
  97. "command": [
  98. "/bin/ls",
  99. "/bin/cat"
  100. ]
  101. }
  102. },
  103. "production": {},
  104. "staging": {},
  105. "testing": {},
  106. "integration": {},
  107. "development": {
  108. "defaults": {
  109. "env_reset": null,
  110. "secure_path": "/sbin:/bin:/usr/sbin:/usr/bin",
  111. "env_keep": "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY",
  112. "user": {
  113. "robert_ressl": [
  114. "!requiretty",
  115. "!env_reset"
  116. ]
  117. }
  118. },
  119. "aliases": {
  120. "cmnd": {
  121. "shutdown_development": [
  122. "/sbin/poweroff",
  123. "/sbin/reboot",
  124. "/sbin/halt"
  125. ],
  126. "printing_development": [
  127. "/usr/sbin/lpc",
  128. "/usr/sbin/lprm"
  129. ]
  130. },
  131. "user": {
  132. "admins_development": [
  133. "%admin",
  134. "%whell"
  135. ],
  136. "users_development": [
  137. "robert",
  138. "roland"
  139. ]
  140. },
  141. "runas": {
  142. "root_development": [
  143. "#0"
  144. ],
  145. "admins_development": [
  146. "%admin",
  147. "root"
  148. ]
  149. },
  150. "host": {
  151. "servers_development": [
  152. "192.168.0.1",
  153. "192.168.0.2",
  154. "server1"
  155. ],
  156. "network_development": [
  157. "192.168.0.0/255.255.255.0"
  158. ],
  159. "workstations_development": [
  160. "NETWORK",
  161. "!SERVER"
  162. ]
  163. }
  164. },
  165. "groups": {
  166. "wheel_development_all": {
  167. "group": "wheel_development",
  168. "host": "ALL",
  169. "operator": "ALL",
  170. "tag": "nopasswd",
  171. "command": [
  172. "ALL"
  173. ]
  174. },
  175. "ressl_development_ls-cat": {
  176. "group": "ressl_development",
  177. "host": "ALL",
  178. "operator": "ALL",
  179. "tag": null,
  180. "command": [
  181. "/bin/ls",
  182. "/bin/cat"
  183. ]
  184. }
  185. },
  186. "users": {
  187. "wheel_development_all": {
  188. "user": "wheel_development",
  189. "host": "ALL",
  190. "operator": "ALL",
  191. "tag": "nopasswd",
  192. "command": [
  193. "ALL"
  194. ]
  195. },
  196. "robert_ressl_development_ls-cat": {
  197. "user": "robert_ressl_development",
  198. "host": "ALL",
  199. "operator": "ALL",
  200. "tag": null,
  201. "command": [
  202. "/bin/ls",
  203. "/bin/cat"
  204. ]
  205. }
  206. }
  207. }
  208. }

extra item

You can define specific items for a group of nodes or only one.

example extra item

without environments
  1. {
  2. "id": "example",
  3. "groups": {
  4. "example_wheel_all": {
  5. "group": "example_wheel",
  6. "host": "ALL",
  7. "operator": "ALL",
  8. "tag": "nopasswd",
  9. "command": [
  10. "ALL"
  11. ]
  12. },
  13. "example_ressl_ls-cat": {
  14. "group": "example_ressl",
  15. "host": "ALL",
  16. "operator": "ALL",
  17. "tag": null,
  18. "command": [
  19. "/bin/ls",
  20. "/bin/cat"
  21. ]
  22. }
  23. },
  24. "users": {
  25. "example_wheel_all": {
  26. "user": "example_wheel",
  27. "host": "ALL",
  28. "operator": "ALL",
  29. "tag": "nopasswd",
  30. "command": [
  31. "ALL"
  32. ]
  33. },
  34. "example_robert_ressl_ls-cat": {
  35. "user": "example_robert_ressl",
  36. "host": "ALL",
  37. "operator": "ALL",
  38. "tag": null,
  39. "command": [
  40. "/bin/ls",
  41. "/bin/cat"
  42. ]
  43. },
  44. "example_robert_ressl_who": {
  45. "user": "example_robert_ressl",
  46. "host": "ALL",
  47. "operator": "ALL",
  48. "tag": null,
  49. "command": [
  50. "/usr/bin/who"
  51. ]
  52. }
  53. }
  54. }
with environments
  1. {
  2. "id": "example3",
  3. "production": {},
  4. "staging": {},
  5. "testing": {},
  6. "integration": {},
  7. "development": {
  8. "groups": {
  9. "example3_development_wheel_all": {
  10. "group": "example3_development_wheel",
  11. "host": "ALL",
  12. "operator": "ALL",
  13. "tag": "nopasswd",
  14. "command": [
  15. "ALL"
  16. ]
  17. },
  18. "example3_development_ressl_ls-cat": {
  19. "group": "example3_development_ressl",
  20. "host": "ALL",
  21. "operator": "ALL",
  22. "tag": null,
  23. "command": [
  24. "/bin/ls",
  25. "/bin/cat"
  26. ]
  27. }
  28. },
  29. "users": {
  30. "example3_development_wheel_all": {
  31. "user": "example3_development_wheel",
  32. "host": "ALL",
  33. "operator": "ALL",
  34. "tag": "nopasswd",
  35. "command": [
  36. "ALL"
  37. ]
  38. },
  39. "example3_development_robert_ressl_ls-cat": {
  40. "user": "example3_development_robert_ressl",
  41. "host": "ALL",
  42. "operator": "ALL",
  43. "tag": null,
  44. "command": [
  45. "/bin/ls",
  46. "/bin/cat"
  47. ]
  48. }
  49. }
  50. }
  51. }

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU Affero General Public License v3.0 License - see the LICENSE file for details

Acknowledgments

Thanks to…