Andy Bach <afb...@gmail.com> hat am 17. August 2012 um 20:25 geschrieben:

> On Fri, Aug 17, 2012 at 1:19 PM, Andy Bach <afb...@gmail.com> wrote:
> > Well, 'task' isn't a Perl function built-in or core module
>
> Whoops - dang gmail hides the subject line on me -
> http://search.cpan.org/~jfried/Rex-0.31.3/lib/Rex/Commands/Iptables.pm
>
> you left off the line:
> use Rex::Commands::Iptables;
>
> The module defines 'task' - so you'll need to get that installed in
> order to get it to work/test - you want to look up a level
> http://search.cpan.org/~jfried/Rex-0.31.3/lib/Rex/Commands.pm
>
> to see what Rex is doing w/ tasks in order to get a handle on what's
> happening. IpTables is just one of the things/modules under Rex
> http://search.cpan.org/~jfried/Rex-0.31.5/lib/Rex.pm
>
> --
>
> a
>
> Andy Bach,
> afb...@gmail.com
> 608 658-1890 cell
> 608 261-5738 wk

Wow, that was fast; thank you!

I did define it - here is the code that produced the output:


#!/usr/bin/env perl

use Rex::Commands::Iptables;

task "firewall", sub {
   iptables_clear;

   open_port 22;
   open_port [22, 80] => {
      dev => "eth0",
   };

   close_port 22 => {
      dev => "eth0",
   };
   close_port "all";

   redirect_port 80 => 10080;
   redirect_port 80 => {
      dev => "eth0",
      to  => 10080,
   };

   default_state_rule;
   default_state_rule dev => "eth0";

   is_nat_gateway;

   iptables t => "nat",
            A => "POSTROUTING",
            o => "eth0",
            j => "MASQUERADE";

};

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to