This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Manipulate status of firewall rule on iPhone/Ipad with Confd command line client

Hi,

In the past I made an iOS app for my wifes iPhone to block/unblock Internet for our kids. This worked with DD-WRT on my access-point.

We now have a ASG home edition as firewall instead of the firewall in DD-WRT.
So I want to make a new iOS App that changes the status of a firewall rule object with cc (confd) by means of a GUI which uses SSH in the background.
I can't seem to figure out the syntax to change the status switch value of a firewall rule object.
Can someone help me with te correct commandline syntax?

Thanks in advance.
Jacco


This thread was automatically locked due to age.
Parents
  • there are several threads that give some tweaks about varous things but there's no official documentation for what you are trying to do..[[:)]]  maybe with those mdw commands you might be able to tinker with it and figure it out..[[:)]]
Reply
  • there are several threads that give some tweaks about varous things but there's no official documentation for what you are trying to do..[[:)]]  maybe with those mdw commands you might be able to tinker with it and figure it out..[[:)]]
Children
  • Hi Jacco,
    you can use the following script to toggle the status of a packetfilter rule when you know the confd reference of the rule object:

    #!/usr/bin/perl
    use warnings;
    use strict;

    use Astaro::ConfdPlRPC;
    use Data:[:D]umper;

    my $ref = shift(@ARGV);
    die "usage: $0 \n" unless defined($ref) && $ref =~ /REF_/;
    chomp($ref);
    my $sys = new Astaro::ConfdPlRPC() or die "Login failed.\n";
    $sys->lock();
    my $obj = $sys->get_object($ref);
    die "Unknown object $ref\n" unless $obj;
    print $obj->{data}->{status}." => ".($obj->{data}->{status}?0:1)."\n";
    $obj->{data}->{status} = ($obj->{data}->{status}?0:1);
    die Dumper($sys->err_list()) unless $sys->set_object($obj);
    $sys->commit();
    $sys->disconnect();

    You can find the object reference using the following command:

    cc get_objects packetfilter packetfilter
    This returns for example:

            {
                'autoname' => 1,
                'class' => 'packetfilter',
                'data' => {
                            'action' => 'accept',
                            'comment' => '',
                            'destination' => 'REF_NetworkInternet6',
                            'group' => '',
                            'log' => 0,
                            'name' => 'Any from Astaro RED (Network) to Internet IPv6',
                            'service' => 'REF_ServiceAny',
                            'source' => 'REF_haKxBeHySx',
                            'status' => 1,
                            'time' => ''
                          },
                'hidden' => 0,
                'lock' => '',
                'nodel' => '',
                'ref' => 'REF_mtIBUIPrVJ',
                'type' => 'packetfilter'
              },
    Now you can use the reference from 
     'ref' => 'REF_mtIBUIPrVJ' 
    You call it like this:
    perl pf_status_toggle.pl REF_mtIBUIPrVJ
    Hope that helps.

    Regards,
    Daniel