投稿

4月, 2009の投稿を表示しています

自宅サーバ(Debian/etch)をnmap(Windows XP)でポートスキャン

自宅サーバ(Debian/etch)のセキュリティ検査をするのに、Windows XPマシンからポートスキャンしてみた。 1. http://insecure.org/からnmap-4.85BETA7-setup.exeをダウンロード 2. nmap-4.85BETA7-setup.exeを実行してインストール 3. 以下を実行 C:\Program Files\Nmap>nmap -P0 -n -sS -T4 -p1-65535 192.168.1.132 Starting Nmap 4.85BETA7 ( http://nmap.org ) at 2009-04-19 11:43 東京 (標準時) Interesting ports on 192.168.1.132: Not shown: 65528 closed ports PORT    STATE SERVICE 21/tcp  open  ftp 22/tcp  open  ssh 80/tcp  open  http 111/tcp open  rpcbind 113/tcp open  auth 443/tcp open  https 901/tcp open  samba-swat MAC Address: xx:xx:xx:xx:xx:xx (Matsushita Electric IND. CO) Nmap done: 1 IP address (1 host up) scanned in 81.48 seconds C:\Program Files\Nmap> 4. rpcbind、auth、samba-swatは自宅サーバには必要ないので止めてみる。あと、ftpはscp(sftp)で代替するのでこれも止める。 <rpcbindを止める> # /etc/init.d/portmap stop Stopping portmap daemon.... # update-rc.d -f portmap remove Removing any system startup links for /etc/init.d/portmap ... ...

自宅サーバ(Debian/etch)のiptablesで、とあるホストを遮断

やってみたのでメモしておく。 /root/myfirewall.shを作成し、アクセス拒否したいipアドレスを登録。 # vi /root/myfirewall.sh #!/bin/sh iptables -I INPUT -s XXX.XXX.XXX.XXX -j DROP 定義に問題ないか確認。 # /bin/sh /root/myfirewall.sh # iptables -L ... DROP       0    --  xxxx.jp  anywhere ← 拒否したいIPアドレスのFQDN名を確認 ... # etc/network/interfacesに書き青文字の行を追加。 iface eth0 inet dhcp         pre-up /bin/sh /root/myfirewall.sh $IFACE $IF_ADDRESS 再起動しても定義がされていることを確認。 # shutdown -r now ... #  iptables -L ... DROP       0    --  xxxx.jp  anywhere ← 再起動してもちゃんとある。 ... #