2009年11月26日木曜日

dovecot ダウン

メールが受信できない・・・ただし送信は問題なくできる。ん?
ということで調査開始。

・環境
CentOS5.4 + Postfix 2.3.3 + Dovecot 1.0.7

・原因
maillogを検索してみると・・・
Nov 26 04:01:49 mail01 dovecot:
Time just moved backwards by 13 seconds.
This might cause a lot of problems,
so I'll just kill myself now. http://wiki.dovecot.org/TimeMovedBackwards

時刻が13秒戻りました。
これにより多くの問題を引き起こす可能性があります。
ですので、私は自分で死にます。http://wiki.dovecot.org/TimeMovedBackwards
こんなことが書かれていました。

とりあえず吐き出されているDovecot Wikiのリンク先http://wiki.dovecot.org/TimeMovedBackwardsを見てみたところ
  1. ntpdateを使っていますか?良くありません
  2. 仮想化環境を使用していますか?
と書かれていた。
このサーバは仮想環境ではないが、時刻合わせのスクリプト(ntpdateを使用)を1日1回実行されるようcron.daily内に配置している。ntpdateは一瞬にして時刻が修正されるので、これにより13秒戻ったということになる。ダウンした時刻とcron.dailyの時刻(4:02)がほぼ同じなので、これが原因のようです。

・解決方法
Dovecot Wikiによるとntpdを使用してください。とあるのでntpdサービスを使用して時刻同期を取るように変更します。
※ntpdの時間同期は、ずれを徐々に修正するような仕組みになっている。遅れているいる場合は刻み速度を早くして修正し逆に進んでいるときは刻みを遅くして修正するのでいきなり時刻がずれることはない。

インストール
# yum install ntp

設定
※タイムサーバとして稼動も可能だがとりあえず、ローカルホストの時刻同期専用とする。
# vi /etc/ntp.conf
-----------------------------------------------------------------------------
アクセス制御について
#restrict default kod nomodify notrap nopeer noquery   → コメント(IPv4)
#restrict -6 default kod nomodify notrap nopeer noquery  → コメント(IPv6)
restrict ignore → 追記(とりあえず全てのアクセスを拒否)

restrict 127.0.0.1 → ローカルホストは許可(IPv4)
#restrict -6 ::1 → ローカルホストは許可(IPv6) 使わないのでコメント

参照タイムサーバ
#server 0.centos.pool.ntp.org → コメント
#server 1.centos.pool.ntp.org → コメント
#server 2.centos.pool.ntp.org → コメント
server -4 ntp.nict.jp      → 追記(NICT)※-4 はIPv4
server -4 ntp.jst.mfeed.ad.jp → 追記(上記と同期されている)
server -4 ntp.ring.gr.jp    → 追記(Ring Server Project)

上記サーバがどれも応答しないときの参照先?よくわかりません
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
-----------------------------------------------------------------------------
 
restrictで始まる行は指定したホストに対してのNTPアクセスを制御します。またrestrictは最後の設定条件で有効になるので、最初に全拒否をして接続を許可していくスタイルになります。


  • ignore:全てのパケットを拒否
  • noquery:クエリーを拒否
  • nomodify:設定変更のクエリーを拒否
などがあるようです。詳しくはこちらを参照してください。

・起動
時刻差が大幅にあると起動できないため、一度手動で合わせる。
# ntpdate ntp.nict.jp
 
開始
# /etc/init.d/ntpd start
 
自動起動
# chkconfig ntpd on
# chkconfig --list ntpd
ntpd     0:off  1:off  2:on  3:on  4:on  5:on  6:off

・確認
# ntpq -p
 
 
 
 
 
 
remote列の左側にある"*"は同期中で、"+"がいつでも使用できることを表しています。
尚、開始後に同期するまで5~10分程度必要です。
これで時刻が急に変化することがなくなりましたので大丈夫でしょう。
 

2009年11月24日火曜日

Redmine アップデート(0.8.6→0.8.7)

CentOS5.4 + PostgreSQL 8.2.5の環境でアップデート
※MySQL環境でも同じ手順でOKです

まずはインストール先へ移動
# cd /home/redmine

