Skip to content

Instantly share code, notes, and snippets.

@bhouse
Last active December 20, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhouse/e069539f5be683f2622d to your computer and use it in GitHub Desktop.
Save bhouse/e069539f5be683f2622d to your computer and use it in GitHub Desktop.
opscode sudo cookbook bug
Add bad sudoers.d resource to the default recipe
################################################
diff --git a/recipes/default.rb b/recipes/default.rb
index bd060dc..b1a387c 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -47,8 +47,13 @@ template '/etc/sudoers' do
:sudoers_groups => node['authorization']['sudo']['groups'],
:sudoers_users => node['authorization']['sudo']['users'],
:passwordless => node['authorization']['sudo']['passwordless'],
- :include_sudoers_d => node['authorization']['sudo']['include_sudoers_d'],
+ :include_sudoers_d => true,
:agent_forwarding => node['authorization']['sudo']['agent_forwarding'],
:sudoers_defaults => node['authorization']['sudo']['sudoers_defaults']
)
end
+
+sudo 'bad-sudoers-resource' do
+ group 'sudo'
+ commands [ 'asdf%%%###' ]
+end
cookbook installs the bad-sudoers-resource without error
########################################################
* sudo[bad-sudoers-resource] action install[2013-08-09T01:54:07+00:00] INFO: Processing sudo[bad-sudoers-resource] action install (sudo::default line 56)
Recipe: <Dynamically Defined Resource>
* template[/etc/sudoers.d/bad-sudoers-resource] action create[2013-08-09T01:54:07+00:00] INFO: Processing template[/etc/sudoers.d/bad-sudoers-resource] action create (/tmp/kitchen-chef-solo/cookbooks/sudo/providers/default.rb line 79)
[2013-08-09T01:54:07+00:00] INFO: template[/etc/sudoers.d/bad-sudoers-resource] created file /etc/sudoers.d/bad-sudoers-resource
- create new file /etc/sudoers.d/bad-sudoers-resource[2013-08-09T01:54:07+00:00] INFO: template[/etc/sudoers.d/bad-sudoers-resource] updated file contents /etc/sudoers.d/bad-sudoers-resource
- update content in file /etc/sudoers.d/bad-sudoers-resource from none to 040884
--- /etc/sudoers.d/bad-sudoers-resource 2013-08-09 01:54:07.692271846 +0000
+++ /tmp/chef-rendered-template20130809-1224-q18y0s 2013-08-09 01:54:07.696271847 +0000
@@ -0,0 +1,4 @@
+# This file is managed by Chef.
+# Do NOT modify this file directly.
+
+%sudo ALL=(ALL) asdf%%%###
[2013-08-09T01:54:07+00:00] INFO: template[/etc/sudoers.d/bad-sudoers-resource] owner changed to 0
[2013-08-09T01:54:07+00:00] INFO: template[/etc/sudoers.d/bad-sudoers-resource] group changed to 0
[2013-08-09T01:54:07+00:00] INFO: template[/etc/sudoers.d/bad-sudoers-resource] mode changed to 440
- change mode from '' to '0440'
- change owner from '' to 'root'
- change group from '' to 'root'
* template[/etc/sudoers.d/bad-sudoers-resource] action nothing
[2013-08-09T01:54:07+00:00] INFO: Processing template[/etc/sudoers.d/bad-sudoers-resource] action nothing (/tmp/kitchen-chef-solo/cookbooks/sudo/providers/default.rb line 79)
(skipped due to action :nothing)
[2013-08-09T01:54:07+00:00] INFO: Chef Run complete in 16.085858699 seconds
[2013-08-09T01:54:07+00:00] INFO: Running report handlers
[2013-08-09T01:54:07+00:00] INFO: Report handlers complete
Chef Client finished, 8 resources updated
Finished converging <default-ubuntu-1204> (0m34.64s).
-----> Kitchen is finished. (1m18.64s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment