cloud-mu 2.0.4 → 2.1.0beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +6 -0
  3. data/ansible/roles/geerlingguy.firewall/LICENSE +20 -0
  4. data/ansible/roles/geerlingguy.firewall/README.md +93 -0
  5. data/ansible/roles/geerlingguy.firewall/defaults/main.yml +19 -0
  6. data/ansible/roles/geerlingguy.firewall/handlers/main.yml +3 -0
  7. data/ansible/roles/geerlingguy.firewall/meta/main.yml +26 -0
  8. data/ansible/roles/geerlingguy.firewall/molecule/default/molecule.yml +40 -0
  9. data/ansible/roles/geerlingguy.firewall/molecule/default/playbook.yml +17 -0
  10. data/ansible/roles/geerlingguy.firewall/molecule/default/tests/test_default.py +14 -0
  11. data/ansible/roles/geerlingguy.firewall/molecule/default/yaml-lint.yml +6 -0
  12. data/ansible/roles/geerlingguy.firewall/tasks/disable-other-firewalls.yml +66 -0
  13. data/ansible/roles/geerlingguy.firewall/tasks/main.yml +44 -0
  14. data/ansible/roles/geerlingguy.firewall/templates/firewall.bash.j2 +136 -0
  15. data/ansible/roles/geerlingguy.firewall/templates/firewall.init.j2 +52 -0
  16. data/ansible/roles/geerlingguy.firewall/templates/firewall.unit.j2 +12 -0
  17. data/bin/mu-ansible-secret +114 -0
  18. data/bin/mu-aws-setup +74 -21
  19. data/bin/mu-node-manage +22 -12
  20. data/bin/mu-self-update +11 -4
  21. data/cloud-mu.gemspec +3 -3
  22. data/cookbooks/firewall/metadata.json +1 -1
  23. data/cookbooks/firewall/recipes/default.rb +4 -0
  24. data/cookbooks/mu-master/recipes/default.rb +0 -3
  25. data/cookbooks/mu-master/recipes/init.rb +15 -9
  26. data/cookbooks/mu-master/templates/default/mu.rc.erb +1 -1
  27. data/cookbooks/mu-master/templates/default/web_app.conf.erb +0 -4
  28. data/cookbooks/mu-php54/metadata.rb +2 -2
  29. data/cookbooks/mu-php54/recipes/default.rb +1 -3
  30. data/cookbooks/mu-tools/recipes/eks.rb +25 -2
  31. data/cookbooks/mu-tools/recipes/nrpe.rb +6 -1
  32. data/cookbooks/mu-tools/recipes/set_mu_hostname.rb +8 -0
  33. data/cookbooks/mu-tools/templates/default/etc_hosts.erb +1 -1
  34. data/cookbooks/mu-tools/templates/default/kubeconfig.erb +2 -2
  35. data/cookbooks/mu-tools/templates/default/kubelet-config.json.erb +35 -0
  36. data/extras/clean-stock-amis +10 -4
  37. data/extras/list-stock-amis +64 -0
  38. data/extras/python_rpm/build.sh +21 -0
  39. data/extras/python_rpm/muthon.spec +68 -0
  40. data/install/README.md +5 -2
  41. data/install/user-dot-murc.erb +1 -1
  42. data/modules/mu.rb +52 -8
  43. data/modules/mu/clouds/aws.rb +1 -1
  44. data/modules/mu/clouds/aws/container_cluster.rb +1071 -47
  45. data/modules/mu/clouds/aws/firewall_rule.rb +45 -19
  46. data/modules/mu/clouds/aws/log.rb +3 -2
  47. data/modules/mu/clouds/aws/role.rb +18 -2
  48. data/modules/mu/clouds/aws/server.rb +11 -5
  49. data/modules/mu/clouds/aws/server_pool.rb +20 -24
  50. data/modules/mu/clouds/aws/userdata/linux.erb +1 -1
  51. data/modules/mu/clouds/aws/vpc.rb +9 -0
  52. data/modules/mu/clouds/google/server.rb +2 -0
  53. data/modules/mu/config.rb +3 -3
  54. data/modules/mu/config/container_cluster.rb +1 -1
  55. data/modules/mu/config/firewall_rule.rb +4 -0
  56. data/modules/mu/config/role.rb +29 -0
  57. data/modules/mu/config/server.rb +9 -4
  58. data/modules/mu/groomer.rb +14 -3
  59. data/modules/mu/groomers/ansible.rb +553 -0
  60. data/modules/mu/groomers/chef.rb +0 -5
  61. data/modules/mu/mommacat.rb +18 -3
  62. data/modules/scratchpad.erb +1 -1
  63. data/requirements.txt +5 -0
  64. metadata +39 -16
