Skip to content

Commit

Permalink
1.1.0 release
Browse files Browse the repository at this point in the history
* depends 'sysctl' and 'iptables'
* setup-ip-masquerading.rb -> setup-ip-masquerading.rb
** setctl net.ipv4.ip_forward
** add a template 'masquerade.erb'
* add default recipe (include all other recipes)
  • Loading branch information
yuki-takei committed Apr 20, 2014
1 parent b9540a6 commit 1f9f2e2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
2 changes: 2 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
site :opscode
metadata

cookbook "sysctl", "= 0.4.0"
cookbook "iptables", "= 0.13.2"
cookbook "cron", "= 1.3.6"

cookbook "awscli", git: "https://github.com/weseek/chef-awscli"
Expand Down
5 changes: 4 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
license 'All rights reserved'
description 'Setup NAT instances on Amazon EC2/VPC'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.0.3'
version '1.1.0'

depends 'sysctl'
depends 'iptables'
depends 'awscli'
depends 'cron'

depends 'databag-util'
depends 'ec2util'
12 changes: 12 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Cookbook Name:: vpcnat
# Recipe:: default
#
# Copyright 2014, WESEEK, Inc.
#
# All rights reserved - Do Not Redistribute
#

include_recipe 'vpcnat::disable-source-dest-check'
include_recipe 'vpcnat::setup-ip-masquerading'
include_recipe 'vpcnat::setup-heartbeat-script'
30 changes: 30 additions & 0 deletions recipes/setup-ip-masquerading.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Cookbook Name:: vpcnat
# Recipe:: setup-iptables-rules
#
# Copyright 2014, WESEEK, Inc.
#
# All rights reserved - Do Not Redistribute
#


Chef::Log.info("setting up IP Masquerading")

# setting net.ipv4.ip_forwart=1
include_recipe 'sysctl'

sysctl_param 'net.ipv4.ip_forward' do
value 1
end


# setting iptables
include_recipe 'iptables'

iptables_rule "masquerade" do
source "iptables/masquerade.erb"
variables({
:ipmasq_src => node["vpcnat"][:ipmasq_src]
})
end

8 changes: 0 additions & 8 deletions recipes/setup-iptables-rules.rb

This file was deleted.

1 change: 1 addition & 0 deletions templates/default/iptables/masquerade.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-t nat -A POSTROUTING -s <%= @ipmasq_src %> -j MASQUERADE

0 comments on commit 1f9f2e2

Please sign in to comment.