Witam.
Chciałem skonfigurować sobie iptables dla vpsa, niestety, przy każdej próbie włączenia firewalla serwer zamiera. Muszę wyłączać moje reguły ze strony firmy, u której mam hosting[b. P[/b]róbowałem rozmaitych gotowych rozwiązań, a także napisałem swoje.
Przykładem może być http://minecraft.muku.pl/txt/firewall.txt
Dodam, że na vpsie działa strona www, serwer teamspeak i serwer minecraft i też chciałbym mieć odblokowane na nie porty 25565, 80, i 9987.
Pozdrawiam maciekmm.
IPTABLES, serwer zawiesza si
- LordRuthwen
- Moderator
- Posty: 2341
- Rejestracja: 18 września 2009, 21:45
- Lokalizacja: klikash?
Teraz działa wszystko poza stroną:
- to dostaję gdy dodaję:
, oraz
Przy każdym skrypcie.
Kod: Zaznacz cały
#!/bin/sh
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: firewall
# Description: firewall for minecraft
### END INIT INFO
IPT=/sbin/iptables
if [ "$1" = "stop" ]
then
$IPT -P INPUT ACCEPT
$IPT -P FORWARD ACCEPT
$IPT -P OUTPUT ACCEPT
exit
fi
$IPT -F
#policies
$IPT -P OUTPUT ACCEPT
$IPT -P INPUT DROP
$IPT -P FORWARD DROP
#drop spoofed packets
#$IPT -A INPUT --in-interface ! lo --source 127.0.0.0/8 -j DROP
#limit ping requests
$IPT -A INPUT -p icmp -m icmp -m limit --limit 3/second -j ACCEPT
#drop bogus packets
$IPT -A INPUT -m state --state INVALID -j DROP
$IPT -A FORWARD -m state --state INVALID -j DROP
$IPT -A OUTPUT -m state --state INVALID -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags FIN,ACK FIN -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags ACK,PSH PSH -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags ACK,URG URG -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
$IPT -t filter -A INPUT -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP
#allowed inputs
$IPT -A INPUT --in-interface lo -j ACCEPT
#allow responses
$IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#allow services
$IPT -A INPUT -p tcp --dport 22 -j ACCEPT
$IPT -A INPUT -p tcp --dport 80 -j ACCEPT
$IPT -A INPUT -p tcp --dport 25565 -j ACCEPT
$IPT -A INPUT -p tcp --dport 10011 -j ACCEPT
$IPT -A INPUT -p tcp --dport 30033 -j ACCEPT
$IPT -A INPUT -p udp --dport 9987 -j ACCEPT
Kod: Zaznacz cały
iptables v1.4.8: can't initialize iptables table `nat': Table does not exist (do you need
to insmod?)
Kod: Zaznacz cały
$IPT -t nat -P OUTPUT ACCEPT
$IPT -t nat -P PREROUTING ACCEPT
$IPT -t nat -P POSTROUTING ACCEPT
Kod: Zaznacz cały
iptables: No chain/target/match by that name.
iptables: No chain/target/match by that name.
iptables: No chain/target/match by that name.
iptables: No chain/target/match by that name.