@@ -0,0 +1,52 @@
1
+ #! /bin/sh
2
+ # /etc/init.d/firewall
3
+ #
4
+ # Firewall init script, to be used with /etc/firewall.bash by Jeff Geerling.
5
+ #
6
+ # @author Jeff Geerling
7
+
8
+ ### BEGIN INIT INFO
9
+ # Provides: firewall
10
+ # Required-Start: $remote_fs $syslog
11
+ # Required-Stop: $remote_fs $syslog
12
+ # Default-Start: 2 3 4 5
13
+ # Default-Stop: 0 1 6
14
+ # Short-Description: Start firewall at boot time.
15
+ # Description: Enable the firewall.
16
+ ### END INIT INFO
17
+
18
+ # Carry out specific functions when asked to by the system
19
+ case "$1" in
20
+ start)
21
+ echo "Starting firewall."
22
+ /etc/firewall.bash
23
+ ;;
24
+ stop)
25
+ echo "Stopping firewall."
26
+ iptables -F
27
+ if [ -x "$(which ip6tables 2>/dev/null)" ]; then
28
+ ip6tables -F
29
+ fi
30
+ ;;
31
+ restart)
32
+ echo "Restarting firewall."
33
+ /etc/firewall.bash
34
+ ;;
35
+ status)
36
+ echo -e "`iptables -L -n`"
37
+ EXIT=4 # program or service status is unknown
38
+ NUMBER_OF_RULES=$(iptables-save | grep '^\-' | wc -l)
39
+ if [ 0 -eq $NUMBER_OF_RULES ]; then
40
+ EXIT=3 # program is not running
41
+ else
42
+ EXIT=0 # program is running or service is OK
43
+ fi
44
+ exit $EXIT
45
+ ;;
46
+ *)
47
+ echo "Usage: /etc/init.d/firewall {start|stop|status|restart}"
48
+ exit 1
49
+ ;;
50
+ esac
51
+
52
+ exit 0
@@ -0,0 +1,12 @@
1
+ [Unit]
2
+ Description=Firewall
3
+ After=syslog.target network.target
4
+
5
+ [Service]
6
+ Type=oneshot
7
+ ExecStart=/etc/firewall.bash
8
+ ExecStop=/sbin/iptables -F
9
+ RemainAfterExit=yes
10
+
11
+ [Install]
12
+ WantedBy=multi-user.target
@@ -0,0 +1,114 @@
1
+ #!/usr/local/ruby-current/bin/ruby
2
+ #
3
+ # Copyright:: Copyright (c) 2019 eGlobalTech, Inc., all rights reserved
4
+ #
5
+ # Licensed under the BSD-3 license (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License in the root of the project or at
8
+ #
9
+ # http://egt-labs.com/mu/LICENSE.html
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ require File.expand_path(File.dirname(__FILE__))+"/mu-load-config.rb"
18
+
19
+ require 'rubygems'
20
+ require 'bundler/setup'
21
+ require 'optimist'
22
+ require 'mu'
23
+
24
+ $secretdir = MU.dataDir + "/ansible-secrets"
25
+
26
+ $opts = Optimist::options do
27
+ banner <<-EOS
28
+ Interface with Mu's central repository of Ansible vaults. All encrypting/decrypting will take place with the current user's default Mu Ansible Vault password, which is automatically generated.
29
+ #{$0} [--create|--update <vault> [[<itemname>] --file <filename>|<itemname> --string <encrypt_me>]] | [--delete|--show <vault> [<itemname>]] | [--list] | [--string <data> [<var_name>] ]
30
+ EOS
31
+ opt :list, "List vaults owned by this user.", :require => false, :default => false, :type => :boolean
32
+ opt :show, "Show a vault or item. If only a vault name is specified, item names are listed. Otherwise, item contents are shown.", :require => false, :default => false, :type => :boolean
33
+ opt :create, "Create a new vault and item", :require => false, :default => false, :type => :boolean
34
+ opt :update, "Alias for --create", :require => false, :default => false, :type => :boolean
35
+ opt :delete, "", :require => false, :default => false, :type => :boolean
36
+ opt :file, "Path to a file to encrypt, in lieu of encrypting string data provided as an argument", :require => false, :type => :string
37
+ opt :string, "Encrypt a string, suitable for embedding in an Ansible vars file. If the optional <name> argument is not provided, the variable will be called my_encrypted_variable", :require => false, :type => :string
38
+ end
39
+
40
+ def bail(err)
41
+ MU.log err, MU::ERR
42
+ Optimist::educate
43
+ exit 1
44
+ end
45
+
46
+ if $opts[:list]
47
+ MU::Groomer::Ansible.listSecrets.each { |vault|
48
+ puts vault
49
+ }
50
+ exit
51
+ end
52
+
53
+ if $opts[:string]
54
+ namestr = if ARGV.size != 1
55
+ "my_encrypted_var"
56
+ else
57
+ ARGV.shift
58
+ end
59
+ MU::Groomer::Ansible.encryptString(namestr, $opts[:string])
60
+ exit
61
+ end
62
+
63
+ if $opts[:show]
64
+ bail("Must specify a vault name with --show") if ARGV.size == 0
65
+ vaultname = ARGV.shift
66
+ itemname = ARGV.shift if ARGV.size > 0
67
+
68
+ data = MU::Groomer::Ansible.getSecret(vault: vaultname, item: itemname)
69
+ if !data
70
+ MU.log "No data returned from vault #{vaultname} #{itemname ? "item "+itemname : ""}"
71
+ elsif data.is_a?(Array)
72
+ data.each { |entry|
73
+ puts entry
74
+ }
75
+ elsif data.is_a?(Hash)
76
+ puts JSON.pretty_generate(data)
77
+ else
78
+ puts data
79
+ end
80
+ exit
81
+ end
82
+
83
+ if $opts[:create] or $opts[:update]
84
+ bail("Must specify a vault name with --create or --update") if ARGV.size == 0
85
+ vaultname = ARGV.shift
86
+ data = if $opts[:file]
87
+ item = $opts[:file].gsub(/.*?([^\/]+)$/, '\1')
88
+ if ARGV.size > 0
89
+ bail("Cannot specify item arg with --file (extra argument(s): #{ARGV.join(" ")})")
90
+ end
91
+ File.read($opts[:file])
92
+ elsif $opts[:string]
93
+ bail("Must specify an item name when using --string") if ARGV.size == 0
94
+ item = ARGV.shift
95
+ $opts[:string]
96
+ data = ARGV.shift
97
+ if ARGV.size > 0
98
+ bail("Don't know what to do with extra argument(s): #{ARGV.join(" ")}")
99
+ end
100
+ data
101
+ else
102
+ bail("Must specify either --file or --string when using --create or --update")
103
+ end
104
+ MU::Groomer::Ansible.saveSecret(vault: vaultname, item: item, data: data)
105
+ exit
106
+ end
107
+
108
+ if $opts[:delete]
109
+ bail("Must specify at least a vault name with --delete") if ARGV.size == 0
110
+ vaultname = ARGV.shift
111
+ itemname = ARGV.shift if ARGV.size > 0
112
+ MU::Groomer::Ansible.deleteSecret(vault: vaultname, item: itemname)
113
+ exit
114
+ end
data/bin/mu-aws-setup CHANGED
@@ -86,36 +86,90 @@ end
86
86
  # Create a security group, or manipulate an existing one, so that we have all
87
87
  # of the appropriate network holes.
88
88
  if $opts[:sg]
89
- open_ports = [80, 443, 2260, 7443, 8443, 9443, 8200]
89
+ open_ports = [443, 2260, 7443, 8443, 9443, 8200]
90
+ ranges = if $MU_CFG and $MU_CFG['my_networks'] and $MU_CFG['my_networks'].size > 0
91
+ $MU_CFG['my_networks'].map { |r|
92
+ r = r+"/32" if r.match(/^\d+\.\d+\.\d+\.\d+$/)
93
+ r
94
+ }
95
+ else
96
+ ["0.0.0.0/0"]
97
+ end
90
98
 
91
99
  # This doesn't make sense. we can have multiple security groups in our account with a name tag of "Mu Master". This will then find and modify a security group that has nothing to do with us.
92
- # found = MU::MommaCat.findStray("AWS", "firewall_rule", region: MU.myRegion, dummy_ok: true, tag_key: "Name", tag_value: "Mu Master")
93
- found = nil
94
100
 
95
- if found.nil? or found.size < 1 and instance.security_groups.size > 0
96
- # maybe we should make sure we don't use the "Mu Client Rules for" security group for this.
97
- found = MU::MommaCat.findStray("AWS", "firewall_rule", region: MU.myRegion, dummy_ok: true, cloud_id: instance.security_groups.first.group_id)
101
+ admin_sg = nil
102
+ if instance.security_groups.size > 0
103
+ instance.security_groups.each { |sg|
104
+ found = MU::MommaCat.findStray("AWS", "firewall_rule", region: MU.myRegion, dummy_ok: true, cloud_id: sg.group_id)
105
+ if found.size > 0 and
106
+ !found.first.cloud_desc.group_name.match(/^Mu Client Rules for /)
107
+ admin_sg = found.first
108
+
109
+ break
110
+ end
111
+ }
98
112
  end
