Change Access Policies using ssh

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
mlumb
DD-WRT Novice


Joined: 03 Apr 2008
Posts: 4

PostPosted: Thu Feb 02, 2017 18:53    Post subject: Change Access Policies using ssh Reply with quote
Hello,

I am wondering if it is possible to enable or disable an access policy that has already been created with an SSH command? I have 8 different access policies setup with the DDWRT GUI but I would like to be able to enable or disable them easily with ssh from my phone.

Is it possible to change access policy settings with ssh?

Thanks
Michael
Sponsor
bsfah3
DD-WRT Novice


Joined: 22 Feb 2017
Posts: 1

PostPosted: Wed Feb 22, 2017 17:15    Post subject: +1 Reply with quote
I'm also interested in this functionality. Ideally, I'd like to be able to toggle specific Access Restrictions from a mobile device.
GreyAsteroid
DD-WRT Novice


Joined: 24 Sep 2015
Posts: 4

PostPosted: Fri Feb 24, 2017 18:17    Post subject: Reply with quote
There's an android app (DD-WRT Companion) that can do this through ssh. However I would love to know how to do this manually so I'm able to create simple homescreen shortcuts that disable/enable policies.

EDIT

I figured I could just check what commands the app was sending to the roku and here's what I found

Code:
/usr/sbin/nvram set filter_rule4="\$STAT:1\$NAME:Roku\$DENY:1\$\$" && /sbin/stopservice firewall && /sbin/startservice firewall


That command changes rule 4 with the name Roku to STAT:1 (enabled) and then restarts the firewall.
mrgino
DD-WRT Novice


Joined: 08 Jan 2017
Posts: 3

PostPosted: Sat Nov 24, 2018 7:20    Post subject: Reply with quote
GreyAsteroid wrote:

I figured I could just check what commands the app was sending to the roku and here's what I found


How did you see what commands the app was sending? I've tried doing "cat /tmp/var/log/messages" via SSH but don't see in the log the exact command being sent by the Companion app.
guido72
DD-WRT Novice


Joined: 24 Feb 2019
Posts: 15

PostPosted: Mon Jun 10, 2019 16:18    Post subject: Reply with quote
Hi,
I tried this and it works! Really nice.
I issued this over ssh:
Code:
/usr/sbin/nvram set filter_rule4="\$STAT:MyRuleNr\$NAME:MyPolicyName\$FILTER:1\$\$" && /sbin/stopservice firewall && /sbin/startservice firewall


But how can you accept network traffic again? I assume you have to change 'DENY'into something like 'ACCEPT', or 'FILTER'? I cannot get it working.
I would like to issue these commands from my Domotica server.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12837
Location: Netherlands

PostPosted: Tue Jun 11, 2019 17:19    Post subject: Reply with quote
Try the following:

Code:
nvram unset filter_rule4


Deletes that filter rule

Of course you have to stop and start the firewall

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
guido72
DD-WRT Novice


Joined: 24 Feb 2019
Posts: 15

PostPosted: Wed Jun 12, 2019 14:29    Post subject: Reply with quote
Ok, and if I would set it back, that would be: nvram set filter_rule4?
I will try this next weekend.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking 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 cannot attach files in this forum
You cannot download files in this forum