最近有接到需求是,希望網頁應用程式能鎖定只有某些範圍的網段才能進入,IIS可以,RESIN可以嗎?

 

答案是 YES.

 

RESIN本來也就有WEB SERVER的角色,官方網站解答。(找ip-constraint)
http://www.caucho.com/resin-3.0/security/authorization.xtp(英)

 

兩種作法:

1.設定允許的網段範圍。

2.設定拒絕的網址範圍。

 

設定說明:

於RESIN.CONF中,找到<web-app></web-app>段內加入下面指令。

1.設定允許的網段範圍 :
   (<allow> x.x.x 請置換為您的網段,/24為關鍵字)


<security-constraint>

<web-resource-collection>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<ip-constraint>
<allow>x.x.x.0/24</allow>
</ip-constraint>
</security-constraint>


2.設定拒絕的網址
    (<deny>內 x.x.x.x 請置換為您的欲拒絕的網址)


<security-constraint>

<web-resource-collection>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<ip-constraint>
<deny>x.x.x.x</deny>
</ip-constraint>
</security-constraint>


註:設為網段或網址的方式,均可用於<allow><deny>內。

舉例1:192.168.10.X 跟192.168.20.X 這2個網段
             才能存取本網頁,其他都不行。

……
<ip-constraint>
  <allow>192.168.10.0/24</allow>
  <allow>192.168.20.0/24</allow>
</ip-constraint>
……

舉例2:除了192.168.10.X 跟192.168.20.X 這2個網段
              不能存取本網頁,其他都可以。

……
<ip-constraint>
  <deny>192.168.10.0/24</deny>
  <deny>192.168.20.0/24</deny>
</ip-constraint>
……

阻擋後成果:

403

arrow
arrow
    全站熱搜

    味味A 發表在 痞客邦 留言(0) 人氣()