Giter Site home page Giter Site logo

pf_fwrule_toggle's Introduction

pf_fwrule_toggle

Helper script for pfSense that lists rules and toggles them on/off via CLI. The script lists and operates on both nat and filter (standard) rule types.

Setup

  • copy the php script to your firewall—one easy way to do this is to ssh to your firewall, choose option 8 and then paste this command:
fetch https://raw.githubusercontent.com/luckman212/pf_fwrule_toggle/main/fwrule_toggle.php
  • run it using the syntax below
  • you need to supply one or more rule ids as a parameter, or -l to list all rules
  • prefixing the ruleIDs with n e.g. n3 will operate on NAT rule #3
  • optionally set the action to enable, disable, or toggle (if not specified, it defaults to toggle)
  • you can use the following long args instead, if you prefer: --list, --desc, --help

Usage

Specify rules by ID

This mode accepts 1 or more numeric rule IDs. You can prefix the number with n to select NAT rules, as opposed to filter rules which are the default.

php -q fwrule_toggle.php <ruleid>[,ruleid...] [action]
  • action can be enable, disable, or toggle

Specify rules by Description

This mode operates on the rule description. If multiple rules share an identical description, they will be operated on as a group.

php -q fwrule_toggle.php -d <rule_desc> [type] [action]
  • type can be nat or filter—if omitted, defaults to filter
  • if the description contains spaces, you must surround it with quotes e.g. 'my fancy rule'

Examples

list rules

php -q fwrule_toggle.php -l

toggle filter (standard) rule 36

php -q fwrule_toggle.php 36

turn NAT rule 23 on

php -q fwrule_toggle.php n23 enable

turn rules 5,11 and 17 off

php -q fwrule_toggle.php 5,11,17 disable

disable all filter rules named external access

php -q fwrule_toggle.php -d 'external access' filter disable

Based on

pf_fwrule_toggle's People

Contributors

luckman212 avatar

Stargazers

Alex Datsko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.