99
- admin_sg = found.first if !found.nil? and found.size > 0
113
+
114
+ # Clean out any old rules that aren't part of our current config
115
+ admin_sg.cloud_desc.ip_permissions.each { |rule|
116
+ rule.ip_ranges.each { |range|
117
+ if range.description == "Mu Master service access" and
118
+ !ranges.include?(range.cidr_ip) and rule.to_port != 80 and
119
+ !(rule.to_port == 22 and range.cidr_ip == "#{preferred_ip}/32")
120
+ MU.log "Revoking old Mu Master service access rule for #{range.cidr_ip} port #{rule.to_port.to_s}", MU::NOTICE
121
+ MU::Cloud::AWS.ec2(region: MU.myRegion, credentials: admin_sg.credentials).revoke_security_group_ingress(
122
+ group_id: admin_sg.cloud_desc.group_id,
123
+ ip_permissions: [
124
+ {
125
+ to_port: rule.to_port,
126
+ from_port: rule.from_port,
127
+ ip_protocol: rule.ip_protocol,
128
+ ip_ranges: [
129
+ { cidr_ip: range.cidr_ip }
130
+ ]
131
+ }
132
+ ]
133
+ )
134
+
135
+ end
136
+ }
137
+ }
138
+
139
+ rules = Array.new
140
+ open_ports.each { |port|
141
+ rules << {
142
+ "port" => port,
143
+ "hosts" => ranges,
144
+ "description" => "Mu Master service access"
145
+ }
146
+ }
147
+ rules << {
148
+ "port" => 22,
149
+ "hosts" => ["#{preferred_ip}/32"],
150
+ "description" => "Mu Master service access"
151
+ }
152
+ rules << {
153
+ "port" => 80,
154
+ "hosts" => ["0.0.0.0/0"],
155
+ "description" => "Mu Master service access"
156
+ }
157
+ rules << {
158
+ "port_range" => "0-65535",
159
+ "sgs" => admin_sg.cloud_id,
160
+ "description" => "Mu Master service access"
161
+ }
162
+ MU.log "Configuring basic TCP access for Mu services", MU::NOTICE, details: rules
100
163
 
101
164
  if !admin_sg.nil?
102
165
  MU.log "Using an existing Security Group, #{admin_sg}, already associated with this Mu server."
103
166
  open_ports.each { |port|
104
- admin_sg.addRule(["0.0.0.0/0"], port: port)
167
+ admin_sg.addRule(ranges, port: port, comment: "Mu Master service access")
105
168
  }
106
- admin_sg.addRule(["#{preferred_ip}/32"], port: 22)
169
+ admin_sg.addRule(["#{preferred_ip}/32"], port: 22, comment: "Mu Master service access")
170
+ admin_sg.addRule(["0.0.0.0/0"], port: 80, comment: "Mu Master service access")
171
+ admin_sg.addRule([admin_sg.cloud_id], comment: "Mu Master service access")
107
172
  else
