ubuntuusers.de

Iptables im Autostart

Datum:
24. Februar 2015 17:53
Code:
 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
60
61
62
63
64
65
66
67
68
69
70
Die Ausgabe von: sudo iptables -L:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


Mein /etc/iptables.sh:

#!/bin/sh
IPT="/sbin/iptables"
##
echo -n "Lade iptables Regeln..."
##
###Flush old rules:
##
$IPT --flush
$IPT --delete-chain
##
###Insert ICMP:
##
$IPT -A INPUT -P ICMP -j DROP
##
###Insert OpenSSH:
##
$IPT -A INPUT -P TCP  --dport 22 -j ACCEPT
##
###Insert Webmin:
##
$IPT -A INPUT -P TCP  --dport 1000 --sport 10000:20000 -j ACCEPT
##
###Insert Apache2:
##
$IPT -A INPUT -P TCP  --dport 80 -j ACCEPT
$IPT -A INPUT -P TCP  --dport 443 -j ACCEPT
##
###Insert ProFTPD:
##
$IPT -A INPUT -P TCP  --dport 21 --sport 49152:69155 -j ACCEPT
##
echo -n "iptables Regeln sind geladen."
##


Meine /etc/rc.local:

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/etc/iptables.sh     #Iptables

exit 0


Ich hab auch schon versucht das iptable.sh Script in die /etc/network/interfaces einzutragen, doch dort wurde der eintrag nach einem Reboot iwie wieder gelöscht???