chef-cookbooks / auditd

Install and configure user mode auditd tools
Apache License 2.0
34 stars 39 forks source link

Ubuntu 20.04 - reload not supported for unit auditd.service #69

Open NelsonTang19 opened 3 years ago

NelsonTang19 commented 3 years ago

The following error when updating the auditd_conf_file resource:

Recipe: auditd::default
  * service[auditd] action reload INFO: Processing service[auditd] action reload (auditd::default line 27)

    ================================================================================
    Error executing action `reload` on resource 'service[auditd]'
    ================================================================================

    Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '3'
    ---- Begin output of ["/usr/bin/systemctl", "--system", "reload", "auditd"] ----
    STDOUT: 
    STDERR: Failed to reload auditd.service: Job type reload is not applicable for unit auditd.service.
    ---- End output of ["/usr/bin/systemctl", "--system", "reload", "auditd"] ----
    Ran ["/usr/bin/systemctl", "--system", "reload", "auditd"] returned 3

    Resource Declaration:
    ---------------------
    # In /opt/installers/chef/local-mode-cache/cache/cookbooks/auditd/recipes/default.rb

     27: service 'auditd' do
     28:   if platform_family?('rhel') && node['init_package'] == 'systemd' && node['platform_version'] < '7.5'
     29:     reload_command '/usr/libexec/initscripts/legacy-actions/auditd/reload'
     30:     restart_command '/usr/libexec/initscripts/legacy-actions/auditd/restart'
     31:   end
     32:   if platform_family?('rhel') && node['init_package'] == 'systemd' && node['platform_version'] >= '7.5'

    Compiled Resource:
    ------------------
    # Declared in /opt/installers/chef/local-mode-cache/cache/cookbooks/auditd/recipes/default.rb:27:in `from_file'

    service("auditd") do
      action [:enable]
      updated true
      default_guard_interpreter :default
      declared_type :service
      cookbook_name "auditd"
      recipe_name "default"
      supports {:start=>true, :stop=>true, :restart=>true, :reload=>true, :status=>true}
      service_name "auditd"
      running true
      enabled true
      masked false
    end

    System Info:
    ------------
    chef_version=16.1.0
    platform=ubuntu
    platform_version=20.04
    ruby=ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
    program_name=/usr/bin/cinc-client
    executable=/opt/cinc/bin/cinc-client

This seems like a more generic issue of https://github.com/chef-cookbooks/auditd/issues/55 The version of auditd installed on Ubuntu 20.04 is now 1:2.8.5-2ubuntu6 (whereas the version that would be installed in Ubuntu 18.04 is 1:2.8.2-1ubuntu1.1). Running reload with systemd generates the same error:

/usr/bin/systemctl reload auditd
Failed to reload auditd.service: Job type reload is not applicable for unit auditd.service.

A similar fix looks promising:

/usr/sbin/service auditd reload
 * Reloading audit daemon auditd                                                                                           [ OK ]