All Projects → chef-boneyard → sudo

chef-boneyard / sudo

Licence: Apache-2.0 License
Development repository for sudo cookbook

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to sudo

Sudo
Development repository for sudo cookbook
Stars: ✭ 113 (-5.04%)
Mutual labels:  chef, sudo, cookbook
postfixadmin-cookbook
Chef cookbook to install and configure PostfixAdmin.
Stars: ✭ 13 (-89.08%)
Mutual labels:  chef, cookbook
chef-postgres-hardening
This chef cookbook provides security configuration for PostgreSQL.
Stars: ✭ 26 (-78.15%)
Mutual labels:  chef, cookbook
audit
Audit Cookbook for Chef Compliance
Stars: ✭ 58 (-51.26%)
Mutual labels:  chef, cookbook
delivery-truck
DEPRECATED: Delivery build cb for pipelines
Stars: ✭ 36 (-69.75%)
Mutual labels:  chef, cookbook
omnibus
Prepares a machine to be an Omnibus builder. ┬──┬◡ノ(° -°ノ)
Stars: ✭ 28 (-76.47%)
Mutual labels:  chef, cookbook
owncloud-cookbook
Chef cookbook to install and configure ownCloud.
Stars: ✭ 39 (-67.23%)
Mutual labels:  chef, cookbook
Arcgis Cookbook
Chef cookbooks for ArcGIS
Stars: ✭ 227 (+90.76%)
Mutual labels:  chef, cookbook
chef-client
Development repository for Chef Client cookbook
Stars: ✭ 181 (+52.1%)
Mutual labels:  chef, cookbook
mysql tuning-cookbook
Chef cookbook to create MySQL configuraiton files better suited for your system.
Stars: ✭ 23 (-80.67%)
Mutual labels:  chef, cookbook
push-jobs-cookbook
Development repository for Chef Cookbook push-jobs
Stars: ✭ 21 (-82.35%)
Mutual labels:  chef, cookbook
ohai
Development repository for Chef Cookbook ohai
Stars: ✭ 49 (-58.82%)
Mutual labels:  chef, cookbook
cookbook-cq
Chef cookbook for Adobe CQ (aka AEM)
Stars: ✭ 20 (-83.19%)
Mutual labels:  chef, cookbook
chef-ulimit
This is a simple chef cookbook that provides a defintion for managing user_ulimit settings.
Stars: ✭ 43 (-63.87%)
Mutual labels:  chef, cookbook
Windows
Development repository for Chef Cookbook windows
Stars: ✭ 251 (+110.92%)
Mutual labels:  chef, cookbook
auditd
Install and configure user mode auditd tools
Stars: ✭ 31 (-73.95%)
Mutual labels:  chef, cookbook
aix
Resources for AIX hosts
Stars: ✭ 22 (-81.51%)
Mutual labels:  chef, cookbook
Chef Server
Cookbook to install standalone Chef Server
Stars: ✭ 173 (+45.38%)
Mutual labels:  chef, cookbook
Chef Client
Development repository for Chef Client cookbook
Stars: ✭ 183 (+53.78%)
Mutual labels:  chef, cookbook
chef-ingredient
Primitives for managing Chef products and packages
Stars: ✭ 43 (-63.87%)
Mutual labels:  chef, cookbook

sudo cookbook

Build Status Cookbook Version

The default recipe configures the /etc/sudoers file.

Deprecation

The sudo resource is now included in Chef Infra Client 14 and later. This cookbook is no longer necessary and should not be used. Used the resource directly https://docs.chef.io/resources/sudo/

Requirements

Platforms

  • AIX
  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle
  • Amazon Linux
  • FreeBSD
  • macOS
  • openSUSE / SUSE Enterprise

Chef

  • Chef 14+

Cookbooks

  • None

Attributes

  • node['authorization']['sudo']['groups'] - groups to enable sudo access (default: [])
  • node['authorization']['sudo']['users'] - users to enable sudo access (default: [])
  • node['authorization']['sudo']['passwordless'] - use passwordless sudo (default: false)
  • node['authorization']['sudo']['include_sudoers_d'] - include and manage /etc/sudoers.d (default: true on Linux systems. Note: older / EOL distros do not support this feature)
  • node['authorization']['sudo']['agent_forwarding'] - preserve SSH_AUTH_SOCK when sudoing (default: false)
  • node['authorization']['sudo']['sudoers_defaults'] - Array of Defaults entries to configure in /etc/sudoers
  • node['authorization']['sudo']['setenv'] - Whether to permit preserving of environment with sudo -E (default: false)

Using the Attributes

To use attributes for defining sudoers, set the attributes above on the node (or role) itself:

{
  "default_attributes": {
    "authorization": {
      "sudo": {
        "groups": ["admin", "wheel", "sysadmin"],
        "users": ["jerry", "greg"],
        "passwordless": "true"
      }
    }
  }
}
{
  "default_attributes": {
    "authorization": {
      "sudo": {
        "command_aliases": [{
          "name": "TEST",
          "command_list": [
            "/usr/bin/ls",
            "/usr/bin/cat"
          ]
        }],
        "custom_commands": {
          "users": [
            {
              "user": "test_user",
              "passwordless": true,
              "command_list": [
                "TEST"
              ]
            }
          ],
          "groups": [
            {
              "group": "test_group",
              "passwordless": false,
              "command_list": [
                "TEST"
              ]
            }
          ]
        }
      }
    }
  }
}
# roles/example.rb
default_attributes(
  "authorization" => {
    "sudo" => {
      "groups" => ["admin", "wheel", "sysadmin"],
      "users" => ["jerry", "greg"],
      "passwordless" => true
    }
  }
)

Note that the template for the sudoers file has the group "sysadmin" with ALL:ALL permission, though the group by default does not exist.

Sudoers Defaults

Configure a node attribute, node['authorization']['sudo']['sudoers_defaults'] as an array of Defaults entries to configure in /etc/sudoers. A list of examples for common platforms is listed below:

Debian

node.default['authorization']['sudo']['sudoers_defaults'] = ['env_reset']

Ubuntu

node.default['authorization']['sudo']['sudoers_defaults'] = [
  'env_reset',
  'secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"'
]

FreeBSD

node.default['authorization']['sudo']['sudoers_defaults'] = [
  'env_reset',
  'secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"'
]

RHEL family 6.x

node.default['authorization']['sudo']['sudoers_defaults'] = [
  '!visiblepw',
  'env_reset',
  'env_keep =  "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS"',
  'env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE"',
  'env_keep += "LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES"',
  'env_keep += "LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE"',
  'env_keep += "LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY"',
  'env_keep += "HOME"',
  'always_set_home',
  'secure_path = /sbin:/bin:/usr/sbin:/usr/bin'
]

macOS

node.default['authorization']['sudo']['sudoers_defaults'] = [
  'env_reset',
  'env_keep += "BLOCKSIZE"',
  'env_keep += "COLORFGBG COLORTERM"',
  'env_keep += "__CF_USER_TEXT_ENCODING"',
  'env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"',
  'env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"',
  'env_keep += "LINES COLUMNS"',
  'env_keep += "LSCOLORS"',
  'env_keep += "TZ"',
  'env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"',
  'env_keep += "EDITOR VISUAL"',
  'env_keep += "HOME MAIL"'
]

Maintainers

This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our team documentation. To learn more about contributing to cookbooks like this see our contributing documentation, or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the Chef Community Slack

License

Copyright: 2008-2018, Chef Software, Inc.

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].