■侵入改竄検知システム AIDE を使うメモ
 長くIDSとしてOsirisを使ってきたが時勢に合わなくなってしまったので、CentOS/ScientificLinuxに標準装備されているAIDEを使ってみたメモ。

■インストールと簡単な使い方
[code]# yum install aide

設定編集(コメント充実)
# vi /etc/aide.conf
R = p+l+i+n+u+g+s+m+acl+selinux+xattrs+md5

初期化
# aide -i

比較用DB作成
# cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz

比較
# aide -C

通常用途
# aide -u[/code]

■CentOS5系でselinuxで問題が出るケースの設定変更例
[code]# vi /etc/aide.conf

R = p+l+i+n+u+g+s+m+acl+xattrs+md5
L = p+l+i+n+u+g+acl+xattrs
> = p+l+u+g+i+n+S+acl+xattrs

DIR = p+l+i+n+u+g+acl+xattrs

PERMS = p+l+i+u+g+acl

DATAONLY = p+l+n+u+g+s+acl+xattrs+md5+sha256+rmd160+tiger[/code]

■Prelink関連のエラーが出る場合の設定変更例
[code]# sed -i ‘/^PRELINKING=yes$/s/yes/no/’ /etc/sysconfig/prelink
# /usr/sbin/prelink -ua[/code]

■cron用script例
[code]# vi /root/script/aide.sh
#!/bin/bash

/usr/sbin/aide -u
/bin/cp -fr /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz[/code]

■MyNETS用改竄検知設定例(/var/www/sns/wwwをSNS rootとする)
[code]# vi /etc/aide.conf
# MyNETS SNS DIR
/var/www/sns/www NORMAL
!/var/www/sns/www/img
!/var/www/sns/www/var[/code]

■参考リンク
http://pooh.gr.jp/?p=9633
http://blog.cecily.jp/kotou/51/
http://aikotobaha.blogspot.jp/2011/11/rhel-aide.html

, , , ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

侵入検知系の覚え書き(1)

■ [samhain]samhainのインストール記録(WSMから本人投稿を再掲載 2004年2月)
samhainはOSXでうまくコンパイルできると紹介されていたのですが、結果から言うと、1.6.6まではその通りですが、1.7系以降はsh_mail.cでエラーになりコンパイルできません。

