contoh pf.conf untuk warnet
Setelah lama gak sempet bikin artikel apa-apa, akhirnya sekarang “tidak bikin artikel apa-apa juga hehehe”…
Sekarang ini cuman mau nyimpen contoh pf.conf yang biasa dipake di warnet. Biar kalo lupa tinggal copy paste dari sini.
Kalau anda perlu silahkan saja kalau mau dipakai tapi jangan asal copy paste sesuaikan dengan keperluan anda :D.
Ok disini mulai nya
1. ### macros
2. # internal and external interfaces (ketikan 'ifconfig' buat lihat interface)
3. int_if = "vr0"
4. ext_if = "rl0"
5.
6. # Port Yang Boleh Diakses dari Luar Box silahkan sesuaikan
7.
8. tcp_services = "{ 80, 110, 25, 53, 113, 21}"
9. udp_services = "{ 53, 1194 }"
10.
11. # ping requests
12. icmp_types = "echoreq"
13.
14. # Private Network, Yg Mau di Blok Traffiknya
15. priv_nets = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, 10.0.0.0/8 }"
16.
17. ### options
18. set block-policy return
19. set loginterface $ext_if
20. set skip on lo0
21.
22. ### Scrub
23. scrub in all
24.
25. ### nat/rdr
26. # NAT traffic dari Internal Ke External
27. nat on $ext_if from $int_if:network to any -> ($ext_if)
28.
29. # Port Redirector untuk Transparent Proxy & Transparent FTP
30. rdr on $int_if proto tcp from any to any port 21 -> 127.0.0.1 port 8021
31. rdr on $int_if proto tcp from any to any port 80 -> 127.0.0.1 port 3128
32.
33. ### filter rules
34. block all
35.
36. # Blok Traffik Dari Luar Yang Pake IP Private
37. block drop in quick on $ext_if from $priv_nets to any
38.
39. # Blok Trafik dari Luar ke Internal
40. block drop out quick on $ext_if from any to $priv_nets
41.
42. # Perbolehkan Akses ke TCP port tertentu
43. pass in on $ext_if inet proto tcp from any to ($ext_if) port $tcp_services flags S/SA keep state
44.
45. # Perbolehkan Akses ke UDP port tertentu
46. pass in on $ext_if proto udp to any port $udp_services keep state
47.
48. # Perbolehkan Akses FTP
49. pass in on $ext_if inet proto tcp from port 20 to ($ext_if) user proxy flags S/SA keep state
50.
51. # Ping Reply OK
52. pass in inet proto icmp all icmp-type $icmp_types keep state
53.
54. # Perbolehkan Traffik dari Internal ke Internal Interface
55. pass in on $int_if from $int_if:network to any keep state
56. pass out on $int_if from any to $int_if:network keep state
57.
58. # Perbolehkan Traffik keluar melalui External Interface
59. pass out on $ext_if proto tcp all modulate state flags S/SA
60. pass out on $ext_if proto { udp, icmp } all keep state
Kalau udah silahkan restart dengan command
1. pfctl -NORf /etc/pf.conf
pfctl -NORf /etc/pf.conf
Gitu saja kok
artikel lengkapnya disini
pf.conf untuk warnet
at
8:14 PM
Labels: Linux
Subscribe to:
Post Comments (Atom)
Labels
- Tips and triks (10)
- Blog (4)
- Linux (4)
- Network (1)
- Pemograman (1)
- Technologi (1)


0 comments:
Post a Comment