レポジトリからチェックアウト
# svn update
U test/unit/helpers/application_helper_test.rb
U test/functional/timelog_controller_test.rb
U test/integration/admin_test.rb
U test/integration/account_test.rb
U app/controllers/timelog_controller.rb
U app/controllers/application.rb
U app/controllers/account_controller.rb
U app/views/wiki/export_multiple.rhtml
U app/views/wiki/export.rhtml
U config/initializers
U config/environments/test.rb
U config/environments/test_sqlite3.rb
U config/environments/test_pgsql.rb
U doc/INSTALL
U doc/CHANGELOG
U lib/redmine/version.rb
A lib/tasks/initializers.rake
U lib/redcloth3.rb
U public/themes/alternate/stylesheets/application.css
Updated to revision 3085.

マイグレーション
# rake db:migrate RAILS_ENV="production"
(in /home/redmine)
rake aborted!
Missing session secret. Please run 'rake config/initializers/session_store.rb' to generate one

(See full trace by running task with --trace)

あれ?失敗した模様・・・なにやらsession_store.rbを実行?
先にこれを実行するんですね。
# rake config/initializers/session_store.rb
(in /home/redmine)

再度マイグレーション
# rake db:migrate RAILS_ENV="production"
(in /home/redmine)

今度は大丈夫みたい

情報が以下のように変わりました。
Redmine 0.8.7.stable.3085 (PostgreSQL)
 

2009年11月20日金曜日

Windows Server 2008 R2 Standard

新しいHyper-V(2.0)を試すため2008 R2をとりあえずフルインストールで構築してみました。
ServerCoreの環境ではGUIによる役割追加ができませんのでフルインストールした方が簡単でお勧めです。

ハードウェア

  • 本体:Dell PowerEdge SC1435
  • CPU:AMD Opteron 2376(2.3GHz/6MB L3キャッシュ) × 2
  • メモリ:4GB(DDR2/667MHz 1GB×4)
  • HDD:160GB×2 RAID1構成(3.5インチSATAⅡ 7200RPM)


 
とりあえずOSは完了しました。
後日Hyper-Vを追加してCentOSでも入れてみることにしよう。
 

2009年11月16日月曜日

FortiGuard スパムデータベース

http://www.fortinet.co.jp/support/antispam.html

ここではIPアドレス、Eメールアドレス、メール本文中のURLなどでスパムのブラックリスト検索が行えます。



2009年11月13日金曜日

BitNami::Redmine 0.8.6対応版

WindowsPCに簡単構築できるオールインワンタイプのRedmine
BitNami::RedmineがRedmine0.8.6に対応したようですね。

Windows版はもちろんのことLinuxやMac用のインストーラもありますが、VMWare等で使用するVMDK形式の仮想マシンまで用意されておりOSはOpenSUSE 11.1で構成されているようです。

BITNAMIへはこちらからどうぞ。
 

2009年11月11日水曜日

バラクーダレピュテーションブロックリスト(BRBL)

セキュリティ製品の発売元でもあるバラクーダネットワークスが無料のDNSBLを提供しているみたいです。提供元が信頼できるのでこのDNSBLをPostfixで使ってみます。

もし使用する方は、くれぐれも自己責任でお願いします

無料ではあるがDNSの登録が必要ですのでまず登録をします。
http://www.barracudacentral.org/ を開き左側のメニューからBRLB>Request Accessを選択します。



Login Information(ログイン情報)
  • Email Address:ログインアカウント
  • Password:パスワード
  • Confirm Password:パスワードを再入力
Contact Information(メイン問い合わせ情報)
  • Name:(氏名)
  • Company:(会社名)
  • Address 1:(番地)
  • Address 2:(町名)
  • City:(市や区)
  • Country:(Japanを選択)
  • State/Province:(都道府県)
  • Zip/Postal Code:(郵便番号)
  • Phone Number:(電話番号 +81-****-****)
  • Alternate Email Address:(サブ連絡用E-Mailアドレス)
Alternate Contact Information(サブの問い合わせ情報)
※空はダメみたいです。面倒なのでメインと同じにしてしまいました。
  • Name:(氏名)
  • Phone Number:(電話番号 +81-****-****)
  • Email Address:(連絡E-Mailアドレス)
  • Alternate Email Address:(サブ連絡用E-Mailアドレス)