1.6.6のsh_mail.cなどと入れ替えたりしてみましたが、最新の1.8.3では結局成功することはありませんでした。私はプログラマではないので修正はできない(一応ソースは見て努力はしましたけど、無駄でした:-()ので、1.6.6をインストールしてみました。

ソースを展開後、./configureをすればいいのですが、OSX用には以下のオプションを適用すると面倒が少なくていいと思います。

[code]./configure –prefix=/usr –with-trusted=0,1,501[/code]

ここで、–with-trusted=0,1,501としているのは、samhainは信頼するユーザでの動作・操作を要求するので、rootとdaemon、管理者ユーザを信頼するよう加えてあげるためです。管理者ユーザのUIDが異なる場合には必要なUIDに変更してください。

これをしないと、インストール時やインストール後に再configureが必要になると思います。
その後はマニュアル通りです。

[code]make
sudo make install[/code]

インストールが完了したら設定ファイルを編集します。

[code]sudo vi /etc/samhainrc[/code]

設定内容はGoogleで「サワーン」を引くと有名なページが出てくるので参考にしてください。
設定を保存したら最初に初期化します。

[code]sudo /usr/local/sbin/samhain -t init[/code]

その後デーモンモードで起動します。

[code]sudo /usr/local/sbin/samhain -t check -D[/code]

samhainはインストールしてもOSX用の自動起動scriptはインストールしてくれませんので、自分で起動scriptを作ってやる必要があります。

動作はG4/800でもそれほど重い感じはしないので、1時間おきにチェックの設定をしています。samhainが異常を知らせるメールを指定のアドレスに設定ファイルに記述して送らせることができますが、多量のファイルが検出された場合、大量のメールが届くので注意が必要です。1メールに記述する異常の件数が少ないため、ここはまとめ送りにしてほしいところです。1.7系以降は解消されているのかもしれませんが、1.6xではこれが困ります。

samhainはClient/Serverモードでも動作しますので、1台のマシンで多数の端末の管理が可能です。

OSXで最新版がうまくコンパイルできない点でちょっと不安があったので利用しないことにしたため、こちらの設定は試していませんが。

1台の端末に入れてチェックするだけなら、比較的お手軽でいいかなと思います。

, ,
とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
Loading...

Tigerの某噂を検証する

■ [osiris]Tigerの某噂を検証?する
Tigerをインストールしたマシンでナニがナニするという某噂を検証してみるため、ファイル整合性チェッカーであるosirisを使って実験をしてみた。結論は既に前日掲載の通りだが、一応これまでの経緯をまとめて次の実験のための記録として残しておく。

検証用に使ったマシンと構成、Tigerのインストール方法は以下の通り。

iMacG4/800 768M 120GHD 別パーテーションのPantherユーザ情報を取り込みアップデート
PowerBookG4/12int/1G 768M 40GHD Pantherに上書きアップデート(Xcodeもアップデート)
PowerBookG3/500 384M 5GHD Vine3.1を消して新規にインストール
どれもインストール自体に問題(エラーなど)はなく、スムーズにインストールは完了。PowerBookG4のみXcodeがPantherの時からインストールされていたので、Tiger版をアップデートインストール。ほかの台は新規にTiger版Xcodeをインストールしておく。

検証を行ったosirisのバージョンと順番は以下の通り。

iMacG4/osiris-4.1.8 →4.1.8が動作怪しい 検証できず
PowerBookG4/osiris-3.0.4 →3.0.4自体はちゃんと動作しているっぽいが再起動で設定が飛ぶ
PowerBookG3/osiris-3.0.4 →ちゃんと動作しているが、噂の現象は発生せず
当初最新版のosirisの動作確認も含めてと考えていたのだが、残念ながらTigerとはうまくなかったようで、今4.1.8のインストール記録を見直してみると、3.0.4でインストールPathが/usr/sbinだったものが4.1.8では/usr/local/sbinだったり、3.0.4では標準でdefault.darwinが設定として認識されたのに4.1.8では適切に設定されなかったりと、あちこちに食い違う点が散見される。4.1.8を再度Panther環境下で検証する必要があるだろうが、Tigerにはうまく対応できていないと見るのがよさそうだ。(これについては別途検証するつもり)

iMacG4での不具合
昨日も書いているが、osiris-4.1.8ではedit-filtersコマンドの編集機能が変更されており、ウィザード形式からviでの直接編集形式になっている。公式サイトのドキュメントは4.0.5ベースの記述で4.1.8の変更部分について記載されていない。3.0.4ではソースに同梱されているDocも4.1.8のソース中には見当たらない。そこで書式自体は変更がないと推測し旧来のfilterと同じ書式で書いてみると、コマンドからfilter行であることは認識されているようでprint-filtersでちゃんと表示はされる。しかしながら、実際にscanをしてみるとfilterが全く反映されておらず、一回のスキャンでかなりの長時間かかる上に10万行以上のメールレポートとなり、チェックするだけでもかなり大変。

おまけにosirisを再起動orマシンを再起動すると、ホストの設定を忘れてしまうらしくconfigが未設定になり、毎回初回スキャンとなってしまい、本来の用途である差分評価ができない。管理コンソールであるosirismdを別マシンで動作させて、iMacG4をスキャンクライアントだけにすれば問題は解決すると思われるが、環境構築が間に合わないため断念。

osiris自体もedit-mhostで設定する際に、1回目の設定項目と2回目の設定項目が異なるなど、やや不自然な挙動をしていることからコンパイル等がうまくいっていない可能性も考えて、一旦検証を中止することにした。このままではTiger環境の問題なのかosirisの問題なのか区別できないからだ。

PowerBookG4での不具合
iMacG4での反省からPowerBookG4では最新版の4.1.8の代わりにPantherでの動作運用実績のある3.0.4を使ってみた。これならこれまでの動作と比較しておかしいところがわかりやすい。PowerBookG4にはPanther版のXcodeもインストール済みだったが、あえてXcodeを上書きインストールしてみた(Tigerは検証しようと思う前に既に上書きインストールしてしまっていた…orz)。アップデートされたXcodeでosiris-3.0.4をコンパイル、特に大きな違いはなさそうで無事make installまで完了。3.0.4は何台にもインストールしてきたのでお手の物。さくさくと設定して最初のスキャン。filter含め問題なく動作している模様。ファイルを増やしたり減らしたりしてスキャンをし、スキャン結果は想定通りに返ってくることを確認。3.0.4は問題なく動いていると判断し、再起動による実験にはいったところで問題が発生。iMacG4で4.1.8を使った時と同様にホストの設定が一部消失し、再起動の都度初回スキャンになってしまう現象が起きる。これはPantherでは起きていない現象(のはず)。実際に運用している他のosiris-3.0.4とほぼ同じ設定(違うのはスキャン実行間隔くらい)なので、これはTiger環境下の不具合と思われる。こちらでも再起動後の差分評価ができない状態のため、Tigerをちょっと疑いはじめる。

PowerBookG3での評価
上と同時にもう一台Pismoを使って実験をしてみていた。こちらはVineLinux3.1ppcをインストールしていたものを消去してTigerを完全に新規インストールしてみる。メモリも多くないし、HDも手狭だが検証には十分だろうということで試したのだが、結果としてはこれが一番まともに動作する結果となった。TigerとXcodeをインストールし、osiris-3.0.4をコンパイルしてインストール。インストールの過程は至って普通で問題なし。設定もさくっと終えて、osirisの動作確認も問題なく完了。再起動の実験に入ったところ、こちらも一部設定がなくなる現象は発生するものの、push-configするだけで回復し、再起動後も前回との差分評価が問題なくできる。これならまともに検証できるということで、default.darwinのconfigに/etc,/Applications,/Users以下をRecursive yes,IncludeAllで追加。filterでnew,missingのみを検知するようにし再起動実験に入る。

実験方法は以下の通り。

  • ユーザをログアウトする
  • 再起動する
  • 上記を5回繰り返したらosirisでスキャン
  • これを3セット行う

    再起動回数では15回程度と少ないが、翌日出かけなければならなかったことと、この時点で既に朝の3時になっていたため、あまり時間をかける余裕がなかったので仕方ない(w。主立ったファイルが無くなれば検知できる状況なので、また改めて時間をとって再起動を続けてみようとは思う。この回数の中では問題は発見できず、某噂は確認することができなかった。

    実験の結果
    某噂の真贋はともかく、同じバージョンのosirisをコンパイルインストールして動作結果が違う、ということの方が大きな問題だと感じた。Tigerではユーザ環境を継承したインストールでは新規インストールした場合とOS自体の挙動が異なるか、少なくともXcodeを上書きインストールするとコンパイル結果が異なってしまう可能性があるということになる(そもそもXcodeを上書きインストールするのが暴挙という話もあるが)。/Developer/Tools/以下にあるuninstall-devtools.plを利用して前環境を消去してからインストールするくらいは最低限しないと駄目だということで。

    ■ [osiris]PowerBookG3再起動検証中
    とりあえず帰ってきたので動作が安定しているPowerBookG3で再起動実験継続中。以下のscriptをアプリケーションにして自動ログイン設定したユーザの起動項目に設定。

    [code]tell application “Finder”
    activate
    delay 30
    restart
    end tell[/code]

    実際には再起動回数を把握するための項目も入ってるんだけど、稚拙すぎなので省略(w。まぁログ追えばわかるしね。先ほど75回目でscanチェックした際には噂の現象は発生しておらず。500回くらいまではやってみる予定。

    本当はAutomatorで書いてみたかったんだけど、再起動とかそういうイベントは用意されておらずFinderやシステムのイベントで指定できないらしい。そこでTerminalコマンドとして設定したみたところsudoはおろかsuすらAutomatorからは認証できないらしく(書き方に問題有りなのか…)認証のエラーばかりが残る始末。まぁAppleScriptでいいかと妥協したという…orz。

    Autometor自体はなかなか面白そうなのでもうちょっと試行錯誤してみたいところ。

    (追記1)175回目の再起動後チェックでも異常無し
    (追記2)250回目の再起動後チェックでも異常無し
    (追記3)280〜300回目の再起動後チェックで…うーん、解析後報告します
    (追記4)PowerBookG4は22回目の再起動で障害発生 検証暫定中止します

    ToDo
    PowerBookG3の検証終わったら、これをマネージメントコンソールにしてPowerBookG4とのC/S動作検証を行ってみる。時間があればPantherでosiris-4.1.8の検証をしてみようと思う。

    , ,
    とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
    Loading...
  • osiris-4.1.8をTigerへインストール

    ■ [osiris]最新版osiris-4.1.8をTigerへインストールする
     Tigerをインストールしたので最新版osirisで某噂の検証をしてみる。osirisのHP(http://osiris.shmoo.com/)から最新版の4.1.8をダウンロードする。なんか、S/MIMEモジュールとかいろいろ機能拡張されているなぁ。とりあえず今回は本体のみダウンロード。TigerにはあらかじめXcodeをインストールしておく必要がある。

    最新版ではWindows2003Serverなどの対応が追加されている他filterの編集方法などが変更されている(後述)ので注意が必要である。

    注)4月30日現在下記設定をしてもいくつか不具合がみられるので注意。

    Filterの設定が適切に反映されていないようにみえる
    osirisを再起動すると管理対象ホストの設定の一部が無効になる
    しかたないで3.0.4をインストールしてみたのだが、こちらはちゃんと動作しているようだ。なんだかなぁ。とりえあず検証用途には3.0.4をオススメ。(誰に?)

    ■ [osiris]configure
    ダウンロードしたファイルを展開する。

    [code]$ tar zxvf ./osiris-4.1.8.tar.gz
    $ ls ./osiris-4.1.8
    AUTHORS INSTALL Makefile.in TODO bootstrap config.sub depcomp mkinstalldirs
    COPYING LICENSE NEWS acinclude.m4 config.guess configure install-sh src
    ChangeLog Makefile.am README aclocal.m4 config.h.in configure.ac missing[/code]

    まずはconfigureオプションの調査だが、最新版ももちろんOSX標準対応なのでオプションは特に不要。
    [code]
    $ ./configure
    (中略)
    Osiris (c) 2000-2005 The Shmoo Group (TSG)
    —————————————————–

    ==> Configuration Complete.
    ==> Osiris has been configured with the following options:

    Host: powerpc-apple-darwin8.0.0
    Compiler: gcc
    Compiler flags: -Wall -g -O2
    Preprocessor flags:
    Linker flags:
    Libraries: -lpthread -lssl -lcrypto -lresolv
    Privlege Separation: yes
    SSL Location: (system)
    Osiris Root Directory: /usr/local/osiris
    Osiris user: osiris
    Osiris MD Directory: /usr/local/osiris
    Osiris MD user: osiris
    Osiris MD config dir: /usr/local/osiris

    ======================================
    Found Scan Agent Modules:

    ==> mod_groups
    ==> mod_kmods
    ==> mod_ports
    ==> mod_users
    ======================================

    ==> use one of the following targets:

    all: make everything, agent, CLI and management console.
    agent: create scan agent installer package.
    console: create management console installer package.
    install: run installation script.
    clean: remove object files.[/code]

    これでconfigure完了。

    ■ [osiris]osirisクライアント/コンソールを個別にmake
     osirisではマネージメントコンソールとスキャンクライントが連携して動作する仕様で、管理用のマシンにはマネージメントコンソール、管理対象にはスキャンクライアントと別々にインストールして設置することが可能である。多数の管理対象がある場合にはコンソール/クライアントを個別にmakeしてインストールパッケージを作っておくことができる。

    [code]$ make console
    (中略)
    ————————————————————————-
    building release tarball: src/install/osiris-console-4.1.8-release-powerpc-Darwin-8.0.0.tar
    installer package contents:
    total 3744
    -rw-r–r– 1 username username 5130 Apr 30 12:11 LICENSE
    drwxr-xr-x 17 username username 578 Apr 30 12:11 configs
    drwxr-xr-x 5 username username 170 Apr 30 12:11 darwin
    -rwxr-xr– 1 username username 31187 Apr 30 12:11 install.sh
    -rwxr-xr-x 1 username username 863568 Apr 30 12:11 osiris
    -rwxr-xr-x 1 username username 125152 Apr 30 12:11 osirisd
    -rwxr-xr-x 1 username username 877192 Apr 30 12:11 osirismd
    -rw-r–r– 1 username username 80 Apr 30 12:11 version.h
    ————————————————————————-
    installer package created.[/code]

    これでsrc/install/以下にコンソール用パッケージosiris-console-4.1.8-release-powerpc-Darwin-8.0.0.tar.gzが作成される。make cleanしてから続いてクライアント用パッケージを作成する。

    [code]$ make agent
    (中略)
    ————————————————————————-
    building release tarball: src/install/osiris-agent-4.1.8-release-powerpc-Darwin-8.0.0.tar
    installer package contents:
    total 336
    -rw-r–r– 1 username username 5130 Apr 30 12:13 LICENSE
    drwxr-xr-x 5 username username 170 Apr 30 12:13 darwin
    -rwxr-xr– 1 username username 31187 Apr 30 12:13 install.sh
    -rwxr-xr-x 1 username username 125152 Apr 30 12:13 osirisd
    -rw-r–r– 1 username username 80 Apr 30 12:13 version.h
    ————————————————————————-
    installer package created.[/code]

    これでsrc/install/以下にコンソール用パッケージosiris-agent-4.1.8-release-powerpc-Darwin-8.0.0.tar.gzが作成される。それぞれのパッケージは以下のコマンドでインストールできる。

    [code]$ tar zxvf ./osiris*
    $ cd osiris*
    $ sudo ./install.sh[/code]

    ■ [osiris]osirisクライアント/コンソールを一緒にmake
     ほとんどの場合最初のインストールはこちらでいいと思う。クライアントとコンソールを一気にmakeしてインストールできる。

    [code]$ make all
    (中略)
    Build Successful!

    To create management console install package: ‘make console’
    To create scan agent install package: ‘make agent’

    Documentation is also online at: http://osiris.shmoo.com[/code]

    このメッセージが出たらインストール準備が完了。次のコマンドでインストールを行う。

    [code]$ sudo make install[/code]

    ■ [osiris]osirisのインストール
     ここからは出力にコメントしていく。

    [code]$ sudo make install

    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

    Password:  ←管理者パスワード
    (中略)
    Continue with installation? (y/n) [y]  ←インストール継続の確認
    Osiris Scanning Daemon Version
    4.1.8-release

    “4.1.8-release” for Darwin 8.0.0
    Copyright (c) 2005 Brian Wotring. All Rights Reserved.

    This installation was configured and built to run as osiris
    agent user name: osiris
    management user name: osiris

    This installation was configured and built to use osiris
    agent root directory: /usr/local/osiris
    management root directory: /usr/local/osiris

    The username and directory will be created during the
    installation process if they do not already exist.

    By installing this product you agree that you have read the
    LICENSE file and will comply with its terms.

    ———————————————————————

    ==> creating user and group (osiris, osiris).
    ==> creating Osiris user and group with uid/gid 502.
    ==> group ‘osiris’ added.
    ==> user ‘osiris’ added.
    ==> using existing Osiris management console user.
    Install osiris agent? (y/n) [y]  ←クライアントのインストール確認
    Install management console? (y/n) [y]  ←コンソールのインストール確認
    Install CLI? (y/n) [y]   ←コマンドラインのインストール確認
    Installation directory for binaries: [/usr/local/sbin]  ←インストール先確認
    Installation directory doesn’t exist, creating.
    ==> installed osiris CLI: /usr/local/sbin/osiris
    Osiris scan agent root directory doesn’t exist, creating.
    ==> installed scan agent: /usr/local/sbin/osirisd
    ==> installed management console /usr/local/sbin/osirismd
    ==> installed default scan configs.
    ==> updated: /etc/hostconfig –> OSIRISSERVER=-YES-
    ==> installing StartupItem for the Osiris Scan Agent.
    ==> installed /System/Library/StartupItems/Osiris/Osiris
    ==> change owner and permissions on /usr/local/sbin/osiris
    -rwxr-xr-x 1 root wheel 1412536 Apr 30 12:26 /usr/local/sbin/osiris
    ==> change owner and permissions on /usr/local/sbin/osirisd
    -rwxr-xr-x 1 root wheel 483060 Apr 30 12:26 /usr/local/sbin/osirisd
    ==> change owner permissions on /usr/local/sbin/osirismd
    -rwsr-xr-x 1 osiris osiris 1721788 Apr 30 12:26 /usr/local/sbin/osirismd

    ==================================================================
    Osiris has been installed, but is not currently running. Startup
    scripts have been installed so that the necessary services will
    be started on boot.

    Start management console now? (y/n) [y]  ←コンソール起動確認
    osirismd: missing configuration file,
    ==> created default in: /usr/local/osiris/osirismd.conf.
    unable to load server certificate (/usr/local/osiris/certs/osirismd.crt)
    ==> creating one.
    Generating RSA key, 2048 bit long modulus.
    …………………………………………..+++
    ……………………………………………………………………+++
    Start scan agent now? (y/n) [y]  ←クライアントの起動確認

    Documentation is included with this source and available online at:
    http://osiris.shmoo.com/docs

    (c) 2005 – Brian Wotring[/code]

    これでインストールと起動が完了。続いて設定を行う。

    ■ [osiris]CLIでの設定
     まずはCLIで管理者としてログインし設定を行う。

    [code]$ /usr/local/sbin/osiris
    Osiris Shell Interface – version 4.1.8-release
    unable to load root certificate for management host:
    (/Users/username/.osiris/osiris_root.pem)
    >>> fetching root certificate from management host (127.0.0.1).

    The authenticity of host ‘127.0.0.1’ can’t be established.

    [ server certificate ]

    subject = /C=US/CN=Osiris Management Console/OU=Osiris Host Integrity System
    issuer = /C=US/CN=Osiris Management Console/OU=Osiris Host Integrity System

    key size: 2048 bit
    MD5 fingerprint: 30:87:07:74:08:7B:5D:83:52:FD:63:6F:6B:32:5F:7D

    Verify the fingerprint specified above.
    Are you sure you want to continue connecting (yes/no)? yes ←設定を続けるか確認
    >>> authenticating to (127.0.0.1)

    User: admin ←管理者は「admin」でログインする
    Password:  ←最初は設定されていないのでリターンキー

    connected to management console, code version (4.1.8-release).
    hello.

    WARNING: your password is empty, use the ‘passwd’ command
    to set your password.

    osiris-4.1.8-release: passwd ←まずはadminのパスワードを設定
    User: admin
    Password:  ←管理用パスワードを入力 確認がないので注意
    >>> user: (admin) updated.[/code]

    これで管理者でのログインは完了。以下のコマンドでヘルプが表示される。

    [code]osiris-4.1.8-release: ?

    [ Management Commands ]
    mhost host new-user edit-filters
    edit-mhost edit-host edit-user print-filters
    print-mhost-config list-hosts list-users
    test-notify new-host delete-user test-filter

    [ Host commands ]
    status list-configs start-scan list-db
    watch-host new-config stop-scan baseline
    disable-host push-config print-log set-baseline
    host-details edit-config list-logs print-db
    print-host-config print-config print-db-errors
    rm-host rm-config print-db-header
    init drop-config rm-db
    config verify-config unset-baseline

    [ Misc commands ]
    help version quit ssl

    For help with a specific command, try: help [/code]

    ■ [osiris]管理用ホストを設定する

    [code]osiris-4.1.8-release: edit-mhost

    [ edit management host (127.0.0.1) ]

    > syslog facility [DAEMON]:
    > control port [2266]:
    > http control port [0]: 10080
    > notify email (default for hosts) []: username@yourdomain.com
    > notification smtp host [127.0.0.1]: smtp.yourdomain.com
    > notification smtp port [25]:

    > authorized hosts:

    127.0.0.1

    Modify authorization list (y/n)? [n]

    [ management config (127.0.0.1) ]

    syslog_facility = DAEMON
    control_port = 2266
    http_port = 10080
    http_host =
    notify_email = username@yourdomain.com
    notify_app =
    notify_smtp_host = smtp.yourdomain.com
    notify_smtp_port = 25
    hosts_directory =
    allow = 127.0.0.1

    Is this correct (y/n)? y
    >>> management host configuration has been saved.[/code]

    ■ [osiris]管理対象ホストの追加
     まずは自ホストを管理対象に加えておく。

    [code]osiris-4.1.8-release: new-host

    [ new host ]

    > name this host []: myhost
    > hostname/IP address []: 127.0.0.1
    > description []: iMacG4
    > agent port [2265]:
    > enable log files for this host? (yes/no) [no]:

    Scan Databases:

    => keep archives of scan databases? Enabling this option means that the
    database generated with each scan is saved, even if there are no changes
    detected. Because of disk space, this option is not recommended
    unless your security policy requires it. (yes/no) [no]:
     ↑スキャンDBをアーカイブしておくオプション

    => auto-accept changes? Enabling this option means that detected
    changes are reported only once, and the baseline database is
    automatically set when changes are detected. (yes/no) [yes]:
     ↑変更を自動承認する設定 これをnoにすると承認するまで変更通知メールが何度も来る

    => purge database store? Enabling this option means that none
    of the scan databases are saved. That is, whenever the baseline
    database is set, the previous one is deleted. (yes/no): [yes]:
     ↑常に最新のスキャンDBだけで運用する設定

    Notifications:

    => enable email notification for this host? (yes/no) [no]: yes
    => send notification on scheduled scans failures? (yes/no) [no]: yes
    => send scan notification, even when no changes detected (yes/no) [no]:
    => send notification when agent has lost session key (yes/no) [no]: yes
    => notification email (default uses mhost address) []:

    Scheduling:

    > configure scan scheduling information? (yes/no) [no]: yes

    [ scheduling information for myhost ]

    Scheduling information consists of a start time and a frequency value.
    The frequency is a specified number of minutes between each scan, starting
    from the start time. The default is the current time. Specify the start
    time in the following format: mm/dd/yyyy HH:MM

    enter the start date and time
    using ‘mm/dd/yyyy HH:MM’ format: [Sat Apr 30 13:07:15 2005]
    enter scan frequency in minutes: [1440] 720

    > enable this host? (yes/no) [yes]:

    host => myhost
    hostname/IP address => 127.0.0.1
    description => iMacG4
    agent port => 2265
    host type => generic
    log enabled => no
    archive scans => no
    auto accept => yes
    purge databases => yes
    notifications enabled => yes
    notifications always => no
    notify on rekey => yes
    notify on scan fail => yes
    notify email => (management config)
    scans starting on => Sat Apr 30 13:07:15 2005
    scan frequency => every 720 minutes
    enabled => yes

    Is this correct (y/n)? y
    >>> new host (myhost) has been created.
    Initialize this host? (yes/no): yes

    Initializing a host will push over a configuration, start
    a scan, and set the created database to be the
    trusted database.

    Are you sure you want to initialize this host (yes/no): yes

    OS Name: Darwin
    OS Version: 8.0.0

    use the default configuration for this OS? (yes/no): yes
    >>> configuration (default.darwin) has been pushed.
    >>> scanning process was started on host: myhost[/code]

    ■ [osiris]管理対象ホストの設定変更

    [code]osiris-4.1.8-release: host myhost
    myhost is alive.
    osiris-4.1.8-release[myhost]: edit-config ←ここでviでの設定変更モードになる
    >>> configuration file has changed, updating…
    >>> configuration: (default.darwin) has been updated.
    osiris-4.1.8-release[myhost]: push-config  ←ここで設定変更をホストに反映する
    >>> the configuration: (default.darwin) has been pushed to host: myhost
    osiris-4.1.8-release[myhost]: print-config ←設定内容を表示

    config name: default.darwin
    ID: 946090b8
    status: valid
    errors: 0
    warnings: 0
    lines: 57

    ——– begin config file ——–

    # Default Configuration for Mac OS X.
    Recursive no
    FollowLinks no
    IncludeAll
    Hash md5

    Include mod_users
    Include mod_groups
    Include mod_kmods


    Recursive no
    Include file( “mach_kernel” )


    Recursive yes
    Include executable


    IncludeAll


    IncludeAll


    IncludeAll


    IncludeAll


    IncludeAll


    IncludeAll

      ←ここから追加分
    Recursive yes
    IncludeAll


    Recursive yes
    IncludeAll


    Recursive yes
    IncludeAll
      ←ここまで
    # EOF

    ——– end config file ——–[/code]

    ■ [osiris]Filter設定の追加

    [code]osiris-4.1.8-release: edit-filters  ←ここからviで設定を編集(ウィザードは廃止された)
    >>> comparison filters have been saved.
    osiris-4.1.8-release: print-filters  ←設定を表示
    Exclude anything matching the following regular expressions:

    host=*;path=*;exclude: device ctime ;  ←Filterの書式は3.xから変更なし
    host=*;path=/etc;include only: perm uid gid new missing ;
    host=*;path=/Applications;include only: perm uid gid new missing ;
    host=*;path=/Users/username;include only: perm uid gid new missing ;

    4 comparison filters.[/code]

    , ,
    とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
    Loading...

    侵入検知系の覚え書き(2)

    ■ [osiris]osiris3.0.4のインストール記録(WSMから本人投稿を再掲載 2004年2月)
    osirisはDarwinに標準で対応しているため、samhainよりも実際の面倒は少ないです。Mac特有のリソースファイルなどにも対応しているということなので、OSXにはsamhainよりも適切かもしれません。また、samhainとは異なり、基本がClient/Serverタイプなので1台で利用する場合にもosiris、osirisd、osirismdの3つが必要になります(make allコマンドで全部準備されます)が、複数台の管理を前提に作られているようで、この仕様は使ってみると本当に便利でした。

    こちらは最新版が3.0.4になりますが、全く問題なくコンパイルできます。HPのドキュメントとコンパイル時に表示される情報では、コンパイル時の情報を参照する方がおすすめです。ちなみにsystem typeはOSX10.3.2ではpowerpc-apple-darwin7.2.0でした。

    ■ [osiris]コンパイルから管理コンソールのインストール
    osiris-3.0.4-current.tar.gzをダウンロードして展開します。

    [code]$tar -zxvf osiris-3.0.4-current.tar.gz[/code]

    展開したディレクトリに移動しコンパイル準備します。

    [code]$cd osiris-3.0.4-current
    $./configure[/code]

    ここで、makeについて注意が表示されます。実際に利用するのは以下の2つでいいでしょう。

    [code]$make all (1台のマシンに全部インストールする場合or管理マシンの場合)
    $make package (管理対象クライアントにインストールするパッケージ作成[/code])

    まずは、管理用マシンでmakeしてインストールしてみます。

    [code]$make all
    $sudo make install[/code]

    これでインストールを始めると、途中「make[3]: Nothing to be done for `install-exec-am’」のようなエラーみたいなlogが大量に出ますが、気にする必要はありません。

    それが終わると最初の設定を要求されます。これらの設定は多くが対話型で進むので、非常にわかりやすいと思います。

    [code]No Osiris user or group exists, determined uid/gid is: 502
    Continue with installation? (y/n)[/code]
    osirisのユーザをシステムに新規作成します。続けてよければyとします。

    [code]Install management console? (y/n)[/code]
    マネジメントコンソールをインストールします。こちらもyとします。

    [code]Installation directory for binaries: [/usr/sbin/][/code]

    /usr/sbin/にosirisがインストールされます。リターンキーでOKです。

    これでosirisがインストールされます。続けて、

    [code]Start management console now? (y/n)[/code]

    マネジメントコンソールをスタートするか聞かれます。yにします。

    SSL接続用のRSA Keyが作成されます。

    [code]Start scan agent now? (y/n)[/code]

    スキャンエージェントをスタートするか聞かれます。yにしておきます。

    これで管理用マシンのインストールが完了です。

    ■ [osiris]クライアントのパッケージ作成とインストール
    次に管理対象のosirisクライアント用のパッケージを作成します。先ほどのディレクトリosiris-3.0.4-currentで、以下のようにします。

    [code]$make clean
    $sudo make package[/code]

    これが完了するとosiris-3.0.4-current/src/installに以下のファイルが作成されます。

    [code]osiris-3.0.4-current.Darwin.tar.gz[/code]

    これを管理したいマシンにコピーして、以下のようにインストールを行います。

    [code]$tar -zxvf osiris-3.0.4-current.Darwin.tar.gz
    $cd osiris-3.0.4-current
    $sudo ./install.sh[/code]

    これでインストールが始まります。終了間際に

    [code]Start scan agent now? (y/n)[/code]

    スキャンエージェントをスタートするか聞かれますのでyにしておきます。
    これでクライアント側の準備も完了です。

    ■ [osiris]管理コンソールの設定
    ここから設定に入ります。管理マシンでosiris関係デーモンが起動しているか確認します。

    [code]$ ps aux | grep osiris

    osiris 14611 0.0 0.2 29116 876 p1 S 6:01PM 0:00.01 /usr/sbin/osirismd
    osiris 14612 0.0 0.2 29116 1116 p1 S 6:01PM 0:00.05 /usr/sbin/osirismd
    root 14614 0.0 0.1 27812 784 p1 S 6:03PM 0:00.01 /usr/sbin/osirisd
    osiris 14615 0.0 0.2 27816 1280 p1 S 6:03PM 0:00.04 /usr/sbin/osirisd
    user 15481 0.0 0.3 28912 1824 p1 S+ 6:19PM 0:00.06 osiris
    user 15488 0.0 0.1 18172 344 std S+ 6:22PM 0:00.01 grep osiris[/code]

    管理用マシンでosirisコマンドを起動します。

    [code]$ osiris[/code]

    すると以下のような起動画面が出ます。(osorisはコマンドラインで操作します)

    [code]Osiris command line management utility – version 3.0.4-current
    unable to load root cert for management host:
    (/Users/username/.osiris/osiris_root.pem)
    fetching root certificate from management host (localhost).
    The authenticity of host ‘localhost’ can’t be established.

    [ server certificate ]
    subject = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    issuer = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    key size: 2048 bit
    MD5 fingerprint: AE:67:D1:27:F3:55:96:08:98:38:CA:04:86:A8:06:40

    Verify the fingerprint specified above.

    Are you sure you want to continue connecting (yes/no)?[/code]

    接続しますか?と聞かれるので、yを入力します。

    [code]authenticating to (localhost)
    User:[/code]

    接続するとユーザ名を入力しろと言われるので「admin」と入力します。

    [code]User: admin
    Password:[/code]

    パスワードを聞かれますが、設定していないので、ここでは単純にリターンキー

    を押します。すると以下の画面になります。

    [code]connected to management daemon, code version (3.0.4-current).
    hello.

    osiris-3.0.4-current:[/code]

    このプロンプトの後でまず最初にやるべきことはパスワード設定です。

    [code]osiris-3.0.4-current:passwd admin[/code]

    と入力することでパスワード設定ができます。

    [code]osiris-3.0.4-current:passwd admin
    password:[/code]

    となるので、パスワードを入力してください。

    再度確認で入力を求められるので、同じパスワードを入力して設定完了です。
    設定したパスワードは次回接続から有効です。
    パスワードの設定が終わると再度以下の表示になります。

    [code]osiris-3.0.4-current:[/code]

    ここでプロンプトに?と入力するとhelpが表示されます。

    [code][ Managment Commands ]
    mhost host new-user edit-filters
    edit-mhost edit-host edit-user print-filters
    print-mhost-config list-hosts list-users
    test-notify new-host delete-user

    [ Host commands ]
    status list-configs start-scan list-db
    watch-host import-config stop-scan base-db
    disable-host push-config set-base-db
    host-details edit-config list-logs print-db
    print-host-config print-config print-log print-db-errors
    rm-host rm-config print-db-header
    drop-config rm-db
    verify-config
    new-config

    [ Misc commands ]
    help version quit ssl
    For help with a specific command, try: help [/code]

    まずは管理用マシン自体の設定をします。
    edit-mhostと入力してリターンキーを押すと後は対話的に進みます。

    [code]osiris-3.0.4-current: edit-mhost

    [ edit management host (localhost) ]
    > syslog facility [DAEMON]:  ←リターンキー
    > syslog level [NOTICE]:  ←リターンキー
    > log intensity [LOW]:  ←リターンキー
    > control port [2266]:  ←標準でよければリターンキー
    > http host name (uses system name by default) []: myhost  ←管理マシンのホスト名
    > http control port [2267]:  ←標準でよければリターンキー
    > notification email []: user@mydomain.com  ←通知を受けたいメールアドレス
    > notification smtp host [127.0.0.1]: 192.168.0.10 ←メールサーバのIPアドレス
    > notification smtp port [25]:  ←リターンキー
    > authorized hosts:

    127.0.0.1

    Modify authorization list (y/n)? [n]  ←管理ホストからだけ操作できればいいならリターンキー

    [ management config (localhost) ]
    syslog_facility = DAEMON
    syslog_level = NOTICE
    log_intensity = LOW
    control_port = 2266
    http_port = 2267
    http_host = myhost
    notify_email = user@mydomain.com
    notify_smtp_host = 192.168.0.10
    notify_smtp_port = 25
    hosts_directory =
    allow = 127.0.0.1

    Is this correct (y/n)? y ←よければリターンキー

    management host config sucessfully saved.[/code]

    これで管理用マシンの設定は完了です。

    ■ [osiris]チェックする対象マシンの設定
    管理用のマシン設定ができたところで、チェック対象のクライアントの設定に入ります。まず、管理対象クライアントをnew-hostコマンドで登録します。管理用マシンそのものももちろん対象にできます。ここからも対話的に設定できます。

    [code]osiris-3.0.4-current: new-host

    [ new host ]
    > name this host []: myclient01 ←クライアントのホスト名
    > hostname/IP address []: 192.168.0.101 ←クライアントのIPアドレス(管理用マシン自身を対象にするなら127.0.0.1でOK)
    > description []: PBG4 ←クライアントの説明(任意記述)
    > enable scan logging for this host? (yes/no) [no]: y ←logをとる場合にy
    > archive scan databases for this host? (yes/no) [no]:  ←スキャン毎の結果を保存したい場合にy
    > enable admin email notification for this host? (yes/no) [yes]:  ←メールでの通知が必要ならy
    > send scan notification, even when no changes detected (yes/no) [no]:  ←変化なしでも通知が必要ならy
    > notification email (default uses mhost address) []:  ←通知アドレスが管理用マシンの登録と同じでOKならリターンキー
    > configure scan scheduling information? (yes/no) [no]: yes  ←スキャンスケジュールを調整するならy(標準は1日毎)

    [ scheduling information for myhost ]
    Scheduling information consists of a start time and a frequency value.
    The frequency is a specified number of minutes between each scan, starting
    from the start time. The default is the current time. Specify the start
    time in the following format: mm/dd/yyyy HH:MM
    enter the start date and time

    using ‘MM/DD/YYYY hh:mm’ format: [Fri Feb 13 18:40:12 2004]  ←タイムスタンプフォーマット変更
    enter scan frequency in minutes: [daily (1440)] 180 ←1分単位で指定できます
    > activate this host? (yes/no) [no]: yes ←スキャンを有効にするならy

    host => myclient01
    hostname/IP address => 192.168.0.101
    description => PBG4
    host type => generic
    log enabled => yes
    archive scans => no
    notifications enabled => yes
    notifications always => no
    notify email => (managment config)
    scans starting on => Fri Feb 13 18:40:12 2004
    scan frequency => every 180 minutes
    enabled => yes

    Is this correct (y/n)? y ←設定内容がOKならy
    the new host (myhost) was sucessfully created.
    initialize this host? (yes/no): y  ←すぐに始めるならy(対象クライアントにosirisdが起動している必要あり)

    Initializing a host will push over a config, start
    a scan, and set the created database to be the
    trusted database.

    Are you sure you want to initialize this host (yes/no): y ←すぐに始めるならy(対象クライアントにosirisdが起動している必要あり)

    OS Name: Darwin ←対象クライアントから自動判別
    OS Version: 7.2.0

    use the default config for this OS? (yes/no): y ←該当OS用の標準設定でよければy
    The config: default.darwin has been pushed.

    perform an initial scan and database for this host? (yes/no): y ←すぐに始めるならy
    scanning process was started on host: myclient01

    osiris-3.0.4-current:[/code]

    これでクライアントの設定が完了です。

    設定と同時に初期のデータベース登録と、最初のスキャンを始めているので上記の設定であれば、3時間毎に該当クライアントをスキャンして異常があれば、user@mydomain.comにメールで通知されることになります。

    対象ホストが複数ある場合には上記の手順を必要なだけ繰り返すことで、管理対象を増やすことができます。

    ■ [osiris]通知メールの詳細
    osirisが送信してくるメールを紹介しておきます。設定した項目がどこに反映されているかもわかりやすいと思うので確認してみてください。これはOSXServerにユーザを一人追加した際に送られてきたものです。

    ここに書かれたURLをクリックするとosirisの管理用マシンにブラウザでアクセスします。そして同じアラート内容が表示されますが、そのページの一番下に「accept」というボタンがあります。このボタンを押すとこの変更を確認したということで、データベースが更新されます。確認するまでosirisのスキャンが走る度に同じアラートを送り続けるようです(未確認)。

    また、このURLにアクセスするブラウザのIPアドレスはedit-mhostでauthorized hostsに登録する必要があるようです。*も使えるとありますが、うちでは機能しませんでした。:-(

    [code]From: osirismd@myhost
    Subject: scan log – [1 changes][host: myclient01]
    Date: 2004年2月11日 23:34:27:JST
    To: user@mydomain.com

    If these changes are approved, visit the URL below to set the latest scan database to be the trusted database. Or, login to the management console and set the trusted database to (2). If these notifications persist, you may need to modify the scan config for this host or set some comparison filters.

    compare time: Wed Feb 11 23:34:24 2004
    host: myclient01
    scan config: default.darwin
    log file: 5
    base db: 1
    compare db: 2

    [myclient01][new][user:testuser]

    Change Statistics:

    ———————————-

    checksums: 0
    SUID files: 0
    root-owned files: 0
    file permissions: 0
    new: 1
    missing: 0
    total differences: 1[/code]

    ※再掲載に当たって一部修正しています。

    , ,
    とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
    Loading...

    ■ [osiris]OSX用のおすすめ設定(WSMから本人投稿を再掲載 2004年2月)
    前回までに設定したマシンmyclient01はOS標準の検知設定になっています。OSX用は以下のように表示されます。設定の書式はapacheと似ていてわかりやすいです。(とドキュメントに書いてある):-)

    [code]osiris-3.0.4-current: host myclient01 ←osirisにログインしてhost xxxxとしてホスト設定に入る
    myclient01 is alive. ←該当ホストが有効になっていればaliveと表示される
    osiris-3.0.4-current[myclient01]: print-config ←print-configで現在の設定が表示される
    config name: default.darwin ←OSX用のデフォルト
    ID: 8850eba9
    status: valid
    errors: 0
    warnings: 0
    lines: 43

    ——–begin config file ——–

    Recursive no ←ディレクトリをたどっていかない
    FollowLinks no ←リンクをたどっていかない
    IncludeAll ←全ての項目をチェック
    Hash sha ←ハッシュにはshaを使う
     ←システム項目に関する設定開始
     Include users ←ユーザの追加削除をチェック
     Include groups ←グループの追加削除をチェック
     Include kexts ←機能拡張の追加削除をチェック
     ←システム項目の設定終了
     ←/ディレクトリに関する設定開始
     Recursive no ←/ディレクトリだけを見ます
     Include file( “mach_kernel” ) ←/mach_kernelのファイルだけを見ます

     ←/private/var/rootディレクトリに関する設定開始
     Recursive yes ←/private/var/rootディレクトリ以下もたどって見ます
     Include executable ←実行形式のファイルだけを見ます(推測)
     Include suid ←suidされたファイルだけを見ます(推測)


     IncludeAll ←全ての項目をチェック


     IncludeAll


     IncludeAll


     IncludeAll


     IncludeAll


     IncludeAll


     IncludeAll

    # EOF

    ——– end config file ——–[/code]

    OSXではApplicationフォルダにファイルが追加されることが多いのでその設定を加えるためには、上記に以下の設定を追加すればOKです。

    [code]
     IncludeAll

    [/code]
    設定を追加する時には以下のようにします。

    [code]osiris-3.0.4-current[myclient01]: edit-config ←編集コマンド(必ずホスト設定にいないといけないです)[/code]

    こうするとviエディタの画面になり上記の設定が表示され編集できます。編集を終えてviを終了すると以下の表示が出て完了します。
    [code]
    config file changed, updating…

    the config: (default.darwin) was succesfully updated.
    [/code]
    ■ [osiris]Filterの設定
    この状態でそのまま運用しても大きな問題はないんでしょうが、時々気になることが起きます。それは/usr/binや/usr/sbinのほとんどファイルでctimeが異なるという検知結果を送ってくることです。

    これを出ないようにするためにはfilterの設定を行います。osirisではホスト設定にfilterがあるのではなく、osirisのマネージャ設定(mhost)側にfilterを書くのでちょっとわかりにくい感じがします。

    filterは最初は何も登録されていないので、以下のコマンドから始めます。
    [code]
    osiris-3.0.4-current: edit-filter  ←フィルタ編集コマンド

    s) show current filters. ←現在のフィルタを表示するには「s」を入力
    a) add a new filter. ←フィルタを追加するには「a」を入力
    r) remove filter. ←フィルタを削除するには「r」を入力
    q) quit ←フィルタ設定を終了します

    > a ←追加なので「a」とします

    > host (*=all hosts): * ←どのホストに適用するフィルタかホスト名で指定します
    > path (*=any path): /Applications ←どのパスに適用するフィルタかフルパスで指定します

    1) Include Only (monitor changes only to certain attributes) ←標準監視設定の一部だけを有効にしたい場合こちらを選択します
    2) Exclude (ignore changes to certain attributes) ←標準監視設定の一部を無効にしたい場合こちらを選択します
    > filter type: [2] 2 ←今回は標準監視設定のctimeだけを無効にするのでこちらを選択します

    csum – checksum ←チェックサム
    device – device number ←デバイスナンバー(割り当てたネットワークカードが変わったりすると出ます)
    inode – inode number ←inodeナンバー(HD上の記録位置)
    perm – permissions (mode) ←アクセス権
    links – number of hard links ←ハードリンクの数
    uid – user ID ←ユーザID
    gid – group ID ←グループID
    mtime – last modification time ←最後に更新された時間
    atime – last access time ←最後にアクセスされた時間
    ctime – last change time ←最後に変化した時間???
    dtype – device type ←デバイスタイプ(よくわかりません)
    bytes – number of bytes ←ファイルの大きさ(バイト数)
    blocks – number of blocks ←ファイルの大きさ(ブロック数)
    bsize – block size ←ブロックのサイズ
    osid – owner SID ←オーナーのセキュリティ識別子
    gsid – group SID ←グループのセキュリティ識別子
    fileattr – windows file attributes ←Windowsのファイル情報
    new – not in trusted database ←新規に追加されたファイル
    missing – not present in latest scan ←削除されたファイル

    > attributes (comma separated): ctime  ←今回はctimeだけ除外します(複数ある場合はカンマで区切って書きます)

    does this look correct:
    ==> host=*;path=/Applications;exclude: ctime ; (y/n)? y ←確認されるので良ければy

    filter added. ←無事追加されました
    [/code]
    こうして追加されたフィルタは上記で設定されたルールで各ホストに適用されます。

    具体的には以下のような設定を持つホストの場合、

    [code]
     IncludeAll
    [/code]

    本来であれば以下の項目全てがチェックされますが

    [code]csum – checksum
    device – device number
    inode – inode number
    perm – permissions (mode)
    links – number of hard links
    uid – user ID
    gid – group ID
    mtime – last modification time
    atime – last access time
    ctime – last change time
    dtype – device type
    bytes – number of bytes
    blocks – number of blocks
    bsize – block size
    osid – owner SID
    gsid – group SID
    fileattr – windows file attributes
    new – not in trusted database
    missing – not present in latest scan[/code]

    filterを設定したのでctimeだけはチェックされなくなるということです。逆に特定の項目だけチェックしたい場合は以下のようにします。(/Applicationに入るアプリの増減やアクセス権だけチェックしたいとか)

    [code]> filter type: [2] 1 
    > attributes (comma separated): new,missing,perm,uid,gid

    does this look correct:
    ==> host=*;path=/Applications;include: new,missing,perm,uid,gid ; (y/n)? y[/code]

    これでOKです。

    ■ [osiris]管理コンソールの証明書の更新
    1年前に設定してこれまで問題なく動作していたosirismdが急にこんなメールアラートが出て動作しなくなりました。

    [code]Subject: failed to start scheduled scan [host: myhost]
    Date: Tue, 12 Apr 2005 18:22:51 +0900
    From: “Osiris IDS”
    To: mymailaddress
    host: myhost

    scheduled scan time: Tue Apr 12 15:00:03 2005
    The scheduler produced the following error message:
    session key negotiation failed.[/code]

    何が起きたのか調べてみたところ、osirisをインストールした際に生成された証明書が1年で期限切れになっているらしいことがわかりました。この状態でosirisにログインしようとすると以下のようなエラーになります。

    [code]Osiris command line management utility – version 3.0.4-current
    authenticating to (myhost)

    User: admin
    Password:

    WARNING : certificate authentication failed. The certificate
    presented by the mangaement host (localhost) was not signed by
    the root cert loaded from (/Users/username/.osiris/osiris_root.pem).

    [ presented certificate ]

    issuer = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    subject = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    untrusted MD5 fingerprint: 16:27:02:E6:4E:B9:36:EB:24:DA:C2:5B:F8:xx:xx:xx.

    If you trust this certificate, delete the root cert and start
    this application again.[/code]

    この問題に対処するためには以下の操作を行ないます。

    [code]$ sudo mv /usr/local/osiris/certs/osirismd.crt /usr/local/osiris/certs/old_osirismd.crt
    $ sudo SystemStarter restart “Osiris IDS”[/code]

    このコマンドを入力すると以下のような表示が出ます。

    [code]
    Welcome to Macintosh.
    Osiris Management daemon stopped.
    Osiris Scanning daemon stopped.
    Starting osiris management daemon.
    unable to load server certificate (/usr/local/osiris/certs/osirismd.crt)

    ==> creating one.

    Generating RSA key, 2048 bit long modulus.
    ………+++
    ……………………………………Waiting for Osiris Host Intrusion Detection System
    ……………………………………………………….Waiting for Osiris Host Intrusion Detection System
    ………………+++

    Starting osiris scanning daemon.
    Startup complete.
    Hangup[/code]

    これで新しい管理用証明書が作成されました。

    ■ [osiris]ログインユーザの証明書の更新
    上記の操作をやった後にosirisのadminを操作しようとするユーザのホームディレクトリにある.osirisフォルダ内のosiris_root.pemファイルを削除する必要があります。

    [code]$ rm -f 〜/.osiris/osiris_root.pem[/code]

    これをやっておかないとosirisにadminでログインできません。更にもうひとつ/usr/local/osiris/にあるosiris_root.pemも削除しておきます。

    [code]$ sudo rm -f /usr/local/osiris/osiris_root.pem[/code]

    これらの作業をやった後にadminでログインするようにしてください。

    ■ [osiris]チェック対象マシンの各host毎の証明書の更新
    これまでの設定だけではosirismdへのログインはできますがhost設定をしようとすると以下のエラーになり接続することができません。

    [code]osiris-3.0.4-current: host RemoteServer
    error: session key negotiation with remote host failed.
    [/code]

    これを回避するためにはhostで設定したRemoteServerにsshでログインして以下の操作をしてください。

    [code]$ sudo mv /usr/local/osiris/osiris_root.pem /usr/local/osiris/old_osirisroot.pem
    $ sudo SystemStarter restart “Osiris IDS”
    [/code]

    この操作をした上でosirismdにadminでログインして以下の操作をします。

    [code]osiris-3.0.4-current: host RemoteServer

    RemoteServer is alive.
    osiris-3.0.4-current[RemoteServer]: status

    [ current status of host: RemoteServer ]
    current time: Thu Apr 14 13:59:49 2005
    up since: Thu Apr 14 13:59:07 2005
    daemon status: idle.
    config status: no config present. ←設定ファイルが消えているので注意
    osiris version: 3.0.4-current
    OS: Darwin 7.8.0

    osiris-3.0.4-current[RemoteServer]: push-config ←設定ファイルをPushする

    the config: (default.darwin) was succesfully pushed to host: RemoteServer

    osiris-3.0.4-current[RemoteServer]: status

    [ current status of host: RemoteServer ]
    current time: Thu Apr 14 14:00:47 2005
    up since: Thu Apr 14 13:59:07 2005
    last config push: Thu Apr 14 14:00:35 2005
    configuration id: cc4f6e68
    daemon status: idle.

    config status: current config is valid. ←設定ファイルが有効になった

    osiris version: 3.0.4-current
    OS: Darwin 7.8.0

    osiris-3.0.4-current[RemoteServer]: start-scan ←スキャンを実行

    scanning process was started on host: RemoteServer  ←スキャン成功
    [/code]

    ここまでやって証明書の更新が完了になります。

    ※再掲載に当たって一部修正しています。

    , ,
    とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
    Loading...