From 5ff1b4a5a9647c5da59821d2c90804230f09a627 Mon Sep 17 00:00:00 2001 From: Tallys Martins Date: Tue, 26 Jan 2016 11:03:16 -0200 Subject: [PATCH] Fixes lxc bridge to be dynamically set --- Rakefile | 3 ++- local.rake.example | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index ea54cbc..f7c849e 100644 --- a/Rakefile +++ b/Rakefile @@ -41,7 +41,8 @@ if $SPB_ENV == 'lxc' end File.open('config/lxc/iptables-filter-rules', 'w') do |f| - lxc_host_bridge_ip = '192.168.122.1' # FIXME don't hardcode + lxc_host_bridge_name = `awk '{ if ($1 == "lxc.network.link") { print($3) } }' /etc/lxc/default.conf`.strip + lxc_host_bridge_ip = ` /sbin/ifconfig #{lxc_host_bridge_name} | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1 }' `.strip f.puts "-A INPUT -s #{lxc_host_bridge_ip} -p tcp -m state --state NEW --dport 22 -j ACCEPT" f.puts "-A INPUT -s #{lxc_host_bridge_ip} -p tcp -m state --state NEW --dport 5555 -j ACCEPT" end diff --git a/local.rake.example b/local.rake.example index 072a4a6..29c0251 100644 --- a/local.rake.example +++ b/local.rake.example @@ -1,2 +1,7 @@ # copy this file to local.rake and adjust to your local environment ENV['CHAKE_RSYNC_OPTIONS'] = '--exclude tmp/dump' + +# if you have vagrant lxc installed and want to use it, just copy the settings below to your local.rake +# and run vagrant up --provider lxc +#ENV['VAGRANT_BOX'] = 'frensjan/centos-7-64-lxc' #you can figure out a different lxc box if you want +#ENV['SPB_ENV'] = 'lxc' -- libgit2 0.21.2