108
- rules = Array.new
109
- open_ports.each { |port|
110
- rules << {
111
- "port" => port,
112
- "hosts" => ["0.0.0.0/0"]
113
- }
114
- }
115
- rules << {
116
- "port" => 22,
117
- "hosts" => ["#{preferred_ip}/32"]
118
- }
119
173
  cfg = {
120
174
  "name" => "Mu Master",
121
175
  "cloud" => "AWS",
@@ -141,7 +195,6 @@ if instance.public_ip_address != preferred_ip and !preferred_ip.nil? and !prefer
141
195
  filters << {name: "domain", values: ["vpc"]} if !instance.vpc_id.nil?
142
196
  filters << {name: "public-ip", values: [instance.public_ip_address]}
143
197
  resp = MU::Cloud::AWS.ec2.describe_addresses(filters: filters)
144
- pp resp
145
198
  if resp.addresses.size > 0
146
199
  has_elastic_ip
147
200
  end
data/bin/mu-node-manage CHANGED
@@ -88,7 +88,7 @@ avail_deploys = MU::MommaCat.listDeploys
88
88
  do_deploys = []
89
89
  do_nodes = []
90
90
  ok = true
91
- if $opts[:all]
91
+ if $opts[:all] or (ARGV.size == 0 and !$opts[:deploys])
92
92
  do_deploys = avail_deploys
93
93
  else
94
94
  if $opts[:deploys] and !$opts[:all]
@@ -102,16 +102,20 @@ else
102
102
  else
103
103
  do_nodes = ARGV
104
104
  do_deploys = []
105
+ matched = 0
105
106
  if do_nodes.size > 0
106
107
  # Just load the deploys we need
107
108
  do_nodes.each { |node|
108
109
  if node.match(/^(.*?-[^\-]+?-\d{10}-[A-Z]{2})-.*/)
110
+ matched += 1
109
111
  do_deploys << node.sub(/^(.*?-[^\-]+?-\d{10}-[A-Z]{2})-.*/, '\1')
110
112
  end
111
113
  }
112
114
  do_deploys.uniq!
113
115
  end
114
- do_deploys = avail_deploys if do_deploys.size == 0
116
+ if do_deploys.size == 0 and do_nodes.size > 0 and (matched > 0 or ARGV.size > 0)
117
+ do_deploys = avail_deploys
118
+ end
115
119
  end
116
120
  end
117
121
 
@@ -389,7 +393,9 @@ def updateAWSMetaData(deploys = MU::MommaCat.listDeploys, nodes = [])
389
393
  next if !matched
390
394
  end
391
395
 
392
- MU::Cloud::AWS::Server.createIAMProfile(pool_name, base_profile: server['iam_role'], extra_policies: server['iam_policies'])
396
+ # MU::Cloud::AWS::Server.createIAMProfile(pool_name, base_profile: server['iam_role'], extra_policies: server['iam_policies'])
397
+ pool_obj = mommacat.findLitterMate(type: "server_pool", mu_name: pool_name)
398
+ pool_obj.groom
393
399
 
394
400
  resp = MU::Cloud::AWS.autoscale.describe_auto_scaling_groups(
395
401
  auto_scaling_group_names: [pool_name]
@@ -535,20 +541,24 @@ def updateAWSMetaData(deploys = MU::MommaCat.listDeploys, nodes = [])
535
541
  end
536
542
  id = server['cloud_id']
537
543
  id = server['instance_id'] if id.nil?
538
- desc = MU::Cloud::AWS.ec2(server['region']).describe_instances(instance_ids: [id]).reservations.first.instances.first
544
+ desc = MU::Cloud::AWS.ec2(region: server['region']).describe_instances(instance_ids: [id]).reservations.first.instances.first
539
545
 
540
546
  server['conf']["platform"] = "linux" if !server['conf'].has_key?("platform")
541
547
  next if nodes.size > 0 and !nodes.include?(nodename)
542
548
 
543
- rolename, cfm_role_name, cfm_prof_name, arn = MU::Cloud::AWS::Server.createIAMProfile(nodename, base_profile: server["conf"]['iam_role'], extra_policies: server["conf"]['iam_policies'])
544
- MU::Cloud::AWS::Server.addStdPoliciesToIAMProfile(rolename)
545
-
546
549
  mytype = "server"
547
- mytype = "server_pool" if server['conf'].has_key?("basis") or server['conf']['#TYPENAME'] == "ServerPool" or server['conf']["#MU_CLASS"] == "MU::Cloud::AWS::ServerPool"
548
- olduserdata = Base64.decode64(MU::Cloud::AWS.ec2(server['region']).describe_instance_attribute(
549
- instance_id: id,
550
- attribute: "userData"
551
- ).user_data.value)
550
+ if server['conf'].has_key?("basis") or
551
+ server['conf']['#TYPENAME'] == "ServerPool" or
552
+ server['conf']["#MU_CLASS"] == "MU::Cloud::AWS::ServerPool"
553
+ mytype = "server_pool"
554
+ else
555
+ server_obj = mommacat.findLitterMate(type: "server", mu_name: nodename)
556
+ server_obj.groom
557
+ end
558
+ olduserdata = Base64.decode64(MU::Cloud::AWS.ec2(region: server['region']).describe_instance_attribute(
559
+ instance_id: id,
560
+ attribute: "userData"
561
+ ).user_data.value)
552
562
 
553
563
  userdata = MU::Cloud::AWS::Server.fetchUserdata(
554
564
  platform: server['conf']["platform"],
data/bin/mu-self-update CHANGED
@@ -198,13 +198,18 @@ fi
198
198
  /bin/rm -rf $MU_DATADIR/tmp/cookbook_changes.$$
199
199
  /bin/rm -rf $MU_DATADIR/tmp/berks_changes.$$
200
200
 
201
+ /bin/rm -rf /root/.berkshelf/
201
202
  if [ "$rebuild_chef_artifacts" == "1" ];then
202
- /bin/rm -rf /root/.berkshelf/cookbooks
203
+ cd $MU_LIBDIR && berks install
203
204
  $bindir/mu-upload-chef-artifacts -p
204
- else
205
- $bindir/mu-upload-chef-artifacts -r mu
206
205
  fi
207
- $bindir/mu-configure -n
206
+
207
+ # Make double sure our purely-mu cookbooks are uploaded and ready for platform
208
+ # repos to reference.
209
+ $bindir/mu-upload-chef-artifacts -r mu
210
+
211
+ # Now a regular upload for platform repos.
212
+ $bindir/mu-upload-chef-artifacts
208
213
 
209
214
  for dir in $MU_LIBDIR /opt/chef/embedded /opt/opscode/embedded /usr/local/ruby-current/;do
210
215
  echo "${GREEN}Sanitizing permissions in ${BOLD}$dir${NORM}${GREEN}${NORM}"
@@ -215,6 +220,8 @@ for dir in $MU_LIBDIR /opt/chef/embedded /opt/opscode/embedded /usr/local/ruby-c
215
220
  done
216
221
  chmod go+rx $MU_LIBDIR/bin/*
217
222
 
223
+ $bindir/mu-configure -n
224
+
218
225
  set -e
219
226
 
220
227
  if [ "$branch" != "$lastbranch" -a "$discard" != "1" ];then
data/cloud-mu.gemspec CHANGED
@@ -17,8 +17,8 @@ end
17
17
 
18
18
  Gem::Specification.new do |s|
19
19
  s.name = 'cloud-mu'
20
- s.version = '2.0.4'
21
- s.date = '2019-08-28'
20
+ s.version = '2.1.0beta'
21
+ s.date = '2019-05-27'
22
22
  s.require_paths = ['modules']
23
23
  s.required_ruby_version = '>= 2.4'
24
24
  s.summary = "The eGTLabs Mu toolkit for unified cloud deployments"
@@ -52,7 +52,7 @@ EOF
52
52
  s.add_runtime_dependency 'colorize', "~> 0.8"
53
53
  s.add_runtime_dependency 'color', "~> 1.8"
54
54
  s.add_runtime_dependency 'netaddr', '~> 2.0'
55
- s.add_runtime_dependency 'nokogiri', "~> 1.10"
55
+ s.add_runtime_dependency 'nokogiri', "~> 1.8"
56
56
  s.add_runtime_dependency 'solve', '~> 4.0'
57
57
  s.add_runtime_dependency 'net-ldap', "~> 0.16"
58
58
  s.add_runtime_dependency 'net-ssh', "~> 4.2"
@@ -1 +1 @@
1
- {"name":"firewall","version":"2.7.1","description":"Provides a set of primitives for managing firewalls and associated rules.","long_description":"firewall Cookbook\n=================\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/firewall.svg?branch=master)](http://travis-ci.org/chef-cookbooks/firewall)\n[![Cookbook Version](https://img.shields.io/cookbook/v/firewall.svg)](https://supermarket.chef.io/cookbooks/firewall)\n\nProvides a set of primitives for managing firewalls and associated rules.\n\nPLEASE NOTE - The resource/providers in this cookbook are under heavy development. An attempt is being made to keep the resource simple/stupid by starting with less sophisticated firewall implementations first and refactor/vet the resource definition with each successive provider.\n\nRequirements\n------------\n**Chef 12.5.x+** is required. We are currently testing against Chef 13. If you need Chef 11 support, please try pinning back to a version less than 2.0, e.g.:\n```\ndepends 'firewall', '< 2.0'\n```\n\n### Supported firewalls and platforms\n* UFW - Ubuntu, Debian (except 9)\n* IPTables - Red Hat & CentOS, Ubuntu\n* FirewallD - Red Hat & CentOS >= 7.0 (IPv4 only support, [needs contributions/testing](https://github.com/chef-cookbooks/firewall/issues/86))\n* Windows Advanced Firewall - 2012 R2\n\nTested on:\n* Ubuntu 14.04, 16.04 with iptables, ufw\n* Debian 7, 8 with ufw\n* Debian 9 with iptables\n* CentOS 6 with iptables\n* CentOS 7.1 with firewalld\n* Windows Server 2012r2 with Windows Advanced Firewall\n\nBy default, Ubuntu chooses ufw. To switch to iptables, set this in an attribute file:\n```\ndefault['firewall']['ubuntu_iptables'] = true\n```\n\nBy default, Red Hat & CentOS >= 7.0 chooses firewalld. To switch to iptables, set this in an attribute file:\n```\ndefault['firewall']['redhat7_iptables'] = true\n```\n\n# Considerations that apply to all firewall providers and resources\n\nThis cookbook comes with two resources, firewall and firewall rule. The typical usage scenario is as follows:\n\n- run the `:install` action on the `firewall` resource named 'default', which installs appropriate packages and configures services to start on boot and starts them\n\n- run the `:create` action on every `firewall_rule` resource, which adds to the list of rules that should be configured on the firewall. `firewall_rule` then automatically sends a delayed notification to the `firewall['default']` resource to run the `:restart` action.\n\n- run the delayed notification with action `:restart` on the `firewall` resource. if any rules are different than the last run, the provider will update the current state of the firewall rules to match the expected rules.\n\nThere is a fundamental mismatch between the idea of a chef action and the action that should be taken on a firewall rule. For this reason, the chef action for a firewall_rule may be `:nothing` (the rule should not be present in the firewall) or `:create` (the rule should be present in the firewall), but the action taken on a packet in a firewall (`DROP`, `ACCEPT`, etc) is denoted as a `command` parameter on the `firewall_rule` resource.\n\n# iptables considerations\n\nIf you need to use a table other than `*filter`, the best way to do so is like so:\n```\nnode.default['firewall']['iptables']['defaults'][:ruleset] = {\n '*filter' => 1,\n ':INPUT DROP' => 2,\n ':FORWARD DROP' => 3,\n ':OUTPUT ACCEPT_FILTER' => 4,\n 'COMMIT_FILTER' => 100,\n '*nat' => 101,\n ':PREROUTING DROP' => 102,\n ':POSTROUTING DROP' => 103,\n ':OUTPUT ACCEPT_NAT' => 104,\n 'COMMIT_NAT' => 200\n}\n```\n\nNote -- in order to support multiple hash keys containing the same rule, anything found after the underscore will be stripped for: `:OUTPUT :INPUT :POSTROUTING :PREROUTING COMMIT`. This allows an example like the above to be reduced to just repeated lines of `COMMIT` and `:OUTPUT ACCEPT` while still avoiding duplication of other things.\n\nThen it's trivial to add additional rules to the `*nat` table using the raw parameter:\n```\nfirewall_rule \"postroute\" do\n raw \"-A POSTROUTING -o eth1 -p tcp -d 172.28.128.21 -j SNAT --to-source 172.28.128.6\"\n position 150\nend\n```\n\nNote that any line starting with `COMMIT` will become just `COMMIT`, as hash\nkeys must be unique but we need multiple commit lines.\n\n# Recipes\n\n### default\nThe default recipe creates a firewall resource with action install.\n\n### disable_firewall\nUsed to disable platform specific firewall. Many clouds have their own firewall configured outside of the OS instance such as AWS Security Groups.\n\n# Attributes\n\n* `default['firewall']['allow_ssh'] = false`, set true to open port 22 for SSH when the default recipe runs\n* `default['firewall']['allow_mosh'] = false`, set to true to open UDP ports 60000 - 61000 for [Mosh][0] when the default recipe runs\n* `default['firewall']['allow_winrm'] = false`, set true to open port 5989 for WinRM when the default recipe runs\n* `default['firewall']['allow_loopback'] = false`, set to true to allow all traffic on the loopback interface\n* `default['firewall']['allow_icmp'] = false`, set true to allow icmp protocol on supported OSes (note: ufw and windows implementations don't support this)\n\n* `default['firewall']['ubuntu_iptables'] = false`, set to true to use iptables on Ubuntu / Debian when using the default recipe\n* `default['firewall']['redhat7_iptables'] = false`, set to true to use iptables on Red Hat / CentOS 7 when using the default recipe\n\n* `default['firewall']['ufw']['defaults']` hash for template `/etc/default/ufw`\n* `default['firewall']['iptables']['defaults']` hash for default policies for 'filter' table's chains`\n\n* `default['firewall']['windows']['defaults']` hash to define inbound / outbound firewall policy on Windows platform\n\n* `default['firewall']['allow_established'] = true`, set to false if you don't want a related/established default rule on iptables\n* `default['firewall']['ipv6_enabled'] = true`, set to false if you don't want IPv6 related/established default rule on iptables (this enables ICMPv6, which is required for much of IPv6 communication)\n\n* `default['firewall']['firewalld']['permanent'] = false`, set to true if you want firewalld rules to be added with `--permanent` so they survive a reboot. This will be changed to `true` by default in a future major version release.\n\n# Resources\n\n### firewall\n\n***NB***: The name 'default' of this resource is important as it is used for firewall_rule providers to locate the firewall resource. If you change it, you must also supply the same value to any firewall_rule resources using the `firewall_name` parameter.\n\n#### Actions\n- `:install` (*default action*): Install and Enable the firewall. This will ensure the appropriate packages are installed and that any services have been started.\n- `:disable`: Disable the firewall. Drop any rules and put the node in an unprotected state. Flush all current rules. Also erase any internal state used to detect when rules should be applied.\n- `:flush`: Flush all current rules. Also erase any internal state used to detect when rules should be applied.\n- `:save`: Ensure all rules are added permanently under firewalld using `--permanent`. Not supported on ufw, iptables. You must notify this action at the end of the chef run if you want permanent firewalld rules (they are not persistent by default).\n\n#### Parameters\n\n- `disabled` (default to `false`): If set to true, all actions will no-op on this resource. This is a way to prevent included cookbooks from configuring a firewall.\n- `ipv6_enabled` (default to `true`): If set to false, firewall will not perform any ipv6 related work. Currently only supported in iptables.\n- `log_level`: UFW only. Level of verbosity the firewall should log at. valid values are: :low, :medium, :high, :full, :off. default is :low.\n- `rules`: This is used internally for firewall_rule resources to append their rules. You should NOT touch this value unless you plan to supply an entire firewall ruleset at once, and skip using firewall_rule resources.\n- `disabled_zone` (firewalld only): The zone to set on firewalld when the firewall should be disabled. Can be any string in symbol form, e.g. :public, :drop, etc. Defaults to `:public.`\n- `enabled_zone` (firewalld only): The zone to set on firewalld when the firewall should be enabled. Can be any string in symbol form, e.g. :public, :drop, etc. Defaults to `:drop.`\n- `package_options`: Used to pass options to the package install of firewall\n\n#### Examples\n\n```ruby\n# all defaults\nfirewall 'default'\n\n# enable platform default firewall\nfirewall 'default' do\n action :install\nend\n\n# increase logging past default of 'low'\nfirewall 'default' do\n log_level :high\n action :install\nend\n```\n\n### firewall_rule\n\n#### Actions\n- `:create` (_default action_): If a firewall_rule runs this action, the rule will be recorded in a chef resource's internal state, and applied when providers automatically notify the firewall resource with action `:reload`. The notification happens automatically.\n\n#### Parameters\n\n- `firewall_name`: the matching firewall resource that this rule applies to. Default value: `default`\n\n- `raw`: Used to pass an entire rule as a string, omitting all other parameters. This line will be directly loaded by `iptables-restore`, fed directly into `ufw` on the command line, or run using `firewall-cmd`.\n\n- `description` (_default: same as rule name_): Used to provide a comment that will be included when adding the firewall rule.\n\n- `include_comment` (_default: true_): Used to optionally exclude the comment in the rule.\n\n- `position` (_default: 50_): **relative** position to insert rule at. Position may be any integer between 0 < n < 100 (exclusive), and more than one rule may specify the same position.\n\n- `command`: What action to take on a particular packet\n\n - `:allow` (_default action_): the rule should allow matching packets\n - `:deny`: the rule should deny matching packets\n - `:reject`: the rule should reject matching packets\n - `:masqerade`: Masquerade the matching packets\n - `:redirect`: Redirect the matching packets\n - `:log`: Configure logging\n\n- `stateful`: a symbol or array of symbols, such as ``[:related, :established]` that will be passed to the state module in iptables or firewalld.\n\n- `protocol`: `:tcp` (_default_), `:udp`, `:icmp`, `:none` or protocol number. Using protocol numbers is not supported using the ufw provider (default for debian/ubuntu systems).\n\n- `direction`: For ufw, direction of the rule. valid values are: `:in` (_default_), `:out`, `:pre`, `:post`.\n\n- `source` (_Default is `0.0.0.0/0` or `Anywhere`_): source ip address or subnet to filter.\n\n- `source_port` (_Default is nil_): source port for filtering packets.\n\n- `destination`: ip address or subnet to filter on packet destination, must be a valid IP\n\n- `port` or `dest_port`: target port number (ie. 22 to allow inbound SSH), or an array of incoming port numbers (ie. [80,443] to allow inbound HTTP & HTTPS).\n\n NOTE: `protocol` attribute is required with multiple ports, or a range of incoming port numbers (ie. 60000..61000 to allow inbound mobile-shell. NOTE: `protocol`, or an attribute is required with a range of ports.\n\n- `interface`: (source) interface to apply rule (ie. `eth0`).\n\n- `dest_interface`: interface where packets may be destined to go\n\n- `redirect_port`: redirected port for rules with command `:redirect`\n\n- `logging`: may be added to enable logging for a particular rule. valid values are: `:connections`, `:packets`. In the ufw provider, `:connections` logs new connections while `:packets` logs all packets.\n\n#### Examples\n\n```ruby\n# open standard ssh port\nfirewall_rule 'ssh' do\n port 22\n command :allow\nend\n\n# open standard http port to tcp traffic only; insert as first rule\nfirewall_rule 'http' do\n port 80\n protocol :tcp\n position 1\n command :allow\nend\n\n# restrict port 13579 to 10.0.111.0/24 on eth0\nfirewall_rule 'myapplication' do\n port 13579\n source '10.0.111.0/24'\n direction :in\n interface 'eth0'\n command :allow\nend\n\n# specify a protocol number (supported on centos/redhat)\nfirewall_rule 'vrrp' do\n protocol 112\n command :allow\nend\n\n# use the iptables provider to specify protocol number on debian/ubuntu\nfirewall_rule 'vrrp' do\n provider Chef::Provider::FirewallRuleIptables\n protocol 112\n command :allow\nend\n\n# can use :raw command with UFW provider for VRRP\nfirewall_rule \"VRRP\" do\n command :allow\n raw \"allow to 224.0.0.18\"\nend\n\n# open UDP ports 60000..61000 for mobile shell (mosh.mit.edu), note\n# that the protocol attribute is required when using port_range\nfirewall_rule 'mosh' do\n protocol :udp\n port 60000..61000\n command :allow\nend\n\n# open multiple ports for http/https, note that the protocol\n# attribute is required when using ports\nfirewall_rule 'http/https' do\n protocol :tcp\n port [80, 443]\n command :allow\nend\n\nfirewall 'default' do\n enabled false\n action :nothing\nend\n```\n\n#### Providers\n\n- See `libraries/z_provider_mapping.rb` for a full list of providers for each platform and version.\n\nDifferent providers will determine the current state of the rules differently -- parsing the output of a command, maintaining the state in a file, or some other way. If the firewall is adjusted from outside of chef (non-idempotent), it's possible that chef may be caught unaware of the current state of the firewall. The best workaround is to add a `:flush` action to the firewall resource as early as possible in the chef run, if you plan to modify the firewall state outside of chef.\n\n# Troubleshooting\n\nTo figure out what the position values are for current rules, print the hash that contains the weights:\n```\nrequire pp\ndefault_firewall = resources(:firewall, 'default')\npp default_firewall.rules\n```\n\n# Development\nThis section details \"quick development\" steps. For a detailed explanation, see [[Contributing.md]].\n\n1. Clone this repository from GitHub:\n\n $ git clone git@github.com:chef-cookbooks/firewall.git\n\n2. Create a git branch\n\n $ git checkout -b my_bug_fix\n\n3. Install dependencies:\n\n $ bundle install\n\n4. Make your changes/patches/fixes, committing appropiately\n5. **Write tests**\n6. Run the tests:\n - `bundle exec foodcritic -f any .`\n - `bundle exec rspec`\n - `bundle exec rubocop`\n - `bundle exec kitchen test`\n\n In detail:\n - Foodcritic will catch any Chef-specific style errors\n - RSpec will run the unit tests\n - Rubocop will check for Ruby-specific style errors\n - Test Kitchen will run and converge the recipes\n\n\n# License & Authors\n<!-- $ find -type f -iname \"*.rb\" -exec grep -i author '{}' \\; | sort -k4 | uniq | sed 's/#/-/g' -->\n- Author:: Seth Chisamore (<schisamo@opscode.com>)\n- Author:: Ronald Doorn (<rdoorn@schubergphilis.com>)\n- Author:: Martin Smith (<martin@mbs3.org>)\n- Author:: Sander van Harmelen (<svanharmelen@schubergphilis.com>)\n\n```text\nCopyright:: 2011-2015, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[0]: https://mosh.mit.edu/\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"centos":">= 0.0.0","debian":">= 0.0.0","ubuntu":">= 0.0.0","windows":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/firewall","issues_url":"https://github.com/chef-cookbooks/firewall/issues","chef_version":[[">= 12.5"]],"ohai_version":[]}
1
+ {"name":"firewall","version":"2.7.1","description":"Provides a set of primitives for managing firewalls and associated rules.","long_description":"firewall Cookbook\n=================\n\n[![Build Status](https://travis-ci.org/chef-cookbooks/firewall.svg?branch=master)](http://travis-ci.org/chef-cookbooks/firewall)\n[![Cookbook Version](https://img.shields.io/cookbook/v/firewall.svg)](https://supermarket.chef.io/cookbooks/firewall)\n\nProvides a set of primitives for managing firewalls and associated rules.\n\nPLEASE NOTE - The resource/providers in this cookbook are under heavy development. An attempt is being made to keep the resource simple/stupid by starting with less sophisticated firewall implementations first and refactor/vet the resource definition with each successive provider.\n\nRequirements\n------------\n**Chef 12.5.x+** is required. We are currently testing against Chef 13. If you need Chef 11 support, please try pinning back to a version less than 2.0, e.g.:\n```\ndepends 'firewall', '< 2.0'\n```\n\n### Supported firewalls and platforms\n* UFW - Ubuntu, Debian (except 9)\n* IPTables - Red Hat & CentOS, Ubuntu\n* FirewallD - Red Hat & CentOS >= 7.0 (IPv4 only support, [needs contributions/testing](https://github.com/chef-cookbooks/firewall/issues/86))\n* Windows Advanced Firewall - 2012 R2\n\nTested on:\n* Ubuntu 14.04, 16.04 with iptables, ufw\n* Debian 7, 8 with ufw\n* Debian 9 with iptables\n* CentOS 6 with iptables\n* CentOS 7.1 with firewalld\n* Windows Server 2012r2 with Windows Advanced Firewall\n\nBy default, Ubuntu chooses ufw. To switch to iptables, set this in an attribute file:\n```\ndefault['firewall']['ubuntu_iptables'] = true\n```\n\nBy default, Red Hat & CentOS >= 7.0 chooses firewalld. To switch to iptables, set this in an attribute file:\n```\ndefault['firewall']['redhat7_iptables'] = true\n```\n\n# Considerations that apply to all firewall providers and resources\n\nThis cookbook comes with two resources, firewall and firewall rule. The typical usage scenario is as follows:\n\n- run the `:install` action on the `firewall` resource named 'default', which installs appropriate packages and configures services to start on boot and starts them\n\n- run the `:create` action on every `firewall_rule` resource, which adds to the list of rules that should be configured on the firewall. `firewall_rule` then automatically sends a delayed notification to the `firewall['default']` resource to run the `:restart` action.\n\n- run the delayed notification with action `:restart` on the `firewall` resource. if any rules are different than the last run, the provider will update the current state of the firewall rules to match the expected rules.\n\nThere is a fundamental mismatch between the idea of a chef action and the action that should be taken on a firewall rule. For this reason, the chef action for a firewall_rule may be `:nothing` (the rule should not be present in the firewall) or `:create` (the rule should be present in the firewall), but the action taken on a packet in a firewall (`DROP`, `ACCEPT`, etc) is denoted as a `command` parameter on the `firewall_rule` resource.\n\n# iptables considerations\n\nIf you need to use a table other than `*filter`, the best way to do so is like so:\n```\nnode.default['firewall']['iptables']['defaults'][:ruleset] = {\n '*filter' => 1,\n ':INPUT DROP' => 2,\n ':FORWARD DROP' => 3,\n ':OUTPUT ACCEPT_FILTER' => 4,\n 'COMMIT_FILTER' => 100,\n '*nat' => 101,\n ':PREROUTING DROP' => 102,\n ':POSTROUTING DROP' => 103,\n ':OUTPUT ACCEPT_NAT' => 104,\n 'COMMIT_NAT' => 200\n}\n```\n\nNote -- in order to support multiple hash keys containing the same rule, anything found after the underscore will be stripped for: `:OUTPUT :INPUT :POSTROUTING :PREROUTING COMMIT`. This allows an example like the above to be reduced to just repeated lines of `COMMIT` and `:OUTPUT ACCEPT` while still avoiding duplication of other things.\n\nThen it's trivial to add additional rules to the `*nat` table using the raw parameter:\n```\nfirewall_rule \"postroute\" do\n raw \"-A POSTROUTING -o eth1 -p tcp -d 172.28.128.21 -j SNAT --to-source 172.28.128.6\"\n position 150\nend\n```\n\nNote that any line starting with `COMMIT` will become just `COMMIT`, as hash\nkeys must be unique but we need multiple commit lines.\n\n# Recipes\n\n### default\nThe default recipe creates a firewall resource with action install.\n\n### disable_firewall\nUsed to disable platform specific firewall. Many clouds have their own firewall configured outside of the OS instance such as AWS Security Groups.\n\n# Attributes\n\n* `default['firewall']['allow_ssh'] = false`, set true to open port 22 for SSH when the default recipe runs\n* `default['firewall']['allow_mosh'] = false`, set to true to open UDP ports 60000 - 61000 for [Mosh][0] when the default recipe runs\n* `default['firewall']['allow_winrm'] = false`, set true to open port 5989 for WinRM when the default recipe runs\n* `default['firewall']['allow_loopback'] = false`, set to true to allow all traffic on the loopback interface\n* `default['firewall']['allow_icmp'] = false`, set true to allow icmp protocol on supported OSes (note: ufw and windows implementations don't support this)\n\n* `default['firewall']['ubuntu_iptables'] = false`, set to true to use iptables on Ubuntu / Debian when using the default recipe\n* `default['firewall']['redhat7_iptables'] = false`, set to true to use iptables on Red Hat / CentOS 7 when using the default recipe\n\n* `default['firewall']['ufw']['defaults']` hash for template `/etc/default/ufw`\n* `default['firewall']['iptables']['defaults']` hash for default policies for 'filter' table's chains`\n\n* `default['firewall']['windows']['defaults']` hash to define inbound / outbound firewall policy on Windows platform\n\n* `default['firewall']['allow_established'] = true`, set to false if you don't want a related/established default rule on iptables\n* `default['firewall']['ipv6_enabled'] = true`, set to false if you don't want IPv6 related/established default rule on iptables (this enables ICMPv6, which is required for much of IPv6 communication)\n\n* `default['firewall']['firewalld']['permanent'] = false`, set to true if you want firewalld rules to be added with `--permanent` so they survive a reboot. This will be changed to `true` by default in a future major version release.\n\n# Resources\n\n### firewall\n\n***NB***: The name 'default' of this resource is important as it is used for firewall_rule providers to locate the firewall resource. If you change it, you must also supply the same value to any firewall_rule resources using the `firewall_name` parameter.\n\n#### Actions\n- `:install` (*default action*): Install and Enable the firewall. This will ensure the appropriate packages are installed and that any services have been started.\n- `:disable`: Disable the firewall. Drop any rules and put the node in an unprotected state. Flush all current rules. Also erase any internal state used to detect when rules should be applied.\n- `:flush`: Flush all current rules. Also erase any internal state used to detect when rules should be applied.\n- `:save`: Ensure all rules are added permanently under firewalld using `--permanent`. Not supported on ufw, iptables. You must notify this action at the end of the chef run if you want permanent firewalld rules (they are not persistent by default).\n\n#### Parameters\n\n- `disabled` (default to `false`): If set to true, all actions will no-op on this resource. This is a way to prevent included cookbooks from configuring a firewall.\n- `ipv6_enabled` (default to `true`): If set to false, firewall will not perform any ipv6 related work. Currently only supported in iptables.\n- `log_level`: UFW only. Level of verbosity the firewall should log at. valid values are: :low, :medium, :high, :full, :off. default is :low.\n- `rules`: This is used internally for firewall_rule resources to append their rules. You should NOT touch this value unless you plan to supply an entire firewall ruleset at once, and skip using firewall_rule resources.\n- `disabled_zone` (firewalld only): The zone to set on firewalld when the firewall should be disabled. Can be any string in symbol form, e.g. :public, :drop, etc. Defaults to `:public.`\n- `enabled_zone` (firewalld only): The zone to set on firewalld when the firewall should be enabled. Can be any string in symbol form, e.g. :public, :drop, etc. Defaults to `:drop.`\n- `package_options`: Used to pass options to the package install of firewall\n\n#### Examples\n\n```ruby\n# all defaults\nfirewall 'default'\n\n# enable platform default firewall\nfirewall 'default' do\n action :install\nend\n\n# increase logging past default of 'low'\nfirewall 'default' do\n log_level :high\n action :install\nend\n```\n\n### firewall_rule\n\n#### Actions\n- `:create` (_default action_): If a firewall_rule runs this action, the rule will be recorded in a chef resource's internal state, and applied when providers automatically notify the firewall resource with action `:reload`. The notification happens automatically.\n\n#### Parameters\n\n- `firewall_name`: the matching firewall resource that this rule applies to. Default value: `default`\n\n- `raw`: Used to pass an entire rule as a string, omitting all other parameters. This line will be directly loaded by `iptables-restore`, fed directly into `ufw` on the command line, or run using `firewall-cmd`.\n\n- `description` (_default: same as rule name_): Used to provide a comment that will be included when adding the firewall rule.\n\n- `include_comment` (_default: true_): Used to optionally exclude the comment in the rule.\n\n- `position` (_default: 50_): **relative** position to insert rule at. Position may be any integer between 0 < n < 100 (exclusive), and more than one rule may specify the same position.\n\n- `command`: What action to take on a particular packet\n\n - `:allow` (_default action_): the rule should allow matching packets\n - `:deny`: the rule should deny matching packets\n - `:reject`: the rule should reject matching packets\n - `:masqerade`: Masquerade the matching packets\n - `:redirect`: Redirect the matching packets\n - `:log`: Configure logging\n\n- `stateful`: a symbol or array of symbols, such as ``[:related, :established]` that will be passed to the state module in iptables or firewalld.\n\n- `protocol`: `:tcp` (_default_), `:udp`, `:icmp`, `:none` or protocol number. Using protocol numbers is not supported using the ufw provider (default for debian/ubuntu systems).\n\n- `direction`: For ufw, direction of the rule. valid values are: `:in` (_default_), `:out`, `:pre`, `:post`.\n\n- `source` (_Default is `0.0.0.0/0` or `Anywhere`_): source ip address or subnet to filter.\n\n- `source_port` (_Default is nil_): source port for filtering packets.\n\n- `destination`: ip address or subnet to filter on packet destination, must be a valid IP\n\n- `port` or `dest_port`: target port number (ie. 22 to allow inbound SSH), or an array of incoming port numbers (ie. [80,443] to allow inbound HTTP & HTTPS).\n\n NOTE: `protocol` attribute is required with multiple ports, or a range of incoming port numbers (ie. 60000..61000 to allow inbound mobile-shell. NOTE: `protocol`, or an attribute is required with a range of ports.\n\n- `interface`: (source) interface to apply rule (ie. `eth0`).\n\n- `dest_interface`: interface where packets may be destined to go\n\n- `redirect_port`: redirected port for rules with command `:redirect`\n\n- `logging`: may be added to enable logging for a particular rule. valid values are: `:connections`, `:packets`. In the ufw provider, `:connections` logs new connections while `:packets` logs all packets.\n\n#### Examples\n\n```ruby\n# open standard ssh port\nfirewall_rule 'ssh' do\n port 22\n command :allow\nend\n\n# open standard http port to tcp traffic only; insert as first rule\nfirewall_rule 'http' do\n port 80\n protocol :tcp\n position 1\n command :allow\nend\n\n# restrict port 13579 to 10.0.111.0/24 on eth0\nfirewall_rule 'myapplication' do\n port 13579\n source '10.0.111.0/24'\n direction :in\n interface 'eth0'\n command :allow\nend\n\n# specify a protocol number (supported on centos/redhat)\nfirewall_rule 'vrrp' do\n protocol 112\n command :allow\nend\n\n# use the iptables provider to specify protocol number on debian/ubuntu\nfirewall_rule 'vrrp' do\n provider Chef::Provider::FirewallRuleIptables\n protocol 112\n command :allow\nend\n\n# can use :raw command with UFW provider for VRRP\nfirewall_rule \"VRRP\" do\n command :allow\n raw \"allow to 224.0.0.18\"\nend\n\n# open UDP ports 60000..61000 for mobile shell (mosh.mit.edu), note\n# that the protocol attribute is required when using port_range\nfirewall_rule 'mosh' do\n protocol :udp\n port 60000..61000\n command :allow\nend\n\n# open multiple ports for http/https, note that the protocol\n# attribute is required when using ports\nfirewall_rule 'http/https' do\n protocol :tcp\n port [80, 443]\n command :allow\nend\n\nfirewall 'default' do\n enabled false\n action :nothing\nend\n```\n\n#### Providers\n\n- See `libraries/z_provider_mapping.rb` for a full list of providers for each platform and version.\n\nDifferent providers will determine the current state of the rules differently -- parsing the output of a command, maintaining the state in a file, or some other way. If the firewall is adjusted from outside of chef (non-idempotent), it's possible that chef may be caught unaware of the current state of the firewall. The best workaround is to add a `:flush` action to the firewall resource as early as possible in the chef run, if you plan to modify the firewall state outside of chef.\n\n# Troubleshooting\n\nTo figure out what the position values are for current rules, print the hash that contains the weights:\n```\nrequire pp\ndefault_firewall = resources(:firewall, 'default')\npp default_firewall.rules\n```\n\n# Development\nThis section details \"quick development\" steps. For a detailed explanation, see [[Contributing.md]].\n\n1. Clone this repository from GitHub:\n\n $ git clone git@github.com:chef-cookbooks/firewall.git\n\n2. Create a git branch\n\n $ git checkout -b my_bug_fix\n\n3. Install dependencies:\n\n $ bundle install\n\n4. Make your changes/patches/fixes, committing appropiately\n5. **Write tests**\n6. Run the tests:\n - `bundle exec foodcritic -f any .`\n - `bundle exec rspec`\n - `bundle exec rubocop`\n - `bundle exec kitchen test`\n\n In detail:\n - Foodcritic will catch any Chef-specific style errors\n - RSpec will run the unit tests\n - Rubocop will check for Ruby-specific style errors\n - Test Kitchen will run and converge the recipes\n\n\n# License & Authors\n<!-- $ find -type f -iname \"*.rb\" -exec grep -i author '{}' \\; | sort -k4 | uniq | sed 's/#/-/g' -->\n- Author:: Seth Chisamore (<schisamo@opscode.com>)\n- Author:: Ronald Doorn (<rdoorn@schubergphilis.com>)\n- Author:: Martin Smith (<martin@mbs3.org>)\n- Author:: Sander van Harmelen (<svanharmelen@schubergphilis.com>)\n\n```text\nCopyright:: 2011-2015, Chef Software, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n[0]: https://mosh.mit.edu/\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"centos":">= 0.0.0","debian":">= 0.0.0","ubuntu":">= 0.0.0","windows":">= 0.0.0"},"dependencies":{"chef-sugar":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/firewall","issues_url":"https://github.com/chef-cookbooks/firewall/issues","chef_version":[[">= 12.5"]],"ohai_version":[]}
@@ -17,6 +17,10 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
+ chef_sugar_cookbook_version = Gem::Version.new(run_context.cookbook_collection['chef-sugar'].metadata.version)
21
+
22
+ include_recipe 'chef-sugar' if chef_sugar_cookbook_version < Gem::Version.new('4.0.0')
23
+
20
24
  firewall 'default' do
21
25
  ipv6_enabled node['firewall']['ipv6_enabled']
22
26
  action :install
@@ -251,9 +251,6 @@ if !node['update_nagios_only']
251
251
  <p>
252
252
  <a href='https://#{MU.mu_public_addr}/nagios/'>Nagios monitoring GUI</a>
253
253
  </p>
254
- <p>
255
- <a href='https://#{MU.mu_public_addr}/jenkins/'>Jenkins interface GUI</a>
256
- </p>
257
254
  <p>
258
255
  <a href='#{(mubranch.nil? or mubranch == "master" or mubranch.match(/detached from/)) ? "https://cloudamatic.gitlab.io/mu/" : "http://"+MU.mu_public_addr+"/docs"}'>Mu API documentation</a>
259
256
  </p>