Personal tools
You are here: Home にっき Zope (Plone) でPASV(Passive)ポートを制限する方法
Document Actions

Zope (Plone) でPASV(Passive)ポートを制限する方法

by jack(moblog) posted at 2009-07-17 08:15 PM
Plone や Zope を使っていると、FTPでファイルをやりとりできるのがとても便利なことがあります。

ただ、欠点があって、Passive mode で port の min, max を設定できないのが不便です。
まぁ、Firewall との兼合いで、どうせ数人しかFTPでアクセスしないから、20 portsくらいに 絞りたい、とかそういう話です。
で、結論からいうと、マトモな方法ではできません。ソースいじるしかないです。
なぜなら、そういう設定項目がないから(笑)
$ZOPE_HOME/lib/python/ZServer/medusa/ftp_server.py をいじります。

bind の port に無条件で 0 が渡されているので、範囲を指定するように 変更します。
jack in medusa % diff -c ftp_server.py.org ftp_server.py
*** ftp_server.py.org Fri Jul 17 20:05:21 2009
--- ftp_server.py Fri Jul 17 20:09:36 2009
***************
*** 817,825 ****
self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
# bind to an address on the interface that the
# control connection is coming from.
self.bind ((
self.control_channel.getsockname()[0],
! 0
))
self.addr = self.getsockname()
self.listen (1)
--- 817,829 ----
self.create_socket (socket.AF_INET, socket.SOCK_STREAM)
# bind to an address on the interface that the
# control connection is coming from.
+ #### patch to bind()'s port line
+ from random import randint
+ port = 0 # original
+ port = randint(20030, 20050) # change here for your firewall.
self.bind ((
self.control_channel.getsockname()[0],
! port # changed 0 to randint
))
self.addr = self.getsockname()
self.listen (1)
お勧めするような方法じゃないですが、とりあえず、動きます。


The URL to Trackback this entry is:
http://ns.jk.to/Nikki/moblog2009-07-17-20-15/tbping
Add comment

You can add a comment by filling out the form below. Plain text formatting.

(Required)
« February 2012 »
Su Mo Tu We Th Fr Sa
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29      
Categories
仮想化 (18)
Python/Zope/Plone (9)
にっき (1292)
鉄道 (2)
水泳 (9)
ローカーボ (18)
 
そちらのOSの時刻なので 正確性はあなた次第
 
こういう意味のないの好き
 
本をお勧め中
 
CDもお勧め中
のだめカンタービレ ベスト100
ドラマの演奏とは違います。でもこの感じでこの価格ならアリかと
 
消耗品や家電
 
よく使うサイト
社名ロゴ88×631
 
ぐぐってみる
 
誰が使うんだろう
 

Powered by Plone