Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding rhn & vncserver, and transitioning sudo to submodule

  • Loading branch information...
commit b3211b577ff2f71532bc41486928db3a34edc345 1 parent e77841d
Troy Ready authored March 06, 2013
3  .gitmodules
@@ -58,3 +58,6 @@
58 58
 [submodule "ufw"]
59 59
 	path = ufw
60 60
 	url = git://github.com/opscode-cookbooks/ufw.git
  61
+[submodule "sudo"]
  62
+	path = sudo
  63
+	url = git://github.com/opscode-cookbooks/sudo.git
12  rhn/CHANGELOG.md
Source Rendered
... ...
@@ -0,0 +1,12 @@
  1
+# CHANGELOG for rhn
  2
+
  3
+This file is used to list changes made in each version of rhn.
  4
+
  5
+## 0.1.0:
  6
+
  7
+* Initial release of rhn
  8
+
  9
+- - -
  10
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
  11
+
  12
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
70  rhn/README.md
Source Rendered
... ...
@@ -0,0 +1,70 @@
  1
+rhn Cookbook
  2
+============
  3
+This cookbook registers RHEL systems to RHN. Currently using the rhnreg\_ks tool
  4
+
  5
+TODO: Add support for subscription-manager & activation keys
  6
+
  7
+Requirements
  8
+------------
  9
+
  10
+#### distro
  11
+- Tested on RHEL 5
  12
+
  13
+Attributes
  14
+----------
  15
+
  16
+#### rhn::default
  17
+<table>
  18
+  <tr>
  19
+    <th>Key</th>
  20
+    <th>Type</th>
  21
+    <th>Description</th>
  22
+    <th>Default</th>
  23
+  </tr>
  24
+  <tr>
  25
+    <td><tt>['rhn']['username']</tt></td>
  26
+    <td>string</td>
  27
+    <td>RHN username for registering nodes</td>
  28
+    <td><tt>username</tt></td>
  29
+  </tr>
  30
+  <tr>
  31
+    <td><tt>['rhn']['password']</tt></td>
  32
+    <td>string</td>
  33
+    <td>RHN user's password</td>
  34
+    <td><tt>password</tt></td>
  35
+  </tr>
  36
+</table>
  37
+
  38
+Usage
  39
+-----
  40
+#### rhn::default
  41
+
  42
+* Set the username & password attributes specified above
  43
+* Include `rhn` in your node's `run_list`:
  44
+
  45
+```json
  46
+{
  47
+  "name":"my_node",
  48
+  "run_list": [
  49
+    "recipe[rhn]"
  50
+  ]
  51
+}
  52
+```
  53
+
  54
+
  55
+License and Authors
  56
+-------------------
  57
+ Copyright 2013, Biola University 
  58
+
  59
+ Licensed under the Apache License, Version 2.0 (the "License");
  60
+ you may not use this file except in compliance with the License.
  61
+ You may obtain a copy of the License at
  62
+
  63
+ http://www.apache.org/licenses/LICENSE-2.0
  64
+
  65
+ Unless required by applicable law or agreed to in writing, software
  66
+ distributed under the License is distributed on an "AS IS" BASIS,
  67
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  68
+ See the License for the specific language governing permissions and
  69
+ limitations under the License.
  70
+
2  rhn/attributes/default.rb
... ...
@@ -0,0 +1,2 @@
  1
+default['rhn']['username']               = "username"
  2
+default['rhn']['password']               = "password"
7  rhn/metadata.rb
... ...
@@ -0,0 +1,7 @@
  1
+name             'rhn'
  2
+maintainer       'Biola University'
  3
+maintainer_email 'troy.ready@biola.edu'
  4
+license          'Apache 2.0'
  5
+description      'Registers systems with EL subscription network'
  6
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
  7
+version          '0.1.0'
13  sudo/attributes/default.rb → rhn/recipes/default.rb
... ...
@@ -1,14 +1,14 @@
1 1
 #
2  
-# Cookbook Name:: sudo
3  
-# Attribute File:: default
  2
+# Cookbook Name:: rhn
  3
+# Recipe:: default
4 4
 #
5  
-# Copyright 2008-2011, Opscode, Inc.
  5
+# Copyright 2013, Biola University 
6 6
 #
7 7
 # Licensed under the Apache License, Version 2.0 (the "License");
8 8
 # you may not use this file except in compliance with the License.
9 9
 # You may obtain a copy of the License at
10 10
 #
11  
-#     http://www.apache.org/licenses/LICENSE-2.0
  11
+# http://www.apache.org/licenses/LICENSE-2.0
12 12
 #
13 13
 # Unless required by applicable law or agreed to in writing, software
14 14
 # distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,7 +17,4 @@
17 17
 # limitations under the License.
18 18
 #
19 19
 
20  
-default['authorization']['sudo']['groups'] = Array.new
21  
-default['authorization']['sudo']['users'] = Array.new
22  
-default['authorization']['sudo']['passwordless'] = false
23  
-default['authorization']['sudo']['include_sudoers_d'] = false
  20
+include_recipe "rhn::rhel5"
25  rhn/recipes/rhel5.rb
... ...
@@ -0,0 +1,25 @@
  1
+#
  2
+# Cookbook Name:: rhn
  3
+# Recipe:: rhel5
  4
+#
  5
+# Copyright 2013, Biola University 
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+# http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+#
  19
+
  20
+unless File.exists?("/etc/sysconfig/rhn/systemid")
  21
+  execute "register_rhn" do
  22
+    command "rhnreg_ks --username \"#{node['rhn']['username']}\" --password \"#{node['rhn']['password']}\"" 
  23
+  end
  24
+end
  25
+
1  snmp_biola/.gitignore
... ...
@@ -0,0 +1 @@
  1
+metadata.json
1  sudo
... ...
@@ -0,0 +1 @@
  1
