pf.conf設定 - Linux

Harry avatar
By Harry
at 2014-03-20T13:07

Table of Contents

大家好,小弟是Linux/OBSD的新手
最近上課在做的project
因為router是OBSD所以有些檔案名稱path會不一樣

要問的問題是OBSD裡面的/etc/pf.conf的一些rules


老師的要求是:

1. Windows subnet to storage subnet: NO access
2. Windows subnet to web server subnet: RESTRICTED access
Only SSL HTTP ports allowed
3. Web server subnet to storage subnet: RESTRICTED access
Only iSCSI ports allowed

小弟自己用小畫家畫了一個圖形
http://tinypic.com/view.php?pic=fwqhxz&s=8#.Uyp0NPldUwA

OBSD router有1 external interface (em0) 2 internal interfaces (em1 & em2)
Windows subnet >> em1
www server >> em2
storage server >> 從主要的router連接到OBSD router

小弟自己弄出來的pf rules是
ext_if = "em0"
int_if = "em1"
int_if2 = "em2"
www_server = "192.168.32.130"
web_ports = "{ https, iscsi }"
tcp_services = "{ ssh, domain }"
udp_services = "{ router, domain }"


set skip on lo
block in


pass in on $int_if from $int_if:network
pass in on $int_if2 from $int_if2:network


pass in inet proto icmp


block from $int_if:network to $int_if2:network


pass in on $ext_if inet proto tcp to $ext_if port $tcp_services
pass in on $ext_if inet proto udp to $ext_if port $udp_services
pass in on $ext_if inet proto tcp to $www_server port $web_ports
pass in on $int_if inet proto tcp from $int_if:network to $www_server port
https


block from $int_if:network to 10.12.0.0/16

pass out


今天老師檢查後說這個configuration很奇怪
因為
pass in on $int_if from $int_if:network
pass in on $int_if2 from $int_if2:network

這兩個其實很多餘
還有pass in on $int_if inet proto tcp from $int_if:network to $www_server
port https
這個也是很怪異
但是老師測試了一下後說 因為有達到要求所以過了(測試方式用ping還有看我們的網頁是
否只能顯示https)

重點: 如果是各位大大 會怎麼寫呢?
不好意思寫很多 感謝您的指點


--

The truth is always beneath a quiet place.
So I prefer to work in a distant place alone.


--
Tags: Linux

All Comments

Zanna avatar
By Zanna
at 2014-03-23T01:15
pf的話或許你應該去FreeBSD版問,那邊熟悉pf的人較多。

安裝linux後再補裝swap

Doris avatar
By Doris
at 2014-03-20T07:47
我安裝 linux (Fedora) 時, 忘了設swap 請問安裝後,要如何補加 swap ? 謝謝! - ...

使用ntpd校時

Hardy avatar
By Hardy
at 2014-03-19T23:50
我看到很多地方說,ntpdate 已經 deprecated , 不建議使用,要改用 ntpd. 但是…查了一陣子,好像從來沒看過客戶端的 ntpd 要怎麼用? 簡單講,下面這個指令要怎麼用 ntpd 取代? ntpdate time.stdtime.gov.tw 如果直接把ntpdate改成ntpd,會 ...

ubuntu 14.04釋出問題 13.10升級到14.04 LTS(桌面環境lxde)

Kama avatar
By Kama
at 2014-03-19T15:29
已知ubuntu 14.04將於4月17日發行 我用的是ubuntu 13.10 桌面環境lxde 有些問題想請教 lxde桌面環境的ubuntu 13.10可以直接升級到14.04的LTS版嗎? 如果可以直接升級要怎麼升級到14.04的LTS? 麻煩高手解惑 thx - ...

還有 Slackware 的台灣社群嗎?

Mia avatar
By Mia
at 2014-03-19T15:27
大家好。 我從最近這一兩年開始使用 slackware,是我目前最喜歡的發行版, 之前 google 發現台灣有一個 slackware 社群,但網址已經失效。 不知道台灣還有沒有 slackware 的社群?還是使用者都已經發散到 各發行版跟國外社群了? - ...

ramdisk

Zora avatar
By Zora
at 2014-03-19T10:24
andorid 的 system.img 我知道怎麼打包成 ext4 格式 make_ext4fs -l 512M -s -a system system.ext4img system 再使用simg2img工具 那請問ramdisk.img 怎麼打包成ext4格式呢? 謝謝。 - ...