~nvalcarcel/ubuntu/lucid/puppet/fix-546677

« back to all changes in this revision

Viewing changes to lib/puppet/type/macauthorization.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2009-12-23 00:48:10 UTC
  • mfrom: (1.1.10 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091223004810-3i4oryds922g5n59
Tags: 0.25.1-3ubuntu1
* Merge from debian testing.  Remaining changes:
  - debian/rules:
    + Don't start puppet when first installing puppet.
  - debian/puppet.conf, lib/puppet/defaults.rb:
    + Move templates to /etc/puppet
  - lib/puppet/defaults.rb:
    + Fix /var/lib/puppet/state ownership.
  - man/man8/puppet.conf.8: 
    + Fix broken URL in manpage.
  - debian/control:
    + Update maintainer accordint to spec.
    + Puppetmaster Recommends -> Suggests
    + Created puppet-testsuite as a seperate. Allow the users to run puppet's 
      testsuite.
  - tests/Rakefile: Fix rakefile so that the testsuite can acutally be ran.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Puppet::Type.newtype(:macauthorization) do
2
 
    
 
2
 
3
3
    @doc = "Manage the Mac OS X authorization database.
4
4
            See:
5
5
            http://developer.apple.com/documentation/Security/Conceptual/Security_Overview/Security_Services/chapter_4_section_5.html for more information."
6
 
    
 
6
 
7
7
    ensurable
8
 
    
 
8
 
9
9
    autorequire(:file) do
10
10
        ["/etc/authorization"]
11
11
    end
12
 
    
 
12
 
13
13
    def munge_boolean(value)
14
14
        case value
15
 
        when true, "true", :true:
 
15
        when true, "true", :true
16
16
            :true
17
17
        when false, "false", :false
18
18
            :false
19
19
        else
20
 
            raise Puppet::Error("munge_boolean only takes booleans")
 
20
            fail("munge_boolean only takes booleans")
21
21
        end
22
22
    end
23
23
    
 
24
    def munge_integer(value)
 
25
        begin
 
26
          Integer(value)
 
27
        rescue ArgumentError
 
28
          fail("munge_integer only takes integers")
 
29
        end
 
30
    end
 
31
 
24
32
    newparam(:name) do
25
33
        desc "The name of the right or rule to be managed.
26
 
        Corresponds to 'key' in Authorization Services. The key is the name 
27
 
        of a rule. A key uses the same naming conventions as a right. The 
28
 
        Security Server uses a rule’s key to match the rule with a right. 
29
 
        Wildcard keys end with a ‘.’. The generic rule has an empty key value. 
 
34
        Corresponds to 'key' in Authorization Services. The key is the name
 
35
        of a rule. A key uses the same naming conventions as a right. The
 
36
        Security Server uses a rule’s key to match the rule with a right.
 
37
        Wildcard keys end with a ‘.’. The generic rule has an empty key value.
30
38
        Any rights that do not match a specific rule use the generic rule."
31
39
 
32
40
        isnamevar
33
41
    end
34
 
    
 
42
 
35
43
    newproperty(:auth_type) do
36
 
        desc "type - can be a 'right' or a 'rule'. 'comment' has not yet been 
 
44
        desc "type - can be a 'right' or a 'rule'. 'comment' has not yet been
37
45
        implemented."
38
 
        
 
46
 
39
47
        newvalue(:right)
40
48
        newvalue(:rule)
41
49
        # newvalue(:comment)  # not yet implemented.
42
50
    end
43
 
    
 
51
 
44
52
    newproperty(:allow_root, :boolean => true) do
45
 
        desc "Corresponds to 'allow-root' in the authorization store, renamed 
46
 
        due to hyphens being problematic. Specifies whether a right should be 
47
 
        allowed automatically if the requesting process is running with 
48
 
        uid == 0.  AuthorizationServices defaults this attribute to false if 
 
53
        desc "Corresponds to 'allow-root' in the authorization store, renamed
 
54
        due to hyphens being problematic. Specifies whether a right should be
 
55
        allowed automatically if the requesting process is running with
 
56
        uid == 0.  AuthorizationServices defaults this attribute to false if
49
57
        not specified"
50
 
        
 
58
 
51
59
        newvalue(:true)
52
60
        newvalue(:false)
53
 
        
 
61
 
54
62
        munge do |value|
55
63
            @resource.munge_boolean(value)
56
64
        end
57
65
    end
58
 
    
 
66
 
59
67
    newproperty(:authenticate_user, :boolean => true) do
60
 
        desc "Corresponds to 'authenticate-user' in the authorization store, 
 
68
        desc "Corresponds to 'authenticate-user' in the authorization store,
61
69
        renamed due to hyphens being problematic."
62
 
        
 
70
 
63
71
        newvalue(:true)
64
72
        newvalue(:false)
65
 
        
 
73
 
66
74
        munge do |value|
67
75
            @resource.munge_boolean(value)
68
76
        end
69
77
    end
70
78
 
71
79
    newproperty(:auth_class) do
72
 
        desc "Corresponds to 'class' in the authorization store, renamed due 
 
80
        desc "Corresponds to 'class' in the authorization store, renamed due
73
81
        to 'class' being a reserved word."
74
 
        
 
82
 
75
83
        newvalue(:user)
76
84
        newvalue(:'evaluate-mechanisms')
 
85
        newvalue(:allow)
 
86
        newvalue(:deny)
 
87
        newvalue(:rule)
77
88
    end
78
 
    
 
89
 
79
90
    newproperty(:comment) do
80
91
        desc "The 'comment' attribute for authorization resources."
81
92
    end
82
 
    
 
93
 
83
94
    newproperty(:group) do
84
 
        desc "The user must authenticate as a member of this group. This 
 
95
        desc "The user must authenticate as a member of this group. This
85
96
        attribute can be set to any one group."
86
97
    end
87
 
    
 
98
 
88
99
    newproperty(:k_of_n) do
89
 
        desc "k-of-n. Built-in rights only show a value of '1' or absent, 
90
 
        other values may be acceptable. Undocumented."
 
100
        desc "k-of-n describes how large a subset of rule mechanisms must
 
101
        succeed for successful authentication. If there are 'n' mechanisms,
 
102
        then 'k' (the integer value of this parameter) mechanisms must succeed.
 
103
        The most common setting for this parameter is '1'. If k-of-n is not
 
104
        set, then 'n-of-n' mechanisms must succeed."
 
105
        
 
106
        munge do |value|
 
107
            @resource.munge_integer(value)
 
108
        end
91
109
    end
92
 
    
 
110
 
93
111
    newproperty(:mechanisms, :array_matching => :all) do
94
112
        desc "an array of suitable mechanisms."
95
113
    end
96
 
    
97
 
    newproperty(:rule, :array_match => :all) do
 
114
 
 
115
    newproperty(:rule, :array_matching => :all) do
98
116
        desc "The rule(s) that this right refers to."
99
117
    end
100
118
 
101
119
    newproperty(:session_owner, :boolean => true) do
102
 
        desc "Corresponds to 'session-owner' in the authorization store, 
103
 
        renamed due to hyphens being problematic.  Whether the session owner 
 
120
        desc "Corresponds to 'session-owner' in the authorization store,
 
121
        renamed due to hyphens being problematic.  Whether the session owner
104
122
        automatically matches this rule or right."
105
 
        
 
123
 
106
124
        newvalue(:true)
107
125
        newvalue(:false)
108
 
        
 
126
 
109
127
        munge do |value|
110
128
            @resource.munge_boolean(value)
111
129
        end
112
130
    end
113
 
    
 
131
 
114
132
    newproperty(:shared, :boolean => true) do
115
133
        desc "If this is set to true, then the Security Server marks the
116
 
        credentials used to gain this right as shared. The Security Server 
117
 
        may use any shared credentials to authorize this right. For maximum 
118
 
        security, set sharing to false so credentials stored by the Security 
 
134
        credentials used to gain this right as shared. The Security Server
 
135
        may use any shared credentials to authorize this right. For maximum
 
136
        security, set sharing to false so credentials stored by the Security
119
137
        Server for one application may not be used by another application."
120
 
        
 
138
 
121
139
        newvalue(:true)
122
140
        newvalue(:false)
123
 
        
 
141
 
124
142
        munge do |value|
125
143
            @resource.munge_boolean(value)
126
144
        end
127
145
    end
128
 
    
 
146
 
129
147
    newproperty(:timeout) do
130
 
        desc "The credential used by this rule expires in the specified 
131
 
        number of seconds. For maximum security where the user must 
132
 
        authenticate every time, set the timeout to 0. For minimum security, 
133
 
        remove the timeout attribute so the user authenticates only once per 
 
148
        desc "The credential used by this rule expires in the specified
 
149
        number of seconds. For maximum security where the user must
 
150
        authenticate every time, set the timeout to 0. For minimum security,
 
151
        remove the timeout attribute so the user authenticates only once per
134
152
        session."
 
153
        
 
154
        munge do |value|
 
155
            @resource.munge_integer(value)
 
156
        end
135
157
    end
136
 
    
 
158
 
137
159
    newproperty(:tries) do
138
160
        desc "The number of tries allowed."
 
161
        munge do |value|
 
162
            @resource.munge_integer(value)
 
163
        end
139
164
    end
140
 
    
 
165
 
141
166
end