Access Information(アクセス情報)
  • IP Addresses:自前DNSサーバのIPアドレスを入力(複数あればカンマ区切りで10までOK)

It's OK to email me with BarracudaCentral.org updatesにチェックを入れsubmitを押します。

しばらくするとログイン情報で入力したメールアドレス宛に以下のようなメールが届きます。
-----------------------------------------
Hello,


Thank you for your interest in the Barracuda Reputation Block List (BRBL). Please click on the link below to verify the status of your account and to begin accessing the BRBL.

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓このURLをクリックする↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
http://www.barracudacentral.org/account/verify/~/*********

The Barracuda Reputation System is a compilation of the most sophisticated IP analysis techniques and is one of 12 defense layers included in the Barracuda Spam Firewall. Click here to learn more.

Thank you,

BarracudaCentral.org
-----------------------------------------
 
これで登録は完了ですので使えるかテストしてみましょう。
 
設定するメールサーバ上で以下のコマンドを入力して結果を見ます。
$ host 2.0.0.127.b.barracudacentral.org
2.0.0.127.b.barracudacentral.org has address 127.0.0.2  ← 成功
  

以下のようならば失敗となります
Host 2.0.127.b.barracudacentral.org not found: 3(NXDOMAIN) ← 失敗
 
 
成功を確認後main.cfを編集
※当環境での設定ですので注意
# vi /etc/postfix/main.cf
smtpd_client_restrictions =
 permit_mynetworks
 permit_sasl_authenticated
 reject_rbl_client b.barracudacentral.org ← 追記
 permit
 
ログ(/var/logs/maillog)
 postfix/smtpd[24805]: NOQUEUE: reject: RCPT from unknown[**.**.***.**]: 554 5.7.1 Service unavailable; Client host [**.**.***.**] blocked using b.barracudacentral.org; http://www.barracudanetworks.com/reputation/?pr=1&ip=**.**.***.**; from=root@sample.com to= proto=ESMTP helo=<[**.**.***.**]>
postfix/smtpd[24805]: disconnect from unknown[**.**.***.**]
 

2009年11月10日火曜日

Redmine アップデート(0.8.3→0.8.6)

Redmine 0.8.6がリリースされてました。
当環境ではSubversionリポジトリからのチェックアウトしているので、Subversionリポジトリから更新します。(CentOSに構築した手順はこちらです)

まずredmineのソースが配置されているディレクトリに移動します。(当環境では/home/redmine)
#cd /home/redmine/

svnコマンドで更新ファイルを取得
# svn update
U test/unit/helpers/application_helper_test.rb
U test/unit/mail_handler_test.rb
U test/unit/query_test.rb
U test/functional/issues_controller_test.rb
U test/functional/news_controller_test.rb
U test/functional/account_controller_test.rb
U test/functional/projects_controller_test.rb
A test/fixtures/mail_handler/ticket_with_spaces_between_attribute_and_separator.eml
U test/fixtures/journals.yml
U test/fixtures/users.yml
U test/fixtures/attachments.yml
U app/helpers/application_helper.rb
U app/models/mail_handler.rb
U app/models/query.rb
U app/models/changeset.rb
G app/controllers/issues_controller.rb
U app/controllers/timelog_controller.rb
U app/controllers/messages_controller.rb
U app/controllers/news_controller.rb
U app/controllers/account_controller.rb
U app/controllers/wiki_controller.rb
U app/views/journals/_notes_form.rhtml
U app/views/users/_memberships.rhtml
U app/views/versions/show.rhtml

データベースのマイグレーション(テーブル作成)
# rake db:migrate RAILS_ENV="production"
(in /home/redmine)

キャッシュのクリア
# rake tmp:cache:clear
(in /home/redmine)

セッションのクリア
# rake tmp:sessions:clear
(in /home/redmine)

Apacheを再起動

Redmineにログインして「管理」>「情報」を開きます。
Redmine 0.8.6.stable.3023 (MySQL)となりました。
※DBにPostgreSQLが使用されているときはRedmine 0.8.6.stable.3023 (PostgreSQL)となる。
 

Google検索