summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Bode <dan@bodepd.com>2010-03-16 03:40:19 -0500
committerDan Bode <dan@bodepd.com>2010-03-16 03:40:19 -0500
commit522f8dbb66a60a448b4e22027411004b038b7cc3 (patch)
tree55827097f48947f87865b2b8e0ae5e59a1898d2d /lib
parent9c5ff07fc1d45055510798854f4c925e408dda75 (diff)
updated documentation, added more tests
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/type/sudoers.rb84
1 files changed, 59 insertions, 25 deletions
diff --git a/lib/puppet/type/sudoers.rb b/lib/puppet/type/sudoers.rb
index 162a871..85593a2 100644
--- a/lib/puppet/type/sudoers.rb
+++ b/lib/puppet/type/sudoers.rb
@@ -1,44 +1,78 @@
Puppet::Type.newtype(:sudoers) do
@doc = "Manage the contents of /etc/sudoers
-there are two types of things here:
+Author:: Dan Bode (dan@reductivelabs.com)
+Copyright:: BLAH!!
+License:: GPL3
- sudoer{'NAME':
- ensure => (absent|present)
- type => (alias|spec) # required??
- alias => (User_alias|Runas_alias|Host_alias|Cmnd_alias),
- items => [] # this is only for aliases
- user_list => []
- host_list => []
- operator_list => []
- # NOPASSWD, PASSWD, NOEXEC, EXEC, SETENV and NOSETENV
- tag_list => []
- command_list => []
- }
+= Summary
- alias NAME - starts with CAP ([A-Z]([A-Z][0-9]_)*)
+The sudoers type supports managing individual lines from the sudoers file.
-aliases, user specifications
- User_alias
- Runas_alias
- Host_alias
- Cmnd_alias
+= Record Types
-alias spec:
+There are 3 types of records that are supported:
- Alias_Type NAME = item1, item2, item3 : NAME = item4, item5
+== Aliases:
+
+Manages an alias line of a sudoers file.
+
+Example:
+
+sudoers{'ALIAS_NAME':
+ ensure => present,
+ sudo_alias => 'Cmnd',
+ items => ['/bin/true', '/usr/bin/su - bob'],
+}
+
+creates the following line:
+
+Cmnd_Alias ALIAS_NAME=/bin/true,/usr/bin/su - bob
+
+== User Specification
+
+sudoers line that specifies how users can run commands.
+
+This there is no way to clearly determine uniqueness, a comment line is added above user spec lines that contains the namevar.
+
+Example:
+
+sudoers{'NAME':
+ ensure => present,
+ users => ['dan1', 'dan2'],
+ hosts => 'ALL',
+ commands => [
+ '(root) /usr/bin/su - easapp',
+ '(easapp)/usr/local/eas-ts/bin/appctl',
+ ],
+}
+
+creates the following line:
+
+#Puppet NAMEVAR NAME
+dan1,dan2 ALL=(root) /usr/bin/su - easapp,(easapp)/usr/local/eas-ts/bin/appctl
+
+Defaults:
+
+the default name is used to determine uniqueness.
+
+sudoers{'Defaults@host':
+ parameters => ['x=y', 'one=1', 'two=2'],
+}
+Defaults@host x=y,one=1,two=2
-order matters!!
+== Notes:
+- parsing of multi-line sudoers records is not currently supported.
+- ordering only applies when records are created.
"
- # we can either remove or add lines
- # they should also be purgable?(whats the namesvar for specs?)
+ # support absent and present (also purge -> true)
ensurable
newparam(:name) do
- desc "Either the name of the alias default or users in user spec"
+ desc "Either the name of the alias, default, or arbitrary unique string for user specifications"
isnamevar
end