forked from skx/sysadmin-util
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flush-firewall
executable file
·60 lines (48 loc) · 979 Bytes
/
flush-firewall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# About
# -----
# Flush the system's firewall - leaving the host defenseless.
#
#
# License
# -------
#
# Copyright (c) 2013 by Steve Kemp. All rights reserved.
#
# This script is free software; you can redistribute it and/or modify it under
# the same terms as Perl itself.
#
# The LICENSE file contains the full text of the license.
#
#
PATH=/usr/sbin:/sbin:/bin:/usr/bin
#
# If we're root we don't use sudo.
#
if [ "$(id -ru)" = 0 ]; then
SUDO=""
else
SUDO="sudo"
fi
#
# Define default policies of ACCEPT.
#
$SUDO iptables -P INPUT ACCEPT
$SUDO ip6tables -P INPUT ACCEPT
$SUDO iptables -P OUTPUT ACCEPT
$SUDO ip6tables -P OUTPUT ACCEPT
$SUDO iptables -P FORWARD ACCEPT
$SUDO ip6tables -P FORWARD ACCEPT
#
# Delete all existing rules, first
# IPv4 then IPv6.
#
$SUDO iptables -F
$SUDO ip6tables -F
$SUDO iptables -t nat -F
$SUDO ip6tables -t nat -F
$SUDO iptables -t mangle -F
$SUDO ip6tables -t mangle -F
$SUDO iptables -X
$SUDO ip6tables -X