-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sudo]: basic sudoers cookbook added
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
maintainer "Promet Solutions" | ||
maintainer_email "[email protected]" | ||
license "Apache 2.0" | ||
description "Configures sudoers" | ||
version "1.0.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package "sudo" do | ||
action :upgrade | ||
end | ||
|
||
template "/etc/sudoers" do | ||
source "sudoers.erb" | ||
mode 0440 | ||
owner "root" | ||
group "root" | ||
sudogroups = | ||
variables(:sudoers_groups => node[:active_sudo_groups], :sudoers_users => node[:active_sudo_users], :sudoers_cmd => node[:active_sudo_cmd]) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# | ||
# /etc/sudoers | ||
# | ||
# Generated by Chef for <%= @node[:fqdn] %> | ||
# | ||
|
||
Defaults env_reset | ||
|
||
# Host alias specification | ||
|
||
# User alias specification | ||
|
||
# Cmnd alias specification | ||
|
||
<% if @sudoers_groups && !@sudoers_groups.empty? %> | ||
<% @sudoers_groups.each do |group| -%> | ||
# Members of the group '<%= group %>' may gain root privileges | ||
%<%= group %> ALL=(ALL) NOPASSWD:ALL | ||
<% end -%> | ||
<% end %> | ||
|
||
# User privilege specification | ||
root ALL=(ALL) ALL | ||
<% if @sudoers_users && !@sudoers_users.empty? %> | ||
<% @sudoers_users.each do |user| -%> | ||
<%= user %> ALL=(ALL) NOPASSWD:ALL | ||
<% end -%> | ||
<% end %> | ||
|
||
<% if @sudoers_cmd && !@sudoers_cmd.empty? %> | ||
<% @sudoers_cmd.each do |cmd| -%> | ||
<%= cmd[:user] %> ALL = <%= cmd[:command] || "ALL" %> | ||
<% end -%> | ||
<% end %> |