Skip to content

network-utilities/iptables-wipe-chain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Iptables Wipe Chain

iptables-wipe-chain.sh, contains a function than wipes custom chains from iptables

The following covers how to install this branch as a submodule within your own project, and parameters that iptables-wipe-chain.sh currently responds to.

Byte size of iptables-wipe-chain.sh Open Issues Open Pull Requests Latest commits


Table of Contents


Quick Start

Bash Variables

_module_https_url='https://github.com/network-utilities/iptables-wipe-chain.git'
_module_relative_path='modules/iptables-wipe-chain'

Git Commands

cd "<your-git-project-path>"

git checkout master
git submodule add -b master --name iptables-wipe-chain "${_module_https_url}" "${_module_relative_path}"

Edit Your ReadMe File

Suggested additions so everyone has a good time with submodules

Clone with the following to avoid incomplete downloads


    git clone --recurse-submodules <url-for-your-project>


Update/upgrade submodules via


    git submodule update --init --recursive --merge

Example Usage

Example of sourcing and utilize iptables_wipe_chain features

example-usage.sh

#!/usr/bin/env bash


## Find true directory this script resides in
__SOURCE__="${BASH_SOURCE[0]}"
while [[ -h "${__SOURCE__}" ]]; do
    __SOURCE__="$(find "${__SOURCE__}" -type l -ls | sed -n 's@^.* -> \(.*\)@\1@p')"
done
__DIR__="$(cd -P "$(dirname "${__SOURCE__}")" && pwd)"


## Source module code within this script
source "${__DIR__}/modules/iptables-wipe-chain/iptables-wipe-chain.sh"

iptables_wipe_chain some_chain

Test that things work!

Commit and Push

git add .gitmodules
git add modules/iptables-wipe-chain
git add README.md


git commit -F- <<'EOF'
:heavy_plus_sign: Adds network-utilities/iptables-wipe-chain#1 submodule


**Edits**


- `README.md` file, documentation updates for submodules


**Additions**

- `.gitmodules` file, tracks other Git repository code utilized by this project

- `modules/iptables-wipe-chain` submodule, Git tracked dependency
EOF


git push origin master

🎉 Excellent 🎉 your repository is now ready to begin unitizing code from this project!


Iptables Wipe Chain API

Wipes iptables rules that refer to chain name

Param Type Description
$@ string required iptables chain to wipe

Returns: boolean, exit status of deleting iptables rules

Throws Parameter_Error: ipv4_range_from_address not provided a chain name, arguments are not defined

Example:

iptables_wipe_chain 'some_chain'
#> iptables -D some_chain -j RETURN
#> iptables -D some_chain -p tcp --dport 80 -j ACCEPT
#> iptables -X some_chain
#> iptables -D INPUT -j some_chain

License

Iptables Wipe Chain submodule quick start documentation
Copyright (C) 2019  S0AndS0

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation; version 3 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
by `jesin`
on

About

Wipes iptables chain rules and references by chain name

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Languages