Git Product home page Git Product logo

pfedit's Introduction

pfedit

Editing /etc/pf.conf on FreeBSD or derivatives can be harrowing as you run the risk of locking yourself out of your server. But it's 2021 and there's no need for one stupid mistake to cause problems like that. This script implements the same protection found on many routers (Cisco, Juniper, ...): it adds a second time you have to press enter to prove you didn't just lock yourself out. If you did, pfedit reverts to the old configuration.

When you run pfedit, it shows a copy of pf.conf (called pf.conf.new) in the editor you set in $EDITOR. After you're done editing, you'll see:

Press enter to use new rules or Ctrl-C to abort.
Press enter again if you're still there.
OK, keeping new PF config. Previous config is in /etc/pf.conf.old.

If you do not press that second enter within 10 seconds (or your terminal disconnects):

Press enter to use new rules or Ctrl-C to abort.
Press enter again if you're still there.
Reverting to previous PF config. Yours saved in /etc/pf.conf.new.

ย 

Needs bash

nohup and read somehow didn't work the way I wanted in /bin/sh. Should probably be investigated/fixed so that it runs in /bin/sh if this ever gets a man page and gets submitted and all.

pfedit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.