components/puppet/patches/puppet-05-apply-auditing.patch
author Drew Fisher <drew.fisher@oracle.com>
Mon, 29 Jul 2013 16:02:38 -0600
changeset 1409 9db4ba32e740
child 1474 97927b6c1ece
permissions -rw-r--r--
PSARC/2013/218 Puppet Phase 2 16453463 Update Puppet's offerings on Solaris

Add auditing hooks for puppet apply
--- puppet-3.2.2/lib/puppet/application/apply.rb.orig	2013-06-13 12:15:55.000000000 -0600
+++ puppet-3.2.2/lib/puppet/application/apply.rb	2013-07-01 14:02:10.263603171 -0600
@@ -1,5 +1,8 @@
 require 'puppet/application'
 require 'puppet/configurer'
+if Facter.value(:osfamily) == "Solaris"
+  require 'PuppetAudit'
+end
 
 class Puppet::Application::Apply < Puppet::Application
 
@@ -204,6 +207,12 @@
     end
 
     begin
+      # configure auditing on Solaris
+      if Facter.value(:osfamily) == "Solaris"
+          audit_handle = PuppetAudit.new
+          audit_handle.audit_start
+      end
+
       # Compile our catalog
       starttime = Time.now
       catalog = Puppet::Resource::Catalog.indirection.find(node.name, :use_node => node)
@@ -232,6 +241,12 @@
     rescue => detail
       Puppet.log_exception(detail)
       exit(1)
+    ensure
+      # clean up auditing records on Solaris
+      if Facter.value(:osfamily) == "Solaris"
+          audit_handle.audit_stop
+          audit_handle.audit_teardown
+      end
     end
   end