+Subproject commit 5c3238e1db680e80ba60a39d40765653babb752a
7  sudo/CHANGELOG.md
Source Rendered
... ...
@@ -1,7 +0,0 @@
1  
-## v1.1.0:
2  
-
3  
-* [COOK-350] - LWRP to manage sudo files via includedir (/etc/sudoers.d)
4  
-
5  
-## v1.0.2:
6  
-
7  
-* [COOK-903] - freebsd support
29  sudo/CONTRIBUTING
... ...
@@ -1,29 +0,0 @@
1  
-If you would like to contribute, please open a ticket in JIRA:
2  
-
3  
-* http://tickets.opscode.com
4  
-
5  
-Create the ticket in the COOK project and use the cookbook name as the
6  
-component.
7  
-
8  
-For all code contributions, we ask that contributors sign a
9  
-contributor license agreement (CLA). Instructions may be found here:
10  
-
11  
-* http://wiki.opscode.com/display/chef/How+to+Contribute
12  
-
13  
-When contributing changes to individual cookbooks, please do not
14  
-modify the version number in the metadata.rb. Also please do not
15  
-update the CHANGELOG.md for a new version. Not all changes to a
16  
-cookbook may be merged and released in the same versions. Opscode will
17  
-handle the version updates during the release process. You are welcome
18  
-to correct typos or otherwise make updates to documentation in the
19  
-README.
20  
-
21  
-If a contribution adds new platforms or platform versions, indicate
22  
-such in the body of the commit message(s), and update the relevant
23  
-COOK ticket. When writing commit messages, it is helpful for others if
24  
-you indicate the COOK ticket. For example:
25  
-
26  
-    git commit -m '[COOK-1041] Updated pool resource to correctly delete.'
27  
-
28  
-In the ticket itself, it is also helpful if you include log output of
29  
-a successful Chef run, but this is not absolutely required.
201  sudo/LICENSE
... ...
@@ -1,201 +0,0 @@
1  
-                              Apache License
2  
-                        Version 2.0, January 2004
3  
-                     http://www.apache.org/licenses/
4  
-
5  
-TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6  
-
7  
-1. Definitions.
8  
-
9  
-   "License" shall mean the terms and conditions for use, reproduction,
10  
-   and distribution as defined by Sections 1 through 9 of this document.
11  
-
12  
-   "Licensor" shall mean the copyright owner or entity authorized by
13  
-   the copyright owner that is granting the License.
14  
-
15  
-   "Legal Entity" shall mean the union of the acting entity and all
16  
-   other entities that control, are controlled by, or are under common
17  
-   control with that entity. For the purposes of this definition,
18  
-   "control" means (i) the power, direct or indirect, to cause the
19  
-   direction or management of such entity, whether by contract or
20  
-   otherwise, or (ii) ownership of fifty percent (50%) or more of the
21  
-   outstanding shares, or (iii) beneficial ownership of such entity.
22  
-
23  
-   "You" (or "Your") shall mean an individual or Legal Entity
24  
-   exercising permissions granted by this License.
25  
-
26  
-   "Source" form shall mean the preferred form for making modifications,
27  
-   including but not limited to software source code, documentation
28  
-   source, and configuration files.
29  
-
30  
-   "Object" form shall mean any form resulting from mechanical
31  
-   transformation or translation of a Source form, including but
32  
-   not limited to compiled object code, generated documentation,
33  
-   and conversions to other media types.
34  
-
35  
-   "Work" shall mean the work of authorship, whether in Source or
36  
-   Object form, made available under the License, as indicated by a
37  
-   copyright notice that is included in or attached to the work
38  
-   (an example is provided in the Appendix below).
39  
-
40  
-   "Derivative Works" shall mean any work, whether in Source or Object
41  
-   form, that is based on (or derived from) the Work and for which the
42  
-   editorial revisions, annotations, elaborations, or other modifications
43  
-   represent, as a whole, an original work of authorship. For the purposes
44  
-   of this License, Derivative Works shall not include works that remain
45  
-   separable from, or merely link (or bind by name) to the interfaces of,
46  
-   the Work and Derivative Works thereof.
47  
-
48  
-   "Contribution" shall mean any work of authorship, including
49  
-   the original version of the Work and any modifications or additions
50  
-   to that Work or Derivative Works thereof, that is intentionally
51  
-   submitted to Licensor for inclusion in the Work by the copyright owner
52  
-   or by an individual or Legal Entity authorized to submit on behalf of
53  
-   the copyright owner. For the purposes of this definition, "submitted"
54  
-   means any form of electronic, verbal, or written communication sent
55  
-   to the Licensor or its representatives, including but not limited to
56  
-   communication on electronic mailing lists, source code control systems,
57  
-   and issue tracking systems that are managed by, or on behalf of, the
58  
-   Licensor for the purpose of discussing and improving the Work, but
59  
-   excluding communication that is conspicuously marked or otherwise
60  
-   designated in writing by the copyright owner as "Not a Contribution."
61  
-
62  
-   "Contributor" shall mean Licensor and any individual or Legal Entity
63  
-   on behalf of whom a Contribution has been received by Licensor and
64  
-   subsequently incorporated within the Work.
65  
-
66  
-2. Grant of Copyright License. Subject to the terms and conditions of
67  
-   this License, each Contributor hereby grants to You a perpetual,
68  
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69  
-   copyright license to reproduce, prepare Derivative Works of,
70  
-   publicly display, publicly perform, sublicense, and distribute the
71  
-   Work and such Derivative Works in Source or Object form.
72  
-
73  
-3. Grant of Patent License. Subject to the terms and conditions of
74  
-   this License, each Contributor hereby grants to You a perpetual,
75  
-   worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76  
-   (except as stated in this section) patent license to make, have made,
77  
-   use, offer to sell, sell, import, and otherwise transfer the Work,
78  
-   where such license applies only to those patent claims licensable
79  
-   by such Contributor that are necessarily infringed by their
80  
-   Contribution(s) alone or by combination of their Contribution(s)
81  
-   with the Work to which such Contribution(s) was submitted. If You
82  
-   institute patent litigation against any entity (including a
83  
-   cross-claim or counterclaim in a lawsuit) alleging that the Work
84  
-   or a Contribution incorporated within the Work constitutes direct
85  
-   or contributory patent infringement, then any patent licenses
86  
-   granted to You under this License for that Work shall terminate
87  
-   as of the date such litigation is filed.
88  
-
89  
-4. Redistribution. You may reproduce and distribute copies of the
90  
-   Work or Derivative Works thereof in any medium, with or without
91  
-   modifications, and in Source or Object form, provided that You
92  
-   meet the following conditions:
93  
-
94  
-   (a) You must give any other recipients of the Work or
95  
-       Derivative Works a copy of this License; and
96  
-
97  
-   (b) You must cause any modified files to carry prominent notices
98  
-       stating that You changed the files; and
99  
-
100  
-   (c) You must retain, in the Source form of any Derivative Works
101  
-       that You distribute, all copyright, patent, trademark, and
102  
-       attribution notices from the Source form of the Work,
103  
-       excluding those notices that do not pertain to any part of
104  
-       the Derivative Works; and
105  
-
106  
-   (d) If the Work includes a "NOTICE" text file as part of its
107  
-       distribution, then any Derivative Works that You distribute must
108  
-       include a readable copy of the attribution notices contained
109  
-       within such NOTICE file, excluding those notices that do not
110  
-       pertain to any part of the Derivative Works, in at least one
111  
-       of the following places: within a NOTICE text file distributed
112  
-       as part of the Derivative Works; within the Source form or
113  
-       documentation, if provided along with the Derivative Works; or,
114  
-       within a display generated by the Derivative Works, if and
115  
-       wherever such third-party notices normally appear. The contents
116  
-       of the NOTICE file are for informational purposes only and
117  
-       do not modify the License. You may add Your own attribution
118  
-       notices within Derivative Works that You distribute, alongside
119  
-       or as an addendum to the NOTICE text from the Work, provided
120  
-       that such additional attribution notices cannot be construed
121  
-       as modifying the License.
122  
-
123  
-   You may add Your own copyright statement to Your modifications and
124  
-   may provide additional or different license terms and conditions
125  
-   for use, reproduction, or distribution of Your modifications, or
126  
-   for any such Derivative Works as a whole, provided Your use,
127  
-   reproduction, and distribution of the Work otherwise complies with
128  
-   the conditions stated in this License.
129  
-
130  
-5. Submission of Contributions. Unless You explicitly state otherwise,
131  
-   any Contribution intentionally submitted for inclusion in the Work
132  
-   by You to the Licensor shall be under the terms and conditions of
133  
-   this License, without any additional terms or conditions.
134  
-   Notwithstanding the above, nothing herein shall supersede or modify
135  
-   the terms of any separate license agreement you may have executed
136  
-   with Licensor regarding such Contributions.
137  
-
138  
-6. Trademarks. This License does not grant permission to use the trade
139  
-   names, trademarks, service marks, or product names of the Licensor,
140  
-   except as required for reasonable and customary use in describing the
141  
-   origin of the Work and reproducing the content of the NOTICE file.
142  
-
143  
-7. Disclaimer of Warranty. Unless required by applicable law or
144  
-   agreed to in writing, Licensor provides the Work (and each
145  
-   Contributor provides its Contributions) on an "AS IS" BASIS,
146  
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147  
-   implied, including, without limitation, any warranties or conditions
148  
-   of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149  
-   PARTICULAR PURPOSE. You are solely responsible for determining the
150  
-   appropriateness of using or redistributing the Work and assume any
151  
-   risks associated with Your exercise of permissions under this License.
152  
-
153  
-8. Limitation of Liability. In no event and under no legal theory,
154  
-   whether in tort (including negligence), contract, or otherwise,
155  
-   unless required by applicable law (such as deliberate and grossly
156  
-   negligent acts) or agreed to in writing, shall any Contributor be
157  
-   liable to You for damages, including any direct, indirect, special,
158  
-   incidental, or consequential damages of any character arising as a
159  
-   result of this License or out of the use or inability to use the
160  
-   Work (including but not limited to damages for loss of goodwill,
161  
-   work stoppage, computer failure or malfunction, or any and all
162  
-   other commercial damages or losses), even if such Contributor
163  
-   has been advised of the possibility of such damages.
164  
-
165  
-9. Accepting Warranty or Additional Liability. While redistributing
166  
-   the Work or Derivative Works thereof, You may choose to offer,
167  
-   and charge a fee for, acceptance of support, warranty, indemnity,
168  
-   or other liability obligations and/or rights consistent with this
169  
-   License. However, in accepting such obligations, You may act only
170  
-   on Your own behalf and on Your sole responsibility, not on behalf
171  
-   of any other Contributor, and only if You agree to indemnify,
172  
-   defend, and hold each Contributor harmless for any liability
173  
-   incurred by, or claims asserted against, such Contributor by reason
174  
-   of your accepting any such warranty or additional liability.
175  
-
176  
-END OF TERMS AND CONDITIONS
177  
-
178  
-APPENDIX: How to apply the Apache License to your work.
179  
-
180  
-   To apply the Apache License to your work, attach the following
181  
-   boilerplate notice, with the fields enclosed by brackets "[]"
182  
-   replaced with your own identifying information. (Don't include
183  
-   the brackets!)  The text should be enclosed in the appropriate
184  
-   comment syntax for the file format. We also recommend that a
185  
-   file or class name and description of purpose be included on the
186  
-   same "printed page" as the copyright notice for easier
187  
-   identification within third-party archives.
188  
-
189  
-Copyright [yyyy] [name of copyright owner]
190  
-
191  
-Licensed under the Apache License, Version 2.0 (the "License");
192  
-you may not use this file except in compliance with the License.
193  
-You may obtain a copy of the License at
194  
-
195  
-    http://www.apache.org/licenses/LICENSE-2.0
196  
-
197  
-Unless required by applicable law or agreed to in writing, software
198  
-distributed under the License is distributed on an "AS IS" BASIS,
199  
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200  
-See the License for the specific language governing permissions and
201  
-limitations under the License.
155  sudo/README.md
Source Rendered
... ...
@@ -1,155 +0,0 @@
1  
-DESCRIPTION
2  
-===========
3  
-
4  
-This cookbook installs sudo and configures the /etc/sudoers file.
5  
-
6  
-REQUIREMENTS
7  
-============
8  
-
9  
-Requires that the platform has a package named sudo and the sudoers file is /etc/sudoers.
10  
-
11  
-ATTRIBUTES
12  
-==========
13  
-
14  
-The following attributes are set to blank arrays:
15  
-
16  
-    node['authorization']['sudo']['groups']
17  
-    node['authorization']['sudo']['users']
18  
-
19  
-They are passed into the sudoers template which iterates over the values to add sudo permission to the specified users and groups.
20  
-
21  
-If you prefer to use passwordless sudo just set the following attribute to true:
22  
-
23  
-    node['authorization']['sudo']['passwordless']
24  
-
25  
-This attribute controls whether or not to include the /etc/sudoers.d
26  
-directory, it default to false. If you set it to true, the default
27  
-recipe will create the directory /etc/sudoers.d and put the
28  
-placeholder file README there
29  
-
30  
-    node['authorization']['sudo']['include_sudoers_d']
31  
-
32  
-USAGE
33  
-=====
34  
-
35  
-You can create sudoer entries in two ways,
36  
-
37  
-- populating the node['authorization']['sudo']  properties
38  
-- using the sudo lwrp
39  
-
40  
-To use this cookbook, set the attributes above on the node via a role or the node object itself. In a role.rb:
41  
-
42  
-    "authorization" => {
43  
-      "sudo" => {
44  
-        "groups" => ["admin", "wheel", "sysadmin"],
45  
-        "users" => ["jerry", "greg"],
46  
-        "passwordless" => true
47  
-      }
48  
-    }
49  
-
50  
-In JSON (role.json or on the node object):
51  
-
52  
-    "authorization": {
53  
-      "sudo": {
54  
-        "groups": [
55  
-          "admin",
56  
-          "wheel",
57  
-          "sysadmin"
58  
-        ],
59  
-        "users": [
60  
-          "jerry",
61  
-          "greg"
62  
-        ],
63  
-        "passwordless": true
64  
-      }
65  
-    }
66  
-
67  
-Note that the template for the sudoers file has the group "sysadmin" with ALL:ALL permission, though the group by default does not exist.
68  
-
69  
-sudo LWRP
70  
-=========
71  
-
72  
-**Note** Sudo version 1.7.2 or newer is required to use the sudo LWRP
73  
-  as it relies on the "#includedir" directive introduced in version
74  
-  1.7.2. The recipe does not enforce installing the version. To use
75  
-  this LWRP, set `node['authorization']['sudo']['include_sudoers_d']`
76  
-  to `true`.
77  
-
78  
-This is a fairly complex LWRP for managing sudoers fragment files in
79  
-/etc/sudoers.d. It has two modes, "natural" mode which mimics the
80  
-sudoers file interface and "template" mode where you supply a regular
81  
-erb template and hash of variables. For "template" mode, the sudo lwrp
82  
-simply ensures that resulting sudo fragment passes validation and has
83  
-the proper filesystem permissions.
84  
-
85  
-In either mode, the sudo lwrp will render a sudoers fragment in
86  
-/etc/sudoers.d/
87  
-
88  
-In the case that the sudoers fragment does not pass validation, this
89  
-lwrp will fail the chef-client run before the fragment can be copied
90  
-to /etc/sudoers.d. This prevents the corruption of your sudoers configuration.
91  
-
92  
-Example of the default mode, "natural" mode
93  
-
94  
-    sudo "tomcat" do
95  
-      user "%tomcat" # or a username
96  
-      runas "app_user" # or "app_user : tomcat"
97  
-      commands ["/etc/init.d/tomcat restart"] # array of commands, will be .join(",")
98  
-      host "ALL"
99  
-      nopasswd false # true prepends the runas_spec with NOPASSWD
100  
-    end
101  
-
102  
-
103  
-Example of template mode
104  
-
105  
-    sudo "tomcat"
106  
-      # this template must exist in the calling cookbook
107  
-      template "restart_tomcat.erb"
108  
-      variables( :cmds => [ "/etc/init.d/tomcat restart" ] )
109  
-    end
110  
-
111  
-In either case, the following file would be generated in /etc/sudoers.d/tomcat
112  
-
113  
-     # this file was generated by chef
114  
-     %tomcat ALL=(app_user) /etc/init.d/tomcat restart
115  
-
116  
-Description of all attributes
117  
-
118  
-* :name -- name of the file to be created in /etc/sudoers.d/ ,
119  
-  defaults to the name you use for the resource. An exception will be
120  
-  thrown if th
121  
-* :user -- user to provide sudo privileges to
122  
-* :group -- same as user except "%" is prepended to the name in
123  
-case it is not already
124  
-* :commands -- an array of commands that the user/group can execute using
125  
-sudo, must use the full path for each command, otherwise the resulting
126  
-fragment will fail validation
127  
-* :nopasswd -- whether or not a password must be supplied when
128  
-invoking sudo
129  
-* :template -- a template file in the current cookbook (not the sudo
130  
-cookbook), currently must be an erb template
131  
-* :variables -- variables to use with the template
132  
-
133  
-If you use the template attribute, all other attributes will be
134  
-ignored except for the variables attribute.
135  
-
136  
-LICENSE AND AUTHOR
137  
-==================
138  
-
139  
-Author:: Bryan W. Berry <bryan.berry@gmail.com>
140  
-Author:: Adam Jacob <adam@opscode.com>
141  
-Author:: Seth Chisamore <schisamo@opscode.com>
142  
-
143  
-Copyright 2009-2011, Opscode, Inc.
144  
-
145  
-Licensed under the Apache License, Version 2.0 (the "License");
146  
-you may not use this file except in compliance with the License.
147  
-You may obtain a copy of the License at
148  
-
149  
-    http://www.apache.org/licenses/LICENSE-2.0
150  
-
151  
-Unless required by applicable law or agreed to in writing, software
152  
-distributed under the License is distributed on an "AS IS" BASIS,
153  
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154  
-See the License for the specific language governing permissions and
155  
-limitations under the License.
4  sudo/files/default/README.sudoers
... ...
@@ -1,4 +0,0 @@
1  
-# 
2  
-# If you use #includedir /etc/sudoers.d, the directory must contain at 
3  
-# least one file. This file is that file
4  
-#
118  sudo/metadata.json
... ...
@@ -1,118 +0,0 @@
1  
-{
2  
-  "name": "sudo",
3  
-  "description": "Installs sudo and configures /etc/sudoers",
4  
-  "long_description": "",
5  
-  "maintainer": "Opscode, Inc.",
6  
-  "maintainer_email": "cookbooks@opscode.com",
7  
-  "license": "Apache 2.0",
8  
-  "platforms": {
9  
-    "redhat": ">= 0.0.0",
10  
-    "centos": ">= 0.0.0",
11  
-    "fedora": ">= 0.0.0",
12  
-    "ubuntu": ">= 0.0.0",
13  
-    "debian": ">= 0.0.0",
14  
-    "freebsd": ">= 0.0.0"
15  
-  },
16  
-  "dependencies": {
17  
-  },
18  
-  "recommendations": {
19  
-  },
20  
-  "suggestions": {
21  
-  },
22  
-  "conflicting": {
23  
-  },
24  
-  "providing": {
25  
-  },
26  
-  "replacing": {
27  
-  },
28  
-  "attributes": {
29  
-    "authorization": {
30  
-      "display_name": "Authorization",
31  
-      "description": "Hash of Authorization attributes",
32  
-      "type": "hash",
33  
-      "choice": [
34  
-
35  
-      ],
36  
-      "calculated": false,
37  
-      "required": "optional",
38  
-      "recipes": [
39  
-
40  
-      ]
41  
-    },
42  
-    "authorization/sudo": {
43  
-      "display_name": "Authorization Sudoers",
44  
-      "description": "Hash of Authorization/Sudo attributes",
45  
-      "type": "hash",
46  
-      "choice": [
47  
-
48  
-      ],
49  
-      "calculated": false,
50  
-      "required": "optional",
51  
-      "recipes": [
52  
-
53  
-      ]
54  
-    },
55  
-    "authorization/sudo/users": {
56  
-      "display_name": "Sudo Users",
57  
-      "description": "Users who are allowed sudo ALL",
58  
-      "type": "array",
59  
-      "default": "",
60  
-      "choice": [
61  
-
62  
-      ],
63  
-      "calculated": false,
64  
-      "required": "optional",
65  
-      "recipes": [
66  
-
67  
-      ]
68  
-    },
69  
-    "authorization/sudo/groups": {
70  
-      "display_name": "Sudo Groups",
71  
-      "description": "Groups who are allowed sudo ALL",
72  
-      "type": "array",
73  
-      "default": "",
74  
-      "choice": [
75  
-
76  
-      ],
77  
-      "calculated": false,
78  
-      "required": "optional",
79  
-      "recipes": [
80  
-
81  
-      ]
82  
-    },
83  
-    "authorization/sudo/passwordless": {
84  
-      "display_name": "Passwordless Sudo",
85  
-      "description": "",
86  
-      "type": "string",
87  
-      "default": "false",
88  
-      "choice": [
89  
-
90  
-      ],
91  
-      "calculated": false,
92  
-      "required": "optional",
93  
-      "recipes": [
94  
-
95  
-      ]
96  
-    },
97  
-    "authorization/sudo/include_sudoers_d": {
98  
-      "display_name": "Include sudoers.d",
99  
-      "description": "Whether to create the sudoers.d includedir",
100  
-      "type": "string",
101  
-      "default": "false",
102  
-      "choice": [
103  
-
104  
-      ],
105  
-      "calculated": false,
106  
-      "required": "optional",
107  
-      "recipes": [
108  
-
109  
-      ]
110  
-    }
111  
-  },
112  
-  "groupings": {
113  
-  },
114  
-  "recipes": {
115  
-    "sudo": "Installs sudo and configures /etc/sudoers"
116  
-  },
117  
-  "version": "1.1.0"
118  
-}
45  sudo/metadata.rb
... ...
@@ -1,45 +0,0 @@
1  
-maintainer        "Opscode, Inc."
2  
-maintainer_email  "cookbooks@opscode.com"
3  
-license           "Apache 2.0"
4  
-description       "Installs sudo and configures /etc/sudoers"
5  
-version           "1.1.0"
6  
-
7  
-recipe "sudo", "Installs sudo and configures /etc/sudoers"
8  
-
9  
-%w{redhat centos fedora ubuntu debian freebsd}.each do |os|
10  
-  supports os
11  
-end
12  
-
13  
-attribute "authorization",
14  
-  :display_name => "Authorization",
15  
-  :description => "Hash of Authorization attributes",
16  
-  :type => "hash"
17  
-
18  
-attribute "authorization/sudo",
19  
-  :display_name => "Authorization Sudoers",
20  
-  :description => "Hash of Authorization/Sudo attributes",
21  
-  :type => "hash"
22  
-
23  
-attribute "authorization/sudo/users",
24  
-  :display_name => "Sudo Users",
25  
-  :description => "Users who are allowed sudo ALL",
26  
-  :type => "array",
27  
-  :default => ""
28  
-
29  
-attribute "authorization/sudo/groups",
30  
-  :display_name => "Sudo Groups",
31  
-  :description => "Groups who are allowed sudo ALL",
32  
-  :type => "array",
33  
-  :default => ""
34  
-
35  
-attribute "authorization/sudo/passwordless",
36  
-  :display_name => "Passwordless Sudo",
37  
-  :description => "",
38  
-  :type => "string",
39  
-  :default => "false"
40  
-
41  
-attribute "authorization/sudo/include_sudoers_d",
42  
-  :display_name => "Include sudoers.d",
43  
-  :description => "Whether to create the sudoers.d includedir",
44  
-  :type => "string",
45  
-  :default => "false"
143  sudo/providers/default.rb
... ...
@@ -1,143 +0,0 @@
1  
-#
2  
-# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
3  
-# Cookbook Name:: sudo
4  
-# Provider:: default
5  
-#
6  
-# Copyright 2011, Bryan w. Berry
7  
-#
8  
-# Licensed under the Apache License, Version 2.0 (the "License");
9  
-# you may not use this file except in compliance with the License.
10  
-# You may obtain a copy of the License at
11  
-#
12  
-#     http://www.apache.org/licenses/LICENSE-2.0
13  
-#
14  
-# Unless required by applicable law or agreed to in writing, software
15  
-# distributed under the License is distributed on an "AS IS" BASIS,
16  
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  
-# See the License for the specific language governing permissions and
18  
-# limitations under the License.
19  
-
20  
-require 'fileutils'
21  
-
22  
-def check_inputs user, group, foreign_template, foreign_vars
23  
-    # if group, user, and template are nil, throw an exception
24  
-  if user == nil and group == nil and foreign_template == nil
25  
-    Chef::Application.fatal!("You must provide a user, group, or template")
26  
-  elsif user != nil and group != nil and template != nil
27  
-    Chef::Application.fatal!("You cannot specify user, group, and template")
28  
-  end
29  
-end
30  
-
31  
-def sudo_test tmpl_name
32  
-  cmd = Chef::ShellOut.new(%Q[ visudo -cf #{tmpl_name} ]).run_command
33  
-  unless cmd.exitstatus == 0
34  
-    Chef::Log.debug('sudoers fragment failed validation. Here it is for your viewing pleasure')
35  
-    Chef::Log.debug("\n" + ::File.open(tmpl_name).read + "\n")
36  
-    Chef::Application.fatal!("sudoers template #{tmpl_name} failed parsing validation!")
37  
-  end
38  
-end
39  
-
40  
-def sudoers_updated?(tmpfile_path, sudoers_file)
41  
-  require 'digest/sha1'
42  
-  sudoers_path = "/etc/sudoers.d/#{sudoers_file}"
43  
-
44  
-  tmpfile_digest = Digest::SHA1.digest(::File.read(tmpfile_path))
45  
-  if ::File.exist? sudoers_path
46  
-    sudoers_file_digest = Digest::SHA1.digest(::File.read(sudoers_path))
47  
-  else
48  
-    # it doesn't already exist, so true
49  
-    return true
50  
-  end
51  
-  tmpfile_digest != sudoers_file_digest ? true : false
52  
-end
53  
-
54  
-def render_sudo_template new_resource
55  
-  ::Dir.mktmpdir do |tmpdir|
56  
-    tmpfile_path = "#{tmpdir}/#{new_resource.name}"
57  
-    tmpl = template tmpfile_path do
58  
-      source new_resource.template
59  
-      mode 0440
60  
-      owner "root"
61  
-      group "root"
62  
-      variables new_resource.variables
63  
-      action :nothing
64  
-    end
65  
-    tmpl.run_action(:create)
66  
-    sudo_test tmpfile_path
67  
-    # check if the sudoers file already exists, and only
68  
-    # overwrite if the sudoers file has been changed
69  
-    if sudoers_updated? tmpfile_path, new_resource.name
70  
-      FileUtils.mv tmpfile_path, "/etc/sudoers.d/#{new_resource.name}"
71  
-      new_resource.updated_by_last_action(true)
72  
-    else
73  
-      # resource not updated, do nothing
74  
-      Chef::Log.debug("Sudo resource not updated, doing nothing")
75  
-      FileUtils.rm_f tmpfile_path
76  
-    end
77  
-  end
78  
-end
79  
-
80  
-def render_sudo_attributes new_resource
81  
-  require 'tempfile'
82  
-  sudo_user = new_resource.user
83  
-  sudo_group = new_resource.group
84  
-  commands = new_resource.commands
85  
-  host = new_resource.host
86  
-  runas = new_resource.runas
87  
-  nopasswd = new_resource.nopasswd
88  
-  sudo_entries = Array.new
89  
-
90  
-  if sudo_group
91  
-    # prepend % to name if group name if it isn't already there
92  
-    if sudo_group !~ /^%.*$/
93  
-      sudo_name = "%#{sudo_group}"
94  
-    else
95  
-      sudo_name = sudo_group
96  
-    end
97  
-  else
98  
-    sudo_name = sudo_user
99  
-  end
100  
-  commands.each do |cmd|
101  
-    entry = ""
102  
-    entry << sudo_name
103  
-    entry << " ALL=(#{runas}) "
104  
-    if nopasswd
105  
-      entry << "NOPASSWD:"
106  
-    end
107  
-    entry << cmd
108  
-    sudo_entries << entry + "\n"
109  
-  end
110  
-
111  
-  tmpfile = Tempfile.new "d"
112  
-  tmpfile_path = tmpfile.path
113  
-  tmpfile.write sudo_entries.join
114  
-  tmpfile.close
115  
-  sudo_test tmpfile_path
116  
-  FileUtils.chmod 0440, tmpfile_path
117  
-
118  
-  if sudoers_updated? tmpfile_path, new_resource.name
119  
-    FileUtils.mv tmpfile_path, "/etc/sudoers.d/#{new_resource.name}"
120  
-    new_resource.updated_by_last_action(true)
121  
-  else
122  
-    # resource not updated, do nothing
123  
-    FileUtils.rm_f tmpfile_path
124  
-  end
125  
-
126  
-end
127  
-
128  
-action :install do
129  
-  if new_resource.template
130  
-    Chef::Log.debug "template attribute provided to sudo lwrp, all other attributes ignored" +
131  
-      " except for variables attribute"
132  
-    render_sudo_template new_resource
133  
-  else
134  
-    render_sudo_attributes new_resource
135  
-  end
136  
-end
137  
-
138  
-action :remove do
139  
-  sudoers_path = "/etc/sudoers.d/#{new_resource.name}"
140  
-  require 'fileutils'
141  
-  FileUtils.rm_f sudoers_path
142  
-  new_resource.updated_by_last_action(true)
143  
-end
52  sudo/recipes/default.rb
... ...
@@ -1,52 +0,0 @@
1  
-#
2  
-# Cookbook Name:: sudo
3  
-# Recipe:: default
4  
-#
5  
-# Copyright 2008-2011, Opscode, Inc.
6  
-#
7  
-# Licensed under the Apache License, Version 2.0 (the "License");
8  
-# you may not use this file except in compliance with the License.
9  
-# You may obtain a copy of the License at
10  
-#
11  
-#     http://www.apache.org/licenses/LICENSE-2.0
12  
-#
13  
-# Unless required by applicable law or agreed to in writing, software
14  
-# distributed under the License is distributed on an "AS IS" BASIS,
15  
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  
-# See the License for the specific language governing permissions and
17  
-# limitations under the License.
18  
-#
19  
-
20  
-package "sudo" do
21  
-  action platform?("freebsd") ? :install : :upgrade
22  
-end
23  
-
24  
-if node['authorization']['sudo']['include_sudoers_d']
25  
-  directory "/etc/sudoers.d" do
26  
-    mode 0755
27  
-    owner "root"
28  
-    group "root"
29  
-    action :create
30  
-  end
31  
-  cookbook_file "/etc/sudoers.d/README" do
32  
-    cookbook "sudo"
33  
-    source "README.sudoers"
34  
-    mode 0440
35  
-    owner "root"
36  
-    group "root"
37  
-    action :create
38  
-  end
39  
-end
40  
-
41  
-template "/etc/sudoers" do
42  
-  source "sudoers.erb"
43  
-  mode 0440
44  
-  owner "root"
45  
-  group platform?("freebsd") ? "wheel" : "root"
46  
-  variables(
47  
-    :sudoers_groups => node['authorization']['sudo']['groups'],
48  
-    :sudoers_users => node['authorization']['sudo']['users'],
49  
-    :passwordless => node['authorization']['sudo']['passwordless'],
50  
-    :include_sudoers_d => node['authorization']['sudo']['include_sudoers_d']
51  
-  )
52  
-end
37  sudo/resources/default.rb
... ...
@@ -1,37 +0,0 @@
1  
-#
2  
-# Author:: Bryan W. Berry (<bryan.berry@gmail.com>)
3  
-# Cookbook Name:: sudo
4  
-# Resource:: default
5  
-#
6  
-# Copyright 2011, Bryan w. Berry
7  
-#
8  
-# Licensed under the Apache License, Version 2.0 (the "License");
9  
-# you may not use this file except in compliance with the License.
10  
-# You may obtain a copy of the License at
11  
-#
12  
-#     http://www.apache.org/licenses/LICENSE-2.0
13  
-#
14  
-# Unless required by applicable law or agreed to in writing, software
15  
-# distributed under the License is distributed on an "AS IS" BASIS,
16  
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  
-# See the License for the specific language governing permissions and
18  
-# limitations under the License.
19  
-
20  
-actions :install, :remove
21  
-
22  
-attribute :user, :kind_of => String, :default => nil
23  
-attribute :group, :kind_of => String, :default => nil
24  
-attribute :commands, :kind_of => Array, :default => nil
25  
-attribute :host, :kind_of => String, :default => "ALL"
26  
-attribute :runas, :kind_of => String, :default => "ALL"
27  
-attribute :nopasswd, :equal_to => [true, false], :default => true
28  
-attribute :template, :regex => /^[a-z_]+.erb$/, :default => nil
29  
-attribute :variables, :kind_of => Hash, :default => nil
30  
-
31  
-# we have to set default for the supports attribute
32  
-# in initializer since it is a 'reserved' attribute name
33  
-def initialize(*args)
34  
-  super
35  
-  @action = :install
36  
-  @supports = {:report => true, :exception => true}
37  
-end
21  sudo/templates/default/sudoers.erb
... ...
@@ -1,21 +0,0 @@
1  
-#
2  
-# /etc/sudoers
3  
-#
4  
-# Generated by Chef for <%= node[:fqdn] %>
5  
-#
6  
-
7  
-Defaults        !lecture,tty_tickets,!fqdn
8  
-
9  
-# User privilege specification
10  
-root          ALL=(ALL) ALL
11  
-
12  
-<% @sudoers_users.each do |user| -%>
13  
-<%= user %>   ALL=(ALL) <%= "NOPASSWD:" if @passwordless %>ALL
14  
-<% end -%>
15  
-
16  
-<% @sudoers_groups.each do |group| -%>
17  
-# Members of the group '<%= group %>' may gain root privileges
18  
-%<%= group %> ALL=(ALL) <%= "NOPASSWD:" if @passwordless %>ALL
19  
-<% end -%>
20  
-
21  
-<%= '#includedir /etc/sudoers.d' if @include_sudoers_d  %>
12  vncserver/CHANGELOG.md
Source Rendered
... ...
@@ -0,0 +1,12 @@
  1
+# CHANGELOG for vncserver
  2
+
  3
+This file is used to list changes made in each version of vncserver.
  4
+
  5
+## 0.1.0:
  6
+
  7
+* Initial release of vncserver
  8
+
  9
+- - -
  10
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
  11
+
  12
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
80  vncserver/README.md
Source Rendered
... ...
@@ -0,0 +1,80 @@
  1
+vncserver Cookbook
  2
+==================
  3
+This cookbook configures systems to serve desktops via VNC.
  4
+
  5
+Requirements
  6
+------------
  7
+
  8
+#### distros
  9
+- Currently supports RHEL & derivatives
  10
+
  11
+Attributes
  12
+----------
  13
+#### vncserver::autostart
  14
+
  15
+Add attributes in the following manner on your node (this will populate the /etc/sysconfig/vncservers file):
  16
+
  17
+```json
  18
+  "vncserver": {
  19
+      "users": [
  20
+        {
  21
+          "firstusernamehere": {
  22
+            "display": "1",
  23
+            "arguments": "-geometry 1024x768"
  24
+          }
  25
+        },
  26
+        {
  27
+          "secondusername here": {
  28
+            "display": "2",
  29
+            "arguments": "-geometry 1024x768"
  30
+          }
  31
+        }
  32
+      ]
  33
+    }
  34
+```
  35
+
  36
+Usage
  37
+-----
  38
+#### vncserver::default
  39
+Just include `vncserver` in your node's `run_list`:
  40
+
  41
+```json
  42
+{
  43
+  "name":"my_node",
  44
+  "run_list": [
  45
+    "recipe[vncserver]"
  46
+  ]
  47
+}
  48
+```
  49
+
  50
+#### vncserver::autostart
  51
+* Update your node's attributes as detailed above
  52
+* Include `vncserver::autostart` in your node's `run_list`:
  53
+
  54
+```json
  55
+{
  56
+  "name":"my_node",
  57
+  "run_list": [
  58
+    "recipe[vncserver]",
  59
+    "recipe[vncserver::autostart]"
  60
+  ]
  61
+}
  62
+```
  63
+
  64
+
  65
+License and Authors
  66
+-------------------
  67
+ Copyright 2013, Biola University 
  68
+
  69
+ Licensed under the Apache License, Version 2.0 (the "License");
  70
+ you may not use this file except in compliance with the License.
  71
+ You may obtain a copy of the License at
  72
+
  73
+ http://www.apache.org/licenses/LICENSE-2.0
  74
+
  75
+ Unless required by applicable law or agreed to in writing, software
  76
+ distributed under the License is distributed on an "AS IS" BASIS,
  77
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  78
+ See the License for the specific language governing permissions and
  79
+ limitations under the License.
  80
+
7  vncserver/metadata.rb
... ...
@@ -0,0 +1,7 @@
  1
+name             'vncserver'
  2
+maintainer       'Biola Unversity'
  3
+maintainer_email 'troy.ready@biola.edu'
  4
+license          'Apache 2.0'
  5
+description      'Configures systems to serve desktops via VNC'
  6
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
  7
+version          '0.1.0'
29  vncserver/recipes/autostart.rb
... ...
@@ -0,0 +1,29 @@
  1
+#
  2
+# Cookbook Name:: vncserver
  3
+# Recipe:: autostart
  4
+#
  5
+# Copyright 2013, Biola University 
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+# http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+#
  19
+
  20
+# Set the RHEL autostart file
  21
+template "/etc/sysconfig/vncservers" do
  22
+		source "vncservers.erb"
  23
+		variables ({
  24
+			:users => node[:vncserver][:users]
  25
+		})
  26
+		# notifies :restart, resources(:service => servicename)
  27
+	end
  28
+
  29
+#TODO: Add remaining autostart config
32  vncserver/recipes/default.rb
... ...
@@ -0,0 +1,32 @@
  1
+#
  2
+# Cookbook Name:: vncserver
  3
+# Recipe:: default
  4
+#
  5
+# Copyright 2013, Biola University 
  6
+#
  7
+# Licensed under the Apache License, Version 2.0 (the "License");
  8
+# you may not use this file except in compliance with the License.
  9
+# You may obtain a copy of the License at
  10
+#
  11
+# http://www.apache.org/licenses/LICENSE-2.0
  12
+#
  13
+# Unless required by applicable law or agreed to in writing, software
  14
+# distributed under the License is distributed on an "AS IS" BASIS,
  15
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16
+# See the License for the specific language governing permissions and
  17
+# limitations under the License.
  18
+#
  19
+
  20
+# Install the X11 package group
  21
+execute "x11installation" do
  22
+	command "yum groupinstall -y 'X Window System'"
  23
+	creates "/usr/bin/startx"
  24
+	end
  25
+
  26
+# Add internet browsers
  27
+execute "browserinstallation" do
  28
+	command "yum groupinstall -y 'Graphical Internet'"
  29
+	creates "/usr/bin/firefox"
  30
+	end
  31
+
  32
+yum_package "vnc-server"
32  vncserver/templates/default/vncservers.erb
... ...
@@ -0,0 +1,32 @@
  1
+# The VNCSERVERS variable is a list of display:user pairs.
  2
+#