努力したWiki

推敲の足りないメモ書き多数

ユーザ用ツール

サイト用ツール


documents:freebsd:freebsd-012

/etc/hosts.allow

2006/12/06 作成

“You are not welcome to use XXX from YYY”

このメッセージに少しだけはまったのでメモで残す。

swat動かない

You are not welcome to use swat from 192.168.1.210.

こんなメッセージがブラウザに出てswatが使えなくなっていたのに気が付いた。 たまたま samba のバージョンアップしたんで、設定を見ようとしたらこんな事になってました。

smb.confは無実。関係ありません。

こういうとき、最初に疑うのが smb.conf。確かアクセス制限のパラメタがあったなー。

hosts allow = アドレス or サブネット

だったかな。いじってみるものの…定義したところが見つかりません。 というか、これはswatの動作を制御するパラメタではないので、関係ないですね。無駄な事やっちまったい。

inetd経由のサーバプロセスが引っかかる罠です。

swatをinetd経由で使っているから、/etc/inetd.conf を見てみると。

swat    stream  tcp     nowait/400      root    /usr/local/sbin/swat    swat

な記述があるはずです。FreeBSDのinetd は、

 IMPLEMENTATION NOTES
    TCP Wrappers
      When given the -w option, inetd will wrap all services specified as
      ``stream nowait'' or ``dgram'' except for ``internal'' services.  If the
      -W option is given, such ``internal'' services will be wrapped.  If both
      options are given, wrapping for both internal and external services will
      be enabled.  Either wrapping option will cause failed connections to be
      logged to the ``auth'' syslog facility.  Adding the -l flag to the wrap-
      ping options will include successful connections in the logging to the
      ``auth'' facility.

なので、inetdも確かめる。

 # ps ax|grep inet
   758  ??  Is     0:00.11 /usr/sbin/inetd -wW -C 60
 63400  p1  RV+    0:00.00 grep inet (csh)
 #

-wW かぁ。ということは、

  • inetd.conf で swatに対して stream と nowait を指定しとる
  • inetd の -wと-W を指定済み

なんで、間違いなく「TCP Wrapper」の罠にはまったんでしょう。ってか罠か? /var/log/auth.log を参照してみればはっきりするはずです。

 # tail /var/log/auth.log
 Dec  5 22:20:49 flatbox inetd[57203]: twist 192.168.1.210 to /bin/echo "You are not welcome to use swat from 192.168.1.210."
 Dec  5 22:20:49 flatbox inetd[57205]: twist 192.168.1.210 to /bin/echo "You are not welcome to use swat from 192.168.1.210."
 Dec  5 22:20:50 flatbox inetd[57207]: twist 192.168.1.210 to /bin/echo "You are not welcome to use swat from 192.168.1.210."

ああ、やっぱり。

見るべきファイルは /etc/hosts.allow

/etc/hosts.allow の最後を見ると、

 # The rest of the daemons are protected.
 ALL : ALL \
         : severity auth.info \
         : twist /bin/echo "You are not welcome to use %d from %h."
 
 ALL : ALL : deny

こんな記述があります。なんか見覚えあるメッセージだなぁ。詳しくは

# man 5 hosts_access

をどうぞ。 このファイルに次の一行を追加します。

 swat: 192.168.1. 127.0.0.1 : allow    ←ここです
 
 # The rest of the daemons are protected.
 ALL : ALL \
         : severity auth.info \
         : twist /bin/echo "You are not welcome to use %d from %h."
 
 ALL : ALL : deny

追加位置は重要です。 この追加はすぐに反映されます。 これでswatにアクセスしたところ、無事設定画面を呼び出せました。

documents/freebsd/freebsd-012.txt · 最終更新: 2023/04/14 02:32 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki