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

■インストールと簡単な使い方

  1. # yum install aide
  2.  
  3. 設定編集(コメント充実)
  4. # vi /etc/aide.conf
  5. R = p+l+i+n+u+g+s+m+acl+selinux+xattrs+md5
  6.  
  7. 初期化
  8. # aide -i
  9.  
  10. 比較用DB作成
  11. # cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
  12.  
  13. 比較
  14. # aide -C
  15.  
  16. 通常用途
  17. # aide -u

■CentOS5系でselinuxで問題が出るケースの設定変更例

  1. # vi /etc/aide.conf
  2.  
  3. R = p+l+i+n+u+g+s+m+acl+xattrs+md5
  4. L = p+l+i+n+u+g+acl+xattrs
  5. > = p+l+u+g+i+n+S+acl+xattrs
  6.  
  7. DIR = p+l+i+n+u+g+acl+xattrs
  8.  
  9. PERMS = p+l+i+u+g+acl
  10.  
  11. DATAONLY =  p+l+n+u+g+s+acl+xattrs+md5+sha256+rmd160+tiger

■Prelink関連のエラーが出る場合の設定変更例

  1. # sed -i '/^PRELINKING=yes$/s/yes/no/' /etc/sysconfig/prelink
  2. # /usr/sbin/prelink -ua

■cron用script例

  1. # vi /root/script/aide.sh
  2. #!/bin/bash
  3.  
  4. /usr/sbin/aide -u
  5. /bin/cp -fr /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz

■MyNETS用改竄検知設定例(/var/www/sns/wwwをSNS rootとする)

  1. # vi /etc/aide.conf
  2. # MyNETS SNS DIR
  3. /var/www/sns/www NORMAL
  4. !/var/www/sns/www/img
  5. !/var/www/sns/www/var

