sudo: File name fix for sudoer
This commit is contained in:
parent
e952bc4920
commit
ee30f9e1ad
1 changed files with 18 additions and 5 deletions
|
@ -41,8 +41,8 @@ class sudo {
|
||||||
#
|
#
|
||||||
# === Parameters
|
# === Parameters
|
||||||
#
|
#
|
||||||
# $name:
|
# $who:
|
||||||
# User or group. Prefix group name with %.
|
# User or group. Prefix group name with %. Defaults to $name.
|
||||||
# $where:
|
# $where:
|
||||||
# Defaults to ALL.
|
# Defaults to ALL.
|
||||||
# $as_whom:
|
# $as_whom:
|
||||||
|
@ -50,9 +50,22 @@ class sudo {
|
||||||
# $what:
|
# $what:
|
||||||
# Defaults to ALL.
|
# Defaults to ALL.
|
||||||
#
|
#
|
||||||
define sudo::sudoer($where="ALL", $as_whom="ALL", $what="ALL") {
|
define sudo::sudoer(
|
||||||
|
$who=undef,
|
||||||
|
$where="ALL",
|
||||||
|
$as_whom="ALL",
|
||||||
|
$what="ALL"
|
||||||
|
) {
|
||||||
|
|
||||||
file { "/etc/sudoers.d/${name}":
|
if ! $who {
|
||||||
|
$who_real = $name
|
||||||
|
} else {
|
||||||
|
$who_real = $who
|
||||||
|
}
|
||||||
|
|
||||||
|
$name_real = regsubst($name, '%', '_')
|
||||||
|
|
||||||
|
file { "/etc/sudoers.d/${name_real}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
mode => "0440",
|
mode => "0440",
|
||||||
owner => "root",
|
owner => "root",
|
||||||
|
@ -60,7 +73,7 @@ define sudo::sudoer($where="ALL", $as_whom="ALL", $what="ALL") {
|
||||||
"openbsd" => "wheel",
|
"openbsd" => "wheel",
|
||||||
default => "root",
|
default => "root",
|
||||||
},
|
},
|
||||||
content => "${name}\t${where}=(${as_whom})\t${what}\n",
|
content => "${who_real}\t${where}=(${as_whom})\t${what}\n",
|
||||||
require => File["/etc/sudoers"],
|
require => File["/etc/sudoers"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue