« レンタルボックス・ハ○ウリ営業終了します... | メイン | 本日は第2回Twitter研究会に参加しています »

2010年9月 3日

/etc/hosts.allow, line xx: missing newline or line too long

カテゴリ:CentOS

 アクセス制限とかって最近はiptablesでやることがほとんどなのですが、久々にtcp_wrapperを使ってFTPにアクセス制限をかけることになりました。

 vsftpdを使っているのですが、最初からtcp_wrapperが使える設定になっていたので/etc/hosts.allowと/etc/hosts.denyを設定して、設定完了!! と、思ったのですが、、、。

 なんか、アクセスできちゃうんですよね、出来ないはずの所から。で、最初はvsftpdの設定周りかと思って、configをチェックしたりしたんだけど、フツーに設定できているんですよね、、、まさか、vsftpdがtcp_wrapper効かないのかと思いましたがlddコマンドで確認したらちゃんと効く設定になってるわけですよ。

 ちょっと悩んだのですが、全ての基本と言うことでシスログ(messages)をチェックしたらこんなのが出てましたよ。

/etc/hosts.allow, line xx: missing newline or line too long

はじめはなんのこっちゃわからなかったのですが、そういえば空行で終わらないといけないとかそういうのがあったことを思い出しました。調べてみると、

17.2. TCP Wrappers Configuration Files

Warning
If the last line of a hosts access file is not a newline character (created by pressing the Enter key), the last rule in the file fails and an error is logged to either /var/log/messages or /var/log/secure. This is also the case for a rule that spans multiple lines without using the backslash. The following example illustrates the relevant portion of a log message for a rule failure due to either of these circumstances:
warning: /etc/hosts.allow, line 20: missing newline or line too long

ビンゴ! これだよ、ままーん! というわけで、空行を追加して一件落着です。あああ、久々にはまったなぁ。っていうか、hosts.allowとか何年ぶりにいじったんだろ、、、。



投稿者 ymkx : 2010年9月 3日 18:48 |