Sous-Chefs-Boneyard / sysctl

Development repository for the sysctl cookbook
https://supermarket.chef.io/cookbooks/sysctl
Apache License 2.0
42 stars 79 forks source link

Sysctl cookbook fails on Amazon Linux #93

Closed mkristan closed 7 years ago

mkristan commented 7 years ago

Cookbook version

0.10.0

Chef-client version

12.21.3

Platform Details

Amazon Linux 2017.03 on Amazon us-east-1

Scenario:

I was looking to apply sysctl parameters via attributes fs.suid_dumpable

Steps to Reproduce:

I upgraded the cookbook from 0.9.0 to 0.10.0

Expected Result:

I was expecting the sysctl parameters to be applied

Actual Result:

Recipe: sysctl::default

    Error executing action `apply` on resource 'sysctl_param[fs.suid_dumpable]'
    ================================================================================

    RuntimeError
    ------------
    Unknown sysctl file location. Unsupported platform.

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/sysctl/libraries/helpers_param.rb:32:in `config_sysctl'
    /var/chef/cache/cookbooks/sysctl/libraries/sysctl_param.rb:57:in `block in create_sysctld'
    /var/chef/cache/cookbooks/sysctl/libraries/sysctl_param.rb:56:in `create_sysctld'
    /var/chef/cache/cookbooks/sysctl/libraries/sysctl_param.rb:67:in `block (2 levels) in <class:SysctlParam>'
    /var/chef/cache/cookbooks/sysctl/libraries/sysctl_param.rb:64:in `block in <class:SysctlParam>'

    Resource Declaration:
    ---------------------
    # In /var/chef/cache/cookbooks/sysctl/recipes/default.rb

     26:   sysctl_param k do
     27:     value v
     28:   end
     29: end if node.attribute?('sysctl') && node['sysctl'].attribute?('params')

    Compiled Resource:
    ------------------
    # Declared in /var/chef/cache/cookbooks/sysctl/recipes/default.rb:26:in `block in from_file'

    sysctl_param("fs.suid_dumpable") do
      action [:apply]
      retries 0
      retry_delay 2
      default_guard_interpreter :default
      declared_type :sysctl_param
      cookbook_name "sysctl"
      recipe_name "default"
      value "0"
      key "fs.suid_dumpable"
    end

    System Info:
    ------------
    chef_version=12.21.3
    platform=amazon
    platform_version=2017.03
    ruby=ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
    program_name=chef-client worker: ppid=30745;start=14:14:50;
    executable=/opt/chef/bin/chef-client
tas50 commented 7 years ago

@mkristan Can you include the attributes you're setting so I can try to reproduce this. The standard test scenario runs fine on Amazon

mkristan commented 7 years ago

From our attributes rb file: default['sysctl']['allow_sysctl_conf'] = true default['sysctl']['params']['kernel']['randomize_va_space'] = 2 default['sysctl']['params']['net']['ipv4']['conf']['all']['accept_redirects'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['all']['accept_source_route'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['all']['log_martians'] = 1 default['sysctl']['params']['net']['ipv4']['conf']['all']['send_redirects'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['all']['secure_redirects'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['all']['rp_filter'] = 1 default['sysctl']['params']['net']['ipv4']['conf']['all']['tcp_syncookies'] = 1 default['sysctl']['params']['net']['ipv4']['conf']['default']['rp_filter'] = 1 default['sysctl']['params']['net']['ipv4']['conf']['default']['accept_redirects'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['default']['accept_source_route'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['default']['log_martians'] = 1 default['sysctl']['params']['net']['ipv4']['conf']['default']['send_redirects'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['default']['secure_redirects'] = 0 default['sysctl']['params']['net']['ipv4']['conf']['tcp_syncookies'] = 1 default['sysctl']['params']['net']['ipv4']['icmp_echo_ignore_broadcasts'] = 1 default['sysctl']['params']['net']['ipv4']['icmp_ignore_bogus_error_responses'] = 1 default['sysctl']['params']['net']['ipv4']['tcp_max_syn_backlog'] = 4096 default['sysctl']['params']['fs']['suid_dumpable'] = 0

amitizle commented 7 years ago

https://github.com/sous-chefs/sysctl/blob/master/libraries/helpers_param.rb#L23

@mkristan you can try and add a node attribute (node['sysctl']['conf_file'])

mkristan commented 7 years ago

@amitizle, thanks for the suggestion. I will give that a try and report back.

lock[bot] commented 6 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.