■参考リンク
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用には以下のオプションを適用すると面倒が少なくていいと思います。

  1. ./configure --prefix=/usr --with-trusted=0,1,501

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

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

  1. make
  2. sudo make install

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

  1. sudo vi /etc/samhainrc

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

  1. sudo /usr/local/sbin/samhain -t init

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

  1. sudo /usr/local/sbin/samhain -t check -D

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をアプリケーションにして自動ログイン設定したユーザの起動項目に設定。

    1. tell application "Finder"
    2.  activate
    3.  delay 30
    4.  restart
    5. end tell

    実際には再起動回数を把握するための項目も入ってるんだけど、稚拙すぎなので省略(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
    ダウンロードしたファイルを展開する。

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

    まずはconfigureオプションの調査だが、最新版ももちろんOSX標準対応なのでオプションは特に不要。

    1. $ ./configure
    2. (中略)
    3. Osiris (c) 2000-2005 The Shmoo Group (TSG)
    4.  -----------------------------------------------------
    5.  
    6.  ==> Configuration Complete.
    7.  ==> Osiris has been configured with the following options:
    8.  
    9.                   Host: powerpc-apple-darwin8.0.0
    10.               Compiler: gcc
    11.         Compiler flags: -Wall -g -O2
    12.     Preprocessor flags:
    13.           Linker flags:
    14.              Libraries: -lpthread  -lssl -lcrypto -lresolv
    15.    Privlege Separation: yes
    16.           SSL Location: (system)
    17.  Osiris Root Directory: /usr/local/osiris
    18.            Osiris user: osiris
    19.    Osiris MD Directory: /usr/local/osiris
    20.         Osiris MD user: osiris
    21.   Osiris MD config dir: /usr/local/osiris
    22.  
    23. ======================================
    24.  Found Scan Agent Modules:
    25.  
    26.     ==> mod_groups
    27.     ==> mod_kmods
    28.     ==> mod_ports
    29.     ==> mod_users
    30. ======================================
    31.  
    32.  ==> use one of the following targets:
    33.  
    34.            all:   make everything, agent, CLI and management console.
    35.          agent:   create scan agent installer package.
    36.        console:   create management console installer package.
    37.        install:   run installation script.
    38.          clean:   remove object files.

    これでconfigure完了。

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

    1. $ make console
    2. (中略)
    3.  -------------------------------------------------------------------------
    4. building release tarball: src/install/osiris-console-4.1.8-release-powerpc-Darwin-8.0.0.tar
    5. installer package contents:
    6. total 3744
    7.  -rw-r--r--    1 username  username    5130 Apr 30 12:11 LICENSE
    8. drwxr-xr-x   17 username  username     578 Apr 30 12:11 configs
    9. drwxr-xr-x    5 username  username     170 Apr 30 12:11 darwin
    10.  -rwxr-xr--    1 username  username   31187 Apr 30 12:11 install.sh
    11.  -rwxr-xr-x    1 username  username  863568 Apr 30 12:11 osiris
    12.  -rwxr-xr-x    1 username  username  125152 Apr 30 12:11 osirisd
    13.  -rwxr-xr-x    1 username  username  877192 Apr 30 12:11 osirismd
    14.  -rw-r--r--    1 username  username      80 Apr 30 12:11 version.h
    15.  -------------------------------------------------------------------------
    16. installer package created.

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

    1. $ make agent
    2. (中略)
    3.  -------------------------------------------------------------------------
    4. building release tarball: src/install/osiris-agent-4.1.8-release-powerpc-Darwin-8.0.0.tar
    5. installer package contents:
    6. total 336
    7.  -rw-r--r--   1 username  username    5130 Apr 30 12:13 LICENSE
    8. drwxr-xr-x   5 username  username     170 Apr 30 12:13 darwin
    9.  -rwxr-xr--   1 username  username   31187 Apr 30 12:13 install.sh
    10.  -rwxr-xr-x   1 username  username  125152 Apr 30 12:13 osirisd
    11.  -rw-r--r--   1 username  username      80 Apr 30 12:13 version.h
    12.  -------------------------------------------------------------------------
    13. installer package created.

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

    1. $ tar zxvf ./osiris*
    2. $ cd osiris*
    3. $ sudo ./install.sh

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

    1. $ make all
    2. (中略)
    3. Build Successful!
    4.  
    5. To create management console install package: 'make console'
    6. To create scan agent install package: 'make agent'
    7.  
    8. Documentation is also online at: http://osiris.shmoo.com

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

    1. $ sudo make install

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

    1. $ sudo make install
    2.  
    3. We trust you have received the usual lecture from the local System
    4. Administrator. It usually boils down to these three things:
    5.  
    6.     #1) Respect the privacy of others.
    7.     #2) Think before you type.
    8.     #3) With great power comes great responsibility.
    9.  
    10. Password:  ←管理者パスワード
    11. (中略)
    12. Continue with installation? (y/n) [y]   ←インストール継続の確認
    13. Osiris Scanning Daemon Version
    14. 4.1.8-release
    15.  
    16. "4.1.8-release" for Darwin 8.0.0
    17. Copyright (c) 2005 Brian Wotring. All Rights Reserved.
    18.  
    19.  
    20. This installation was configured and built to run as osiris
    21.      agent user name: osiris
    22. management user name: osiris
    23.  
    24. This installation was configured and built to use osiris
    25.      agent root directory: /usr/local/osiris
    26. management root directory: /usr/local/osiris
    27.  
    28. The username and directory will be created during the
    29. installation process if they do not already exist.
    30.  
    31. By installing this product you agree that you have read the
    32. LICENSE file and will comply with its terms.
    33.  
    34.  ---------------------------------------------------------------------
    35.  
    36. ==> creating user and group (osiris, osiris).
    37. ==> creating Osiris user and group with uid/gid 502.
    38. ==> group 'osiris' added.
    39. ==> user 'osiris' added.
    40. ==> using existing Osiris management console user.
    41. Install osiris agent? (y/n) [y]   ←クライアントのインストール確認
    42. Install management console? (y/n) [y]   ←コンソールのインストール確認
    43. Install CLI? (y/n) [y]    ←コマンドラインのインストール確認
    44. Installation directory for binaries: [/usr/local/sbin]  ←インストール先確認
    45. Installation directory doesn't exist, creating.
    46. ==> installed osiris CLI: /usr/local/sbin/osiris
    47. Osiris scan agent root directory doesn't exist, creating.
    48. ==> installed scan agent: /usr/local/sbin/osirisd
    49. ==> installed management console /usr/local/sbin/osirismd
    50. ==> installed default scan configs.
    51. ==> updated: /etc/hostconfig --> OSIRISSERVER=-YES-
    52. ==> installing StartupItem for the Osiris Scan Agent.
    53. ==> installed /System/Library/StartupItems/Osiris/Osiris
    54. ==> change owner and  permissions on /usr/local/sbin/osiris
    55.  -rwxr-xr-x   1 root  wheel  1412536 Apr 30 12:26 /usr/local/sbin/osiris
    56. ==> change owner and permissions on /usr/local/sbin/osirisd
    57.  -rwxr-xr-x   1 root  wheel  483060 Apr 30 12:26 /usr/local/sbin/osirisd
    58. ==> change owner permissions on /usr/local/sbin/osirismd
    59.  -rwsr-xr-x   1 osiris  osiris  1721788 Apr 30 12:26 /usr/local/sbin/osirismd
    60.  
    61. ==================================================================
    62. Osiris has been installed, but is not currently running.  Startup
    63. scripts have been installed so that the necessary services will
    64. be started on boot.
    65.  
    66. Start management console now? (y/n) [y]   ←コンソール起動確認
    67. osirismd: missing configuration file,
    68.   ==> created default in: /usr/local/osiris/osirismd.conf.
    69. unable to load server certificate (/usr/local/osiris/certs/osirismd.crt)
    70.   ==> creating one.
    71. Generating RSA key, 2048 bit long modulus.
    72. ..................................................+++
    73. ..............................................................................+++
    74. Start scan agent now? (y/n) [y]   ←クライアントの起動確認
    75.  
    76. Documentation is included with this source and available online at:
    77.     http://osiris.shmoo.com/docs
    78.  
    79. (c) 2005 - Brian Wotring

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

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

    1. $ /usr/local/sbin/osiris
    2. Osiris Shell Interface - version 4.1.8-release
    3. unable to load root certificate for management host:
    4. (/Users/username/.osiris/osiris_root.pem)
    5.  >>> fetching root certificate from management host (127.0.0.1).
    6.  
    7. The authenticity of host '127.0.0.1' can't be established.
    8.  
    9.   [ server certificate ]
    10.  
    11.  subject = /C=US/CN=Osiris Management Console/OU=Osiris Host Integrity System
    12.  issuer  = /C=US/CN=Osiris Management Console/OU=Osiris Host Integrity System
    13.  
    14.             key size: 2048 bit
    15.       MD5 fingerprint: 30:87:07:74:08:7B:5D:83:52:FD:63:6F:6B:32:5F:7D
    16.  
    17. Verify the fingerprint specified above.
    18. Are you sure you want to continue connecting (yes/no)? yes ←設定を続けるか確認
    19.  >>> authenticating to (127.0.0.1)
    20.  
    21. User: admin ←管理者は「admin」でログインする
    22. Password:  ←最初は設定されていないのでリターンキー
    23.  
    24. connected to management console, code version (4.1.8-release).
    25. hello.
    26.  
    27. WARNING: your password is empty, use the 'passwd' command
    28. to set your password.
    29.  
    30. osiris-4.1.8-release: passwd ←まずはadminのパスワードを設定
    31. User: admin
    32. Password:  ←管理用パスワードを入力 確認がないので注意
    33.  >>> user: (admin) updated.

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

    1. osiris-4.1.8-release: ?    
    2.  
    3. [ Management Commands ]
    4.     mhost              host             new-user         edit-filters
    5.     edit-mhost         edit-host        edit-user        print-filters
    6.     print-mhost-config list-hosts       list-users                    
    7.     test-notify        new-host         delete-user      test-filter
    8.  
    9. [ Host commands ]
    10.     status              list-configs      start-scan    list-db        
    11.     watch-host          new-config        stop-scan     baseline      
    12.     disable-host        push-config       print-log     set-baseline  
    13.     host-details        edit-config       list-logs     print-db      
    14.     print-host-config   print-config                    print-db-errors
    15.     rm-host             rm-config                       print-db-header
    16.     init                drop-config                     rm-db          
    17.     config              verify-config                   unset-baseline
    18.  
    19. [ Misc commands ]
    20.     help                version           quit              ssl
    21.  
    22.   For help with a specific command, try: help <command>

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

    1. osiris-4.1.8-release: edit-mhost
    2.  
    3. [ edit management host (127.0.0.1) ]
    4.  
    5.   > syslog facility [DAEMON]:
    6.   > control port [2266]:
    7.   > http control port [0]: 10080
    8.   > notify email (default for hosts) []: username@yourdomain.com
    9.   > notification smtp host [127.0.0.1]: smtp.yourdomain.com
    10.   > notification smtp port [25]:
    11.  
    12.   > authorized hosts:
    13.  
    14.    127.0.0.1
    15.  
    16.   Modify authorization list (y/n)? [n]
    17.  
    18. [ management config (127.0.0.1) ]
    19.  
    20. syslog_facility = DAEMON
    21. control_port = 2266
    22. http_port = 10080
    23. http_host =
    24. notify_email = username@yourdomain.com
    25. notify_app =
    26. notify_smtp_host = smtp.yourdomain.com
    27. notify_smtp_port = 25
    28. hosts_directory =
    29. allow = 127.0.0.1
    30.  
    31.  
    32. Is this correct (y/n)? y
    33.  >>> management host configuration has been saved.

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

    1. osiris-4.1.8-release: new-host
    2.  
    3. [ new host ]
    4.  
    5.   > name this host []:  myhost
    6.   > hostname/IP address []: 127.0.0.1
    7.   > description []: iMacG4
    8.   > agent port [2265]:
    9.   > enable log files for this host? (yes/no) [no]:    
    10.  
    11. Scan Databases:
    12.  
    13.     => keep archives of scan databases?  Enabling this option means that the
    14.        database generated with each scan is saved, even if there are no changes
    15.        detected.  Because of disk space, this option is not recommended
    16.        unless your security policy requires it. (yes/no) [no]:
    17.  ↑スキャンDBをアーカイブしておくオプション
    18.  
    19.     => auto-accept changes?  Enabling this option means that detected
    20.        changes are reported only once, and the baseline database is
    21.        automatically set when changes are detected. (yes/no) [yes]:
    22.  ↑変更を自動承認する設定 これをnoにすると承認するまで変更通知メールが何度も来る
    23.  
    24.     => purge database store?  Enabling this option means that none
    25.        of the scan databases are saved.  That is, whenever the baseline
    26.        database is set, the previous one is deleted. (yes/no): [yes]:
    27.  ↑常に最新のスキャンDBだけで運用する設定
    28.  
    29. Notifications:
    30.  
    31.     => enable email notification for this host? (yes/no) [no]: yes
    32.     => send notification on scheduled scans failures? (yes/no) [no]: yes
    33.     => send scan notification, even when no changes detected  (yes/no) [no]:
    34.     => send notification when agent has lost session key  (yes/no) [no]: yes
    35.     => notification email (default uses mhost address) []:
    36.  
    37. Scheduling:
    38.  
    39.   > configure scan scheduling information? (yes/no) [no]: yes
    40.  
    41.     [ scheduling information for myhost ]
    42.  
    43.     Scheduling information consists of a start time and a frequency value.
    44.     The frequency is a specified number of minutes between each scan, starting
    45.     from the start time.  The default is the current time.  Specify the start
    46.     time in the following format: mm/dd/yyyy HH:MM
    47.  
    48.     enter the start date and time
    49.     using 'mm/dd/yyyy HH:MM' format: [Sat Apr 30 13:07:15 2005]
    50.     enter scan frequency in minutes: [1440] 720
    51.  
    52.   > enable this host? (yes/no) [yes]:
    53.  
    54. host                  => myhost
    55. hostname/IP address   => 127.0.0.1
    56. description           => iMacG4
    57. agent port            => 2265
    58. host type             => generic
    59. log enabled           => no
    60. archive scans         => no
    61. auto accept           => yes
    62. purge databases       => yes
    63. notifications enabled => yes
    64. notifications always  => no
    65. notify on rekey       => yes
    66. notify on scan fail   => yes
    67. notify email          => (management config)
    68. scans starting on     => Sat Apr 30 13:07:15 2005
    69. scan frequency        => every 720 minutes
    70. enabled               => yes
    71.  
    72. Is this correct (y/n)? y
    73.  >>> new host (myhost) has been created.
    74. Initialize this host? (yes/no): yes
    75.  
    76. Initializing a host will push over a configuration, start
    77. a scan, and set the created database to be the
    78. trusted database.
    79.  
    80. Are you sure you want to initialize this host (yes/no): yes
    81.  
    82. OS Name: Darwin
    83. OS Version: 8.0.0
    84.  
    85. use the default configuration for this OS? (yes/no): yes
    86.  >>> configuration (default.darwin) has been pushed.
    87.  >>> scanning process was started on host: myhost

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

    1. osiris-4.1.8-release: host myhost
    2. myhost is alive.
    3. osiris-4.1.8-release[myhost]: edit-config ←ここでviでの設定変更モードになる
    4.  >>> configuration file has changed, updating...
    5.  >>> configuration: (default.darwin) has been updated.
    6. osiris-4.1.8-release[myhost]: push-config  ←ここで設定変更をホストに反映する
    7.  >>> the configuration: (default.darwin) has been pushed to host:  myhost
    8. osiris-4.1.8-release[myhost]: print-config ←設定内容を表示
    9.  
    10.  config name:  default.darwin
    11.           ID:  946090b8
    12.       status:  valid
    13.       errors:  0
    14.     warnings:  0
    15.        lines:  57
    16.  
    17.  -------- begin config file --------
    18.  
    19. # Default Configuration for Mac OS X.
    20. Recursive   no
    21. FollowLinks no
    22. IncludeAll
    23. Hash md5
    24. <System>
    25. Include mod_users
    26. Include mod_groups
    27. Include mod_kmods
    28. </System>
    29. <Directory />
    30. Recursive no
    31. Include file( "mach_kernel" )
    32. </Directory>
    33. <Directory /private/var/root>
    34. Recursive yes
    35. Include executable
    36. </Directory>
    37. <Directory /bin>
    38. IncludeAll
    39. </Directory>
    40. <Directory /usr/bin>
    41. IncludeAll
    42. </Directory>
    43. <Directory /usr/local/bin>
    44. IncludeAll
    45. </Directory>
    46. <Directory /usr/local/sbin>
    47. IncludeAll
    48. </Directory>
    49. <Directory /sbin>
    50. IncludeAll
    51. </Directory>
    52. <Directory /usr/sbin>
    53. IncludeAll
    54. </Directory>
    55. <Directory /etc>  ←ここから追加分
    56. Recursive yes
    57. IncludeAll
    58. </Directory>
    59. <Directory /Applications>
    60. Recursive yes
    61. IncludeAll
    62. </Directory>
    63. <Directory /Users/username>
    64. Recursive yes
    65. IncludeAll
    66. </Directory>  ←ここまで
    67. # EOF
    68.  
    69.  --------  end config file  --------

    ■ [osiris]Filter設定の追加

    1. osiris-4.1.8-release: edit-filters  ←ここからviで設定を編集(ウィザードは廃止された)
    2.  >>> comparison filters have been saved.
    3. osiris-4.1.8-release: print-filters  ←設定を表示
    4. Exclude anything matching the following regular expressions:
    5.  
    6. host=*;path=*;exclude: device ctime ;  ←Filterの書式は3.xから変更なし
    7. host=*;path=/etc;include only: perm uid gid new missing ;
    8. host=*;path=/Applications;include only: perm uid gid new missing ;
    9. host=*;path=/Users/username;include only: perm uid gid new missing ;
    10.  
    11. 4 comparison filters.
    , ,
    とりあえず付けておく無駄ではなかったなまぁまぁ読めたちょっと役に立ったかなかなり良かったかも (まだ評価されていません)
    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をダウンロードして展開します。

    1. $tar -zxvf osiris-3.0.4-current.tar.gz

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

    1. $cd osiris-3.0.4-current
    2. $./configure

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

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

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

    1. $make all
    2. $sudo make install

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

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

    1. No Osiris user or group exists, determined uid/gid is: 502
    2. Continue with installation? (y/n)

    osirisのユーザをシステムに新規作成します。続けてよければyとします。

    1. Install management console? (y/n)

    マネジメントコンソールをインストールします。こちらもyとします。

    1. Installation directory for binaries: [/usr/sbin/]

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

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

    1. Start management console now? (y/n)

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

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

    1. Start scan agent now? (y/n)

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

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

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

    1. $make clean
    2. $sudo make package

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

    1. osiris-3.0.4-current.Darwin.tar.gz

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

    1. $tar -zxvf osiris-3.0.4-current.Darwin.tar.gz
    2. $cd osiris-3.0.4-current
    3. $sudo ./install.sh

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

    1. Start scan agent now? (y/n)

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

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

    1. $ ps aux | grep osiris
    2.  
    3. osiris 14611 0.0 0.2 29116 876 p1 S 6:01PM 0:00.01 /usr/sbin/osirismd
    4. osiris 14612 0.0 0.2 29116 1116 p1 S 6:01PM 0:00.05 /usr/sbin/osirismd
    5. root 14614 0.0 0.1 27812 784 p1 S 6:03PM 0:00.01 /usr/sbin/osirisd
    6. osiris 14615 0.0 0.2 27816 1280 p1 S 6:03PM 0:00.04 /usr/sbin/osirisd
    7. user 15481 0.0 0.3 28912 1824 p1 S+ 6:19PM 0:00.06 osiris
    8. user 15488 0.0 0.1 18172 344 std S+ 6:22PM 0:00.01 grep osiris

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

    1. $ osiris

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

    1. Osiris command line management utility - version 3.0.4-current
    2. unable to load root cert for management host:
    3. (/Users/username/.osiris/osiris_root.pem)
    4. fetching root certificate from management host (localhost).
    5. The authenticity of host 'localhost' can't be established.
    6.  
    7. [ server certificate ]
    8. subject = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    9. issuer = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    10. key size: 2048 bit
    11. MD5 fingerprint: AE:67:D1:27:F3:55:96:08:98:38:CA:04:86:A8:06:40
    12.  
    13. Verify the fingerprint specified above.
    14.  
    15. Are you sure you want to continue connecting (yes/no)?

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

    1. authenticating to (localhost)
    2. User:

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

    1. User: admin
    2. Password:

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

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

    1. connected to management daemon, code version (3.0.4-current).
    2. hello.
    3.  
    4. osiris-3.0.4-current:

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

    1. osiris-3.0.4-current:passwd admin

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

    1. osiris-3.0.4-current:passwd admin
    2. password:

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

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

    1. osiris-3.0.4-current:

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

    1. [ Managment Commands ]
    2. mhost host new-user edit-filters
    3. edit-mhost edit-host edit-user print-filters
    4. print-mhost-config list-hosts list-users
    5. test-notify new-host delete-user
    6.  
    7. [ Host commands ]
    8. status list-configs start-scan list-db
    9. watch-host import-config stop-scan base-db
    10. disable-host push-config set-base-db
    11. host-details edit-config list-logs print-db
    12. print-host-config print-config print-log print-db-errors
    13. rm-host rm-config print-db-header
    14. drop-config rm-db
    15. verify-config
    16. new-config
    17.  
    18. [ Misc commands ]
    19. help version quit ssl
    20. For help with a specific command, try: help <command>

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

    1. osiris-3.0.4-current: edit-mhost
    2.  
    3. [ edit management host (localhost) ]
    4. > syslog facility [DAEMON]:  ←リターンキー
    5. > syslog level [NOTICE]:  ←リターンキー
    6. > log intensity [LOW]:  ←リターンキー
    7. > control port [2266]:  ←標準でよければリターンキー
    8. > http host name (uses system name by default) []: myhost  ←管理マシンのホスト名
    9. > http control port [2267]:  ←標準でよければリターンキー
    10. > notification email []: user@mydomain.com  ←通知を受けたいメールアドレス
    11. > notification smtp host [127.0.0.1]: 192.168.0.10 ←メールサーバのIPアドレス
    12. > notification smtp port [25]:  ←リターンキー
    13. > authorized hosts:
    14.  
    15. 127.0.0.1
    16.  
    17. Modify authorization list (y/n)? [n]  ←管理ホストからだけ操作できればいいならリターンキー
    18.  
    19. [ management config (localhost) ]
    20. syslog_facility = DAEMON
    21. syslog_level = NOTICE
    22. log_intensity = LOW
    23. control_port = 2266
    24. http_port = 2267
    25. http_host = myhost
    26. notify_email = user@mydomain.com
    27. notify_smtp_host = 192.168.0.10
    28. notify_smtp_port = 25
    29. hosts_directory =
    30. allow = 127.0.0.1
    31.  
    32. Is this correct (y/n)? y ←よければリターンキー
    33.  
    34. management host config sucessfully saved.

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

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

    1. osiris-3.0.4-current: new-host
    2.  
    3. [ new host ]
    4. > name this host []: myclient01 ←クライアントのホスト名
    5. > hostname/IP address []: 192.168.0.101 ←クライアントのIPアドレス(管理用マシン自身を対象にするなら127.0.0.1でOK)
    6. > description []: PBG4 ←クライアントの説明(任意記述)
    7. > enable scan logging for this host? (yes/no) [no]: y ←logをとる場合にy
    8. > archive scan databases for this host? (yes/no) [no]:  ←スキャン毎の結果を保存したい場合にy
    9. > enable admin email notification for this host? (yes/no) [yes]:  ←メールでの通知が必要ならy
    10. > send scan notification, even when no changes detected (yes/no) [no]:  ←変化なしでも通知が必要ならy
    11. > notification email (default uses mhost address) []:  ←通知アドレスが管理用マシンの登録と同じでOKならリターンキー
    12. > configure scan scheduling information? (yes/no) [no]: yes  ←スキャンスケジュールを調整するならy(標準は1日毎)
    13.  
    14. [ scheduling information for myhost ]
    15. Scheduling information consists of a start time and a frequency value.
    16. The frequency is a specified number of minutes between each scan, starting
    17. from the start time. The default is the current time. Specify the start
    18. time in the following format: mm/dd/yyyy HH:MM
    19. enter the start date and time
    20.  
    21. using 'MM/DD/YYYY hh:mm' format: [Fri Feb 13 18:40:12 2004]  ←タイムスタンプフォーマット変更
    22. enter scan frequency in minutes: [daily (1440)] 180 ←1分単位で指定できます
    23. > activate this host? (yes/no) [no]: yes ←スキャンを有効にするならy
    24.  
    25. host => myclient01
    26. hostname/IP address => 192.168.0.101
    27. description => PBG4
    28. host type => generic
    29. log enabled => yes
    30. archive scans => no
    31. notifications enabled => yes
    32. notifications always => no
    33. notify email => (managment config)
    34. scans starting on => Fri Feb 13 18:40:12 2004
    35. scan frequency => every 180 minutes
    36. enabled => yes
    37.  
    38. Is this correct (y/n)? y ←設定内容がOKならy
    39. the new host (myhost) was sucessfully created.
    40. initialize this host? (yes/no): y  ←すぐに始めるならy(対象クライアントにosirisdが起動している必要あり)
    41.  
    42. Initializing a host will push over a config, start
    43. a scan, and set the created database to be the
    44. trusted database.
    45.  
    46. Are you sure you want to initialize this host (yes/no): y ←すぐに始めるならy(対象クライアントにosirisdが起動している必要あり)
    47.  
    48. OS Name: Darwin ←対象クライアントから自動判別
    49. OS Version: 7.2.0
    50.  
    51. use the default config for this OS? (yes/no): y ←該当OS用の標準設定でよければy
    52. The config: default.darwin has been pushed.
    53.  
    54. perform an initial scan and database for this host? (yes/no): y ←すぐに始めるならy
    55. scanning process was started on host: myclient01
    56.  
    57. osiris-3.0.4-current:

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

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

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

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

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

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

    1. From: osirismd@myhost
    2. Subject: scan log - [1 changes][host: myclient01]
    3. Date: 2004年2月11日 23:34:27:JST
    4. To: user@mydomain.com
    5.  
    6. 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.
    7.  
    8. <https://myhost:2267?action=v&host=myclient01&base_db=2&log=5>
    9.  
    10. compare time: Wed Feb 11 23:34:24 2004
    11. host: myclient01
    12. scan config: default.darwin
    13. log file: 5
    14. base db: 1
    15. compare db: 2
    16.  
    17. [myclient01][new][user:testuser]
    18.  
    19. Change Statistics:
    20.  
    21. ----------------------------------
    22.  
    23. checksums: 0
    24. SUID files: 0
    25. root-owned files: 0
    26. file permissions: 0
    27. new: 1
    28. missing: 0
    29. total differences: 1

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

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

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

    1. osiris-3.0.4-current: host myclient01 ←osirisにログインしてhost xxxxとしてホスト設定に入る
    2. myclient01 is alive. ←該当ホストが有効になっていればaliveと表示される
    3. osiris-3.0.4-current[myclient01]: print-config ←print-configで現在の設定が表示される
    4. config name: default.darwin ←OSX用のデフォルト
    5. ID: 8850eba9
    6. status: valid
    7. errors: 0
    8. warnings: 0
    9. lines: 43
    10.  
    11. --------begin config file --------
    12.  
    13. Recursive no ←ディレクトリをたどっていかない
    14. FollowLinks no ←リンクをたどっていかない
    15. IncludeAll ←全ての項目をチェック
    16. Hash sha ←ハッシュにはshaを使う
    17. <System> ←システム項目に関する設定開始
    18.  Include users ←ユーザの追加削除をチェック
    19.  Include groups ←グループの追加削除をチェック
    20.  Include kexts ←機能拡張の追加削除をチェック
    21. </System> ←システム項目の設定終了
    22. <Directory /> ←/ディレクトリに関する設定開始
    23.  Recursive no ←/ディレクトリだけを見ます
    24.  Include file( "mach_kernel" ) ←/mach_kernelのファイルだけを見ます
    25. </Directory>
    26. <Directory /private/var/root> ←/private/var/rootディレクトリに関する設定開始
    27.  Recursive yes ←/private/var/rootディレクトリ以下もたどって見ます
    28.  Include executable ←実行形式のファイルだけを見ます(推測)
    29.  Include suid ←suidされたファイルだけを見ます(推測)
    30. </Directory>
    31. <Directory /bin>
    32.  IncludeAll ←全ての項目をチェック
    33. </Directory>
    34. <Directory /usr/bin>
    35.  IncludeAll
    36. </Directory>
    37. <Directory /usr/local/bin>
    38.  IncludeAll
    39. </Directory>
    40. <Directory /sbin>
    41.  IncludeAll
    42. </Directory>
    43. <Directory /usr/sbin>
    44.  IncludeAll
    45. </Directory>
    46. <Directory /System/Library/StartupItems>
    47.  IncludeAll
    48. </Directory>
    49. <Directory /System/Library/Extensions>
    50.  IncludeAll
    51. </Directory>
    52.  
    53. # EOF
    54.  
    55. -------- end config file --------

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

    1. <Directory /Applications>
    2.  IncludeAll
    3. </Directory>

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

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

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

    1. config file changed, updating...
    2.  
    3. the config: (default.darwin) was succesfully updated.

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

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

    filterは最初は何も登録されていないので、以下のコマンドから始めます。

    1. osiris-3.0.4-current: edit-filter  ←フィルタ編集コマンド
    2.  
    3. s) show current filters. ←現在のフィルタを表示するには「s」を入力
    4. a) add a new filter. ←フィルタを追加するには「a」を入力
    5. r) remove filter. ←フィルタを削除するには「r」を入力
    6. q) quit ←フィルタ設定を終了します
    7.  
    8. > a ←追加なので「a」とします
    9.  
    10. > host (*=all hosts): * ←どのホストに適用するフィルタかホスト名で指定します
    11. > path (*=any path): /Applications ←どのパスに適用するフィルタかフルパスで指定します
    12.  
    13. 1) Include Only (monitor changes only to certain attributes) ←標準監視設定の一部だけを有効にしたい場合こちらを選択します
    14. 2) Exclude (ignore changes to certain attributes) ←標準監視設定の一部を無効にしたい場合こちらを選択します
    15. > filter type: [2] 2 ←今回は標準監視設定のctimeだけを無効にするのでこちらを選択します
    16.  
    17. csum - checksum ←チェックサム
    18. device - device number ←デバイスナンバー(割り当てたネットワークカードが変わったりすると出ます)
    19. inode - inode number ←inodeナンバー(HD上の記録位置)
    20. perm - permissions (mode) ←アクセス権
    21. links - number of hard links ←ハードリンクの数
    22. uid - user ID ←ユーザID
    23. gid - group ID ←グループID
    24. mtime - last modification time ←最後に更新された時間
    25. atime - last access time ←最後にアクセスされた時間
    26. ctime - last change time ←最後に変化した時間???
    27. dtype - device type ←デバイスタイプ(よくわかりません)
    28. bytes - number of bytes ←ファイルの大きさ(バイト数)
    29. blocks - number of blocks ←ファイルの大きさ(ブロック数)
    30. bsize - block size ←ブロックのサイズ
    31. osid - owner SID ←オーナーのセキュリティ識別子
    32. gsid - group SID ←グループのセキュリティ識別子
    33. fileattr - windows file attributes ←Windowsのファイル情報
    34. new - not in trusted database ←新規に追加されたファイル
    35. missing - not present in latest scan ←削除されたファイル
    36.  
    37. > attributes (comma separated): ctime  ←今回はctimeだけ除外します(複数ある場合はカンマで区切って書きます)
    38.  
    39. does this look correct:
    40. ==> host=*;path=/Applications;exclude: ctime ; (y/n)? y ←確認されるので良ければy
    41.  
    42. filter added. ←無事追加されました

    こうして追加されたフィルタは上記で設定されたルールで各ホストに適用されます。

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

    1. <Directory /Applications>
    2.  IncludeAll
    3. </Directory>

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

    1. csum - checksum
    2. device - device number
    3. inode - inode number
    4. perm - permissions (mode)
    5. links - number of hard links
    6. uid - user ID
    7. gid - group ID
    8. mtime - last modification time
    9. atime - last access time
    10. ctime - last change time
    11. dtype - device type
    12. bytes - number of bytes
    13. blocks - number of blocks
    14. bsize - block size
    15. osid - owner SID
    16. gsid - group SID
    17. fileattr - windows file attributes
    18. new - not in trusted database
    19. missing - not present in latest scan

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

    1. > filter type: [2] 1 
    2. > attributes (comma separated): new,missing,perm,uid,gid
    3.  
    4. does this look correct:
    5. ==> host=*;path=/Applications;include: new,missing,perm,uid,gid ; (y/n)? y

    これでOKです。

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

    1. Subject: failed to start scheduled scan [host: myhost]
    2. Date: Tue, 12 Apr 2005 18:22:51 +0900
    3. From: "Osiris IDS" <osirismd@myhost>
    4. To: mymailaddress
    5. host: myhost
    6.  
    7. scheduled scan time: Tue Apr 12 15:00:03 2005
    8. The scheduler produced the following error message:
    9. session key negotiation failed.

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

    1. Osiris command line management utility - version 3.0.4-current
    2. authenticating to (myhost)
    3.  
    4. User: admin
    5. Password:
    6.  
    7. WARNING : certificate authentication failed. The certificate
    8. presented by the mangaement host (localhost) was not signed by
    9. the root cert loaded from (/Users/username/.osiris/osiris_root.pem).
    10.  
    11. [ presented certificate ]
    12.  
    13. issuer = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    14. subject = /C=US/CN=Osiris Managment Daemon/OU=Osiris IDS
    15. untrusted MD5 fingerprint: 16:27:02:E6:4E:B9:36:EB:24:DA:C2:5B:F8:xx:xx:xx.
    16.  
    17. If you trust this certificate, delete the root cert and start
    18. this application again.

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

    1. $ sudo mv /usr/local/osiris/certs/osirismd.crt /usr/local/osiris/certs/old_osirismd.crt
    2. $ sudo SystemStarter restart "Osiris IDS"

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

    1. Welcome to Macintosh.
    2. Osiris Management daemon stopped.
    3. Osiris Scanning daemon stopped.
    4. Starting osiris management daemon.
    5. unable to load server certificate (/usr/local/osiris/certs/osirismd.crt)
    6.  
    7. ==> creating one.
    8.  
    9. Generating RSA key, 2048 bit long modulus.
    10. .........+++
    11. ..........................................Waiting for Osiris Host Intrusion Detection System
    12. ................................................................Waiting for Osiris Host Intrusion Detection System
    13. ..................+++
    14.  
    15. Starting osiris scanning daemon.
    16. Startup complete.
    17. Hangup

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

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

    1. $ rm -f 〜/.osiris/osiris_root.pem

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

    1. $ sudo rm -f /usr/local/osiris/osiris_root.pem

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

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

    1. osiris-3.0.4-current: host RemoteServer
    2. error: session key negotiation with remote host failed.

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

    1. $ sudo mv /usr/local/osiris/osiris_root.pem /usr/local/osiris/old_osirisroot.pem
    2. $ sudo SystemStarter restart "Osiris IDS"

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

    1. osiris-3.0.4-current: host RemoteServer
    2.  
    3. RemoteServer is alive.
    4. osiris-3.0.4-current[RemoteServer]: status
    5.  
    6. [ current status of host: RemoteServer ]
    7. current time: Thu Apr 14 13:59:49 2005
    8. up since: Thu Apr 14 13:59:07 2005
    9. daemon status: idle.
    10. config status: no config present. ←設定ファイルが消えているので注意
    11. osiris version: 3.0.4-current
    12. OS: Darwin 7.8.0
    13.  
    14. osiris-3.0.4-current[RemoteServer]: push-config ←設定ファイルをPushする
    15.  
    16. the config: (default.darwin) was succesfully pushed to host: RemoteServer
    17.  
    18. osiris-3.0.4-current[RemoteServer]: status
    19.  
    20. [ current status of host: RemoteServer ]
    21. current time: Thu Apr 14 14:00:47 2005
    22. up since: Thu Apr 14 13:59:07 2005
    23. last config push: Thu Apr 14 14:00:35 2005
    24. configuration id: cc4f6e68
    25. daemon status: idle.
    26.  
    27. config status: current config is valid. ←設定ファイルが有効になった
    28.  
    29. osiris version: 3.0.4-current
    30. OS: Darwin 7.8.0
    31.  
    32. osiris-3.0.4-current[RemoteServer]: start-scan ←スキャンを実行
    33.  
    34. scanning process was started on host: RemoteServer  ←スキャン成功

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

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

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