package commands

import (
	"provisioner/provisioner"
)

type CloseAllPorts struct {
	CmdRunner provisioner.CmdRunner
}

func (c *CloseAllPorts) Run() error {
	err := c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "eth0", "-p", "tcp", "-j", "DROP")
	if err != nil {
		return err
	}

	err = c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "eth1", "-p", "tcp", "-j", "DROP")
	if err != nil {
		return err
	}
	return c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "lo", "-j", "ACCEPT")
}

func (*CloseAllPorts) Distro() string {
	return provisioner.DistributionOSS
}
package commands

import (
	"provisioner/provisioner"
)

type CloseAllPorts struct {
	CmdRunner provisioner.CmdRunner
}

func (c *CloseAllPorts) Run() error {
	err := c.CmdRunner.Run("iptables", "-I", "INPUT", "-p", "tcp", "-j", "DROP")
	if err != nil {
		return err
	}
	return c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "lo", "-j", "ACCEPT")
}

func (*CloseAllPorts) Distro() string {
	return provisioner.DistributionOSS
}
--- 
+++ 
@@ -9,7 +9,12 @@
 }
 
 func (c *CloseAllPorts) Run() error {
-	err := c.CmdRunner.Run("iptables", "-I", "INPUT", "-p", "tcp", "-j", "DROP")
+	err := c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "eth0", "-p", "tcp", "-j", "DROP")
+	if err != nil {
+		return err
+	}
+
+	err = c.CmdRunner.Run("iptables", "-I", "INPUT", "-i", "eth1", "-p", "tcp", "-j", "DROP")
 	if err != nil {
 		return err
 	}
Allow traffic from app containers to PCF Dev

[#130758953]

Signed-off-by: Chhavi Kankaria <a45f933d80ef78816bcf302f872972e3887e5115@pivotal.io>
