Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
Zawartość firewall:
#-----Zmienne globalne dla calego pakietu------# source /etc/firewall/users.conf source /etc/firewall/rates.conf source /etc/firewall/interfaces.conf source /etc/firewall/mac.conf #..............................................# # WLACZENIE FORWARDOWANIA # #..............................................# echo 1 > /proc/sys/net/ipv4/ip_forward #----------------------------------------------# # CZYSZCZENIE REGUL # #----------------------------------------------# iptables -F # czyszczenie wpisow iptables -X # usuniecie lancucha iptables -t nat -F # czyszczenie tablicy (-t) NAT iptables -t nat -X # usuniecie lancucha w tabeli #----------------------------------------------# # USTAWAIENIE POLITYKI DZIALANIA # #----------------------------------------------# iptables -P INPUT DROP # domyslna polityka lancucha iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT #----------------------------------------------# # SSH DLA SERWERA # #----------------------------------------------# iptables -N SSH # utworzenie nowego lanvucha iptables -A INPUT -p tcp --dport 22 -j SSH iptables -A SSH -s $ip_wan_range -j ACCEPT iptables -A SSH -s $ip_lan_range -j ACCEPT iptables -A SSH -m limit --limit 5/s -j LOG # regula logowania iptables -A SSH -j DROP #iptables -A INPUT -i $lop -j ACCEPT # dodanie reguly do lancucha(-A), na interfejsie(-i), polityka(-j) #iptables -A FORWARD -o $lop -j ACCEPT #iptables -A INPUT -s 0/24 -d $ip_lan -p tcp --dport 22 -j ACCEPT # wybierani zrodla pakietu(-s), maska(-0/0), #iptables -A OUTPUT -s 0/24 -d $ip_lan -p tcp --dport 22 -j ACCEPT # adres pakietu(-d), protokol(-p) #iptables -A INPUT -s 0/24 -d $ip_lan -p udp --dport 22 -j ACCEPT # okreslenie portu docelowego(--dport) #iptables -A OUTPUT -s 0/24 -d $ip_lan -p tcp --dport 22 -j ACCEPT #iptables -A INPUT -s 0/24 -d $ip_wan -p tcp --dport 22 -j ACCEPT #iptables -A OUTPUT -s 0/24 -d $ip_wan -p tcp --dport 22 -j ACCEPT #iptables -A INPUT -s 0/24 -d $ip_wan -p udp --dport 22 -j ACCEPT #iptables -A OUTPUT -s 0/24 -d $ip_wan -p udp --dport 22 -j ACCEPT #----------------------------------------------# # POLACZENIA NAWIAZANE # #----------------------------------------------# iptables -A INPUT -j ACCEPT -m state --state ESTABLISHED,RELATED # zaladowanie modulu(-m), uzycie modulu(--modul) iptables -A FORWARD -j ACCEPT -m state --state ESTABLISHED,RELATED iptables -A OUTPUT -j ACCEPT -m state --state ESTABLISHED,RELATED #---------------DNS----------------------------# iptables -A INPUT -s $dns_1 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_2 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_3 -p udp -sport 53 -j ACCEPT #---------------FTP----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto ftp -j MARK --set-mark 01 #------------BITTORRENT------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto bittorrent -j MARK --set-mark 001 iptables -t mangle -A POSTROUTING -m layer7 --l7proto ares -j MARK --set-mark 002 #--------------SSL-----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto ssl -j MARK --set-mark 02 #-------------HTTP-----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto http -j MARK --set-mark 03 #------------POCZTA----------------------------# iptables -t mangle -A POSTROUTING -m layer7 --l7proto smtp -j MARK --set-mark 04 iptables -t mangle -A POSTROUTING -m layer7 --l7proto pop3 -j MARK --set-mark 05 #----------------------------------------------# # HOSTS CONFIG # #----------------------------------------------# #-------------NOX.XEEN.PL----------------------# iptables -t nat -A POSTROUTING -s $u1 -j MASQUERADE iptables -A FORWARD -m mac --mac-source $mu1 -j ACCEPT #-----------PIETJA.XEEN.PL---------------------# iptables -t nat -A POSTROUTING -s $u8 -j MASQUERADE iptables -A FORWARD -m mac --mac-source $mu2 -j ACCEPT #---------HOT_SZPROT.XEEN.PL-------------------# iptables -t nat -A POSTROUTING -s $u2 -j MASQUERADE iptables -A FORWARD -m mac --mac-source $mu3 -j ACCEPT
po wystartowaniu tego skryptu dostaje:
root@nox:~# /etc/firewall/firewall iptables v1.4.0: multiple -s flags not allowed Try `iptables -h' or 'iptables --help' for more information. iptables v1.4.0: multiple -s flags not allowed Try `iptables -h' or 'iptables --help' for more information. iptables v1.4.0: multiple -s flags not allowed Try `iptables -h' or 'iptables --help' for more information.
i przestaje działac WWW, GG i inne rzeczy działaja.
Offline
prorokuję problem z DNS, prorokiem jestem marnym, ale obstawiałbym zmianę:
#---------------DNS----------------------------# iptables -A INPUT -s $dns_1 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_2 -p udp -sport 53 -j ACCEPT iptables -A INPUT -s $dns_3 -p udp -sport 53 -j ACCEPT
na
#---------------DNS----------------------------# iptables -A INPUT -s $dns_1 -p udp --dport 53 -j ACCEPT iptables -A INPUT -s $dns_2 -p udp --dport 53 -j ACCEPT iptables -A INPUT -s $dns_3 -p udp --dport 53 -j ACCEPT
Offline
Ok dzieki, zaraz przetestuje. Mam natomiast inne pytanie. Nigdzie nie znalazlem wyjasnienia:
co mozna robic za pomoca : POSTROUNTING, PREROUTING kiedy stosowac do jakich uslug ( przykłaodowo)
oraz co mozna robic w tableach NAT i MANGLE
z góry dziekuje za odpowiedz
Offline
zajrzyj [url=http://www-users.mat.umk.pl/~minaq/iptables.pdf]tutaj[/url]
Offline
Time (s) | Query |
---|---|
0.00009 | SET CHARSET latin2 |
0.00004 | SET NAMES latin2 |
0.00142 | SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='18.218.157.34' WHERE u.id=1 |
0.00107 | REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '18.218.157.34', 1727594503) |
0.00026 | SELECT * FROM punbb_online WHERE logged<1727594203 |
0.00089 | DELETE FROM punbb_online WHERE ident='85.208.96.198' |
0.00048 | SELECT topic_id FROM punbb_posts WHERE id=90510 |
0.00104 | SELECT id FROM punbb_posts WHERE topic_id=11371 ORDER BY posted |
0.00057 | SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=11371 AND t.moved_to IS NULL |
0.00005 | SELECT search_for, replace_with FROM punbb_censoring |
0.00077 | SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=11371 ORDER BY p.id LIMIT 0,25 |
0.00078 | UPDATE punbb_topics SET num_views=num_views+1 WHERE id=11371 |
Total query time: 0.00746 s |