{"action":"created","issue":{"url":"https://api.github.com/repos/chef-cookbooks/firewall/issues/131","repository_url":"https://api.github.com/repos/chef-cookbooks/firewall","labels_url":"https://api.github.com/repos/chef-cookbooks/firewall/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/chef-cookbooks/firewall/issues/131/comments","events_url":"https://api.github.com/repos/chef-cookbooks/firewall/issues/131/events","html_url":"https://github.com/chef-cookbooks/firewall/issues/131","id":147511838,"number":131,"title":"CentOS 7.1 with iptables. Systemd unit file is not created.","user":{"login":"xdrus","id":6975314,"avatar_url":"https://avatars.githubusercontent.com/u/6975314?v=3","gravatar_id":"","url":"https://api.github.com/users/xdrus","html_url":"https://github.com/xdrus","followers_url":"https://api.github.com/users/xdrus/followers","following_url":"https://api.github.com/users/xdrus/following{/other_user}","gists_url":"https://api.github.com/users/xdrus/gists{/gist_id}","starred_url":"https://api.github.com/users/xdrus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdrus/subscriptions","organizations_url":"https://api.github.com/users/xdrus/orgs","repos_url":"https://api.github.com/users/xdrus/repos","events_url":"https://api.github.com/users/xdrus/events{/privacy}","received_events_url":"https://api.github.com/users/xdrus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-11T18:23:04Z","updated_at":"2016-04-27T21:07:56Z","closed_at":null,"body":"## Error description\r\n\r\nAttempt to use the cookbook on CentOS 7.1  with iptables is failed with an error:\r\n\r\n```\r\n         * firewall[default] action install\r\n           - install iptables and enable/start services\r\n         * yum_package[iptables] action install (up to date)\r\n         * file[create empty /etc/sysconfig/iptables] action create (skipped due to not_if)\r\n         * service[iptables] action enable\r\n           \r\n           ================================================================================\r\n           Error executing action `enable` on resource 'service[iptables]'\r\n           ================================================================================\r\n           \r\n           Mixlib::ShellOut::ShellCommandFailed\r\n           ------------------------------------\r\n           Expected process to exit with [0], but received '1'\r\n           ---- Begin output of /bin/systemctl enable iptables ----\r\n           STDOUT: \r\n           STDERR: Failed to issue method call: No such file or directory\r\n           ---- End output of /bin/systemctl enable iptables ----\r\n           Ran /bin/systemctl enable iptables returned 1\r\n           \r\n           Resource Declaration:\r\n           ---------------------\r\n           # In /tmp/kitchen/cache/cookbooks/firewall/libraries/provider_firewall_iptables.rb\r\n           \r\n            52:           service svc do\r\n            53:             action [:enable, :start]\r\n            54:           end\r\n            55:         end\r\n           \r\n           Compiled Resource:\r\n           ------------------\r\n           # Declared in /tmp/kitchen/cache/cookbooks/firewall/libraries/provider_firewall_iptables.rb:52:in `block (3 levels) in <class:FirewallIptables>'\r\n           \r\n           service(\"iptables\") do\r\n             action [:enable, :start]\r\n             supports {:restart=>nil, :reload=>nil, :status=>nil}\r\n             retries 0\r\n             retry_delay 2\r\n             default_guard_interpreter :default\r\n             service_name \"iptables\"\r\n             pattern \"iptables\"\r\n             declared_type :service\r\n             cookbook_name \"vpn-server\"\r\n           end\r\n           \r\n       Recipe: sysctl::default\r\n         * ruby_block[save-sysctl-params] action run\r\n           - execute the ruby block save-sysctl-params\r\n         * template[/etc/sysctl.d/99-chef-attributes.conf] action create (up to date)\r\n       \r\n       Running handlers:\r\n       [2016-04-11T17:53:50+00:00] ERROR: Running exception handlers\r\n       Running handlers complete\r\n       [2016-04-11T17:53:50+00:00] ERROR: Exception handlers complete\r\n       Chef Client failed. 4 resources updated in 24 seconds\r\n       [2016-04-11T17:53:50+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out\r\n       [2016-04-11T17:53:50+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report\r\n       [2016-04-11T17:53:50+00:00] ERROR: service[iptables] (/tmp/kitchen/cache/cookbooks/firewall/libraries/provider_firewall_iptables.rb line 52) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'\r\n       ---- Begin output of /bin/systemctl enable iptables ----\r\n       STDOUT: \r\n       STDERR: Failed to issue method call: No such file or directory\r\n       ---- End output of /bin/systemctl enable iptables ----\r\n       Ran /bin/systemctl enable iptables returned 1\r\n       [2016-04-11T17:53:52+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)\r\n```\r\n\r\n* Content of ` /tmp/kitchen/cache/chef-stacktrace.out`:\r\n```\r\nGenerated at 2016-04-11 17:53:50 +0000\r\nMixlib::ShellOut::ShellCommandFailed: service[iptables] (/tmp/kitchen/cache/cookbooks/firewall/libraries/provider_firewall_iptables.rb line 52) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'\r\n---- Begin output of /bin/systemctl enable iptables ----\r\nSTDOUT: \r\nSTDERR: Failed to issue method call: No such file or directory\r\n---- End output of /bin/systemctl enable iptables ----\r\nRan /bin/systemctl enable iptables returned 1\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.6/lib/mixlib/shellout.rb:289:in `invalid!'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mixlib-shellout-2.2.6/lib/mixlib/shellout.rb:276:in `error!'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/mixin/shell_out.rb:56:in `shell_out!'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/provider/service/systemd.rb:118:in `enable_service'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/provider/service.rb:83:in `block in action_enable'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/mixin/why_run.rb:52:in `add_action'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/provider.rb:175:in `converge_by'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/provider/service.rb:82:in `action_enable'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/provider.rb:144:in `run_action'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource.rb:596:in `run_action'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/runner.rb:73:in `run_action'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `block (2 levels) in converge'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `each'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/runner.rb:105:in `block in converge'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/resource_list.rb:84:in `block in execute_each_resource'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:116:in `call_iterator_block'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:85:in `step'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:104:in `iterate'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/stepable_iterator.rb:55:in `each_with_index'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/resource_collection/resource_list.rb:82:in `execute_each_resource'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/runner.rb:104:in `converge'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/client.rb:668:in `block in converge'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/client.rb:663:in `catch'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/client.rb:663:in `converge'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/client.rb:702:in `converge_and_save'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/client.rb:280:in `run'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application.rb:270:in `block in fork_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application.rb:258:in `fork'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application.rb:258:in `fork_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application.rb:223:in `block in run_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/local_mode.rb:44:in `with_server_connectivity'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application.rb:211:in `run_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application/client.rb:445:in `block in interval_run_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application/client.rb:435:in `loop'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application/client.rb:435:in `interval_run_chef_client'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application/client.rb:424:in `run_application'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/lib/chef/application.rb:58:in `run'\r\n/opt/chef/embedded/lib/ruby/gems/2.1.0/gems/chef-12.8.1/bin/chef-client:26:in `<top (required)>'\r\n/opt/chef/bin/chef-client:50:in `load'\r\n/opt/chef/bin/chef-client:50:in `<main>'\r\n```\r\n## Configuration:\r\n* attributes/default.rb:\r\n```ruby\r\ndefault['firewall']['redhat7_iptables'] = true\r\ndefault['firewall']['iptables']['defaults'][:ruleset] = {\r\n  '*filter' => 1,\r\n  ':INPUT ACCEPT' => 2,\r\n  ':FORWARD ACCEPT' => 3,\r\n  ':OUTPUT ACCEPT' => 4,\r\n  'COMMIT_FILTER' => 100,\r\n  '*nat' => 101,\r\n  ':PREROUTING ACCEPT' => 102,\r\n  ':POSTROUTING ACCEPT' => 103,\r\n  ':OUTPUT ACCEPT' => 104,\r\n  ':INPUT ACCEPT' => 105,\r\n  'COMMIT_NAT' => 200\r\n}\r\n```\r\n\r\n* recipes/default.rb:\r\n```ruby\r\n### Firewall\r\nfirewall 'default' do\r\n    ipv6_enabled    false\r\n    action          :install\r\nend\r\n### NAT\r\nfirewall_rule \"postroute151\" do\r\n    raw \"-A POSTROUTING -s 10.0.0.0/9 -o eth0 -m policy --dir out --pol ipsec -j ACCEPT\"\r\n    position 151\r\nend\r\nfirewall_rule \"postroute152\" do\r\n    raw \"-A POSTROUTING -s 10.0.0.0/9 -o eth0 -j MASQUERADE\"\r\n    position 152\r\nend\r\n```\r\n* metadata.rb:\r\n```\r\ndepends 'firewall', '~> 2.5.0'\r\n```\r\n\r\n* uname -a:\r\n```\r\nLinux vpn-server-centos-71 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux\r\n```\r\n\r\n*  chef-solo -v\r\n```\r\nChef: 12.8.1\r\n```\r\n\r\n* `systemctl list-unit-files --no-pager | grep iptables` returns empty list.\r\n\r\n* `cat /etc/sysconfig/iptables`:\r\n```\r\n# created by chef to allow service to start\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/chef-cookbooks/firewall/issues/comments/215229705","html_url":"https://github.com/chef-cookbooks/firewall/issues/131#issuecomment-215229705","issue_url":"https://api.github.com/repos/chef-cookbooks/firewall/issues/131","id":215229705,"user":{"login":"martinb3","id":103033,"avatar_url":"https://avatars.githubusercontent.com/u/103033?v=3","gravatar_id":"","url":"https://api.github.com/users/martinb3","html_url":"https://github.com/martinb3","followers_url":"https://api.github.com/users/martinb3/followers","following_url":"https://api.github.com/users/martinb3/following{/other_user}","gists_url":"https://api.github.com/users/martinb3/gists{/gist_id}","starred_url":"https://api.github.com/users/martinb3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martinb3/subscriptions","organizations_url":"https://api.github.com/users/martinb3/orgs","repos_url":"https://api.github.com/users/martinb3/repos","events_url":"https://api.github.com/users/martinb3/events{/privacy}","received_events_url":"https://api.github.com/users/martinb3/received_events","type":"User","site_admin":false},"created_at":"2016-04-27T21:07:55Z","updated_at":"2016-04-27T21:07:55Z","body":"Hi there -- we're using the packages from each OS for these providers. Is systemd able to start and stop iptables outside of Chef?"}}