Enable/Disable policy via SSH

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Author Message
882-user-1
DD-WRT Novice


Joined: 22 Jun 2020
Posts: 11

PostPosted: Mon Jun 22, 2020 14:48    Post subject: Enable/Disable policy via SSH Reply with quote
I have 2 policies in "Access Restrictions"

1 ( People A )
2 ( People B )

Is is possible to enable/disable these via a remote SSH command?

I'd like be to able to do something like;

ssh root@192.16.1.1 rule 1 on/off

and/or

see it's it set?

Is this possible?

Ahhh... I found a part answer
I see I can do this..

filter_rule3=$STAT:1$NAME:Test$DENY:1$IF:Any$$

but I can't seem to restart the firewall after changing it
If I do;

stopservice firewall
startservice firewall

it complains on restart....

0
cannot open /proc/sys/net/ipv4/conf/br0/loop


any help? I'm almost there! Smile
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1407

PostPosted: Mon Jun 22, 2020 22:19    Post subject: Reply with quote
If you are familiar with iptables you could just make scripts to remove and add the lines.

You could even set up a cron job to do this.
882-user-1
DD-WRT Novice


Joined: 22 Jun 2020
Posts: 11

PostPosted: Tue Jun 23, 2020 9:34    Post subject: Reply with quote
manually playing with the iptables would not really work, since I want to be able to change it, as if it was done via the gui so the changes are in sync.

I managed it in the end, roughly as above.

I configure the rule in GUI, then enable or disable it remotely by setting the above rule variable and just changing the $STAT:1 or $STAT:0 part, depending on if it's enabled or not.

Works a treat

Only odd part was stop/start on the firewall after I change the setting. stop works, but I need to call start twice;

startservice firewall

first call always give the error;
cannot open /proc/sys/net/ipv4/conf/br0/loop


But second time works...?? odd.

FYI, the reason I want this is I have OpenHab for home automation and want the wife to have a wife-friendly was to turn each kids internet off when she wants, so I have rules for each kid taking in their phones and pc's and all their devices, and a button in openhan that uses ssh to enable/disable the rule... works great!! Smile thanks to dd-wrt! Smile
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum