-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiptables_example.txt
More file actions
51 lines (43 loc) · 1.6 KB
/
Copy pathiptables_example.txt
File metadata and controls
51 lines (43 loc) · 1.6 KB
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
########################################
## Some basic iptables rules that can be
## extensively referenced with comments
## like this and whcih will remain
## persistant across reboots
########################################
# This line indicated the start of the
# filter table
*filter
# Here are the default policies for each
# chain.
# If this server were also acting
# as firewall for another server, then
# we would also change the FORWARD chain
# default to DROP as well
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Here we begin the basic input rules:
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -m comment --comment "Loopback interface" -j ACCEPT
# Some rules restricting ssh traffic to the server
# Only allow SSH from the local subnet 192.168.1.0/24
-A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 22 -m comment --comment "Only local subnet can ssh in" -j ACCEPT
# In this section, include rules pertatining to public web access
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
########################################
# This is the default REJECT line that
# comes pre-configured on this server.
# NOTE: We've commented it out and
# replaced it with a rule that allows us
# to log dropped traffic
########################################
#-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -j LOG --log-prefix "DROPPED_INGRESS: "
# Here we begin the basic forward rules,
# if we had any.
# For now we keep this rule
# as-is.
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT