Skip to content

Instantly share code, notes, and snippets.

@mxl
Created January 31, 2020 14:36
Show Gist options
  • Select an option

  • Save mxl/afc43f09496cfcf98e8a933be1433cce to your computer and use it in GitHub Desktop.

Select an option

Save mxl/afc43f09496cfcf98e8a933be1433cce to your computer and use it in GitHub Desktop.

Revisions

  1. mxl created this gist Jan 31, 2020.
    9 changes: 9 additions & 0 deletions ufw-delete-rules.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/usr/bin/env bash

    set -e
    PATTERN=$1
    COUNT=0
    for RULE in $(sudo ufw status numbered | (grep $PATTERN | awk -F"[][]" '{print $2}')); do
    sudo ufw --force delete $((RULE-COUNT))
    ((COUNT=COUNT+1))
    done