Commit db1fb8641bdc4572226e6dc5a10a72232a969849

Authored by Sergio Oliveira
1 parent c024c365

Install iptables rules

cookbooks/reverse_proxy/recipes/default.rb
1 1 package 'iptables-services'
2 2  
  3 +service 'iptables' do
  4 + action :enable
  5 + supports :restart => true
  6 +end
  7 +
  8 +template '/etc/sysconfig/iptables' do
  9 + owner 'root'
  10 + group 'root'
  11 + mode 0644
  12 + notifies :restart, 'service[iptables]'
  13 +end
  14 +
3 15 cookbook_file "/etc/nginx/#{node['config']['external_hostname']}.crt" do
4 16 owner 'root'
5 17 group 'root'
... ...
cookbooks/reverse_proxy/templates/firewall.erb
... ... @@ -1,17 +0,0 @@
1   -# Generated by iptables-save v1.4.21 on Thu Apr 16 20:28:15 2015
2   -*nat
3   -:PREROUTING ACCEPT [5:493]
4   -:INPUT ACCEPT [5:493]
5   -:OUTPUT ACCEPT [2:138]
6   -:POSTROUTING ACCEPT [2:138]
7   --A PREROUTING -d <%= node['peers']['reverseproxy'] %>/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination <%= node['peers']['integration'] %>:22
8   --A POSTROUTING -d <%= node['peers']['reverseproxy'] %>/32 -p tcp -m tcp --dport 22 -j SNAT --to-source <%= node['peers']['integration'] %>
9   -COMMIT
10   -# Completed on Thu Apr 16 20:28:15 2015
11   -# Generated by iptables-save v1.4.21 on Thu Apr 16 20:28:15 2015
12   -*filter
13   -:INPUT ACCEPT [5675:7406907]
14   -:FORWARD ACCEPT [66:13348]
15   -:OUTPUT ACCEPT [3901:279969]
16   -COMMIT
17   -# Completed on Thu Apr 16 20:28:15 2015
cookbooks/reverse_proxy/templates/iptables.erb 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +# Generated by iptables-save v1.4.21 on Thu Apr 16 20:28:15 2015
  2 +*nat
  3 +:PREROUTING ACCEPT [5:493]
  4 +:INPUT ACCEPT [5:493]
  5 +:OUTPUT ACCEPT [2:138]
  6 +:POSTROUTING ACCEPT [2:138]
  7 +-A PREROUTING -d <%= node['peers']['reverseproxy'] %>/32 -p tcp -m tcp --dport 22 -j DNAT --to-destination <%= node['peers']['integration'] %>:22
  8 +-A POSTROUTING -d <%= node['peers']['integration'] %>/32 -p tcp -m tcp --dport 22 -j SNAT --to-source <%= node['peers']['reverseproxy'] %>
  9 +COMMIT
  10 +# Completed on Thu Apr 16 20:28:15 2015
  11 +# Generated by iptables-save v1.4.21 on Thu Apr 16 20:28:15 2015
  12 +*filter
  13 +:INPUT ACCEPT [5675:7406907]
  14 +:FORWARD ACCEPT [66:13348]
  15 +:OUTPUT ACCEPT [3901:279969]
  16 +COMMIT
  17 +# Completed on Thu Apr 16 20:28:15 2015
... ...