[Server] Tripwire

インストール

# wget http://jaist.dl.sourceforge.net/sourceforge/tripwire/tripwire-2.4.1.1-src.tar.bz2

# tar jxvf tripwire-2.4.1.1-src.tar.bz2
# cd tripwire-2.4.1.1

twadmin -m G -S /etc/tripwire# vi install/install.cfg

TWPOLICY="/etc/tripwire"
TWDB="/var/lib/tripwire"

# ./configure
# make
# make install

設定

# vi /etc/tripwire/twpolmake.rb

#!/usr/bin/env ruby

in_rule = false;
ARGF.each do |line|
  line.chomp!
  if line =~ /^\{/
    in_rule = true
  elsif line =~ /^\}/
    in_rule = false
  elsif in_rule and line =~ /^(\s*\#?\s*)(\/\S+)\b(\s+->\s+.+)$/
    sharp = $1
    path = $2
    cond = $3
    if File.exist?(path)
      line = "#{sharp.gsub(/\#/, '')}#{path}#{cond}"
    else
      line = "#{sharp}\##{path}#{cond}" if sharp !~ /\#/
    end
  end
  puts line
end
最適化

# cat /etc/tripwire/twpol.txt | ruby /etc/tripwire/twpolmake.rb > /etc/tripwire/twpol.txt.new

# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt.new

DB作成

# tripwire -m i -s -c /etc/tripwire/tw.cfg
# rm -f /etc/tripwire/*.txt

定期ファイル作成

# vi tripwire.sh

#!/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/bin

# パスフレーズ設定
LOCALPASS=******** # ローカルキーファイルパスフレーズ
SITEPASS=********  # サイトキーファイルパスフレーズ
MAILTO=root        # チェック結果をメールで送る際の送信先

cd /etc/tripwire

# Tripwireチェック実行
tripwire -m c -s -c tw.cfg|mail -s "Tripwire(R) Integrity Check Report in `hostname`" $MAILTO

# ポリシーファイル最新化
twadmin -m p -c tw.cfg -p tw.pol -S site.key | ruby twpolmake.rb > twpol.txt.new
twadmin -m P -c tw.cfg -p tw.pol -S site.key -Q $SITEPASS twpol.txt.new > /dev/null
rm -f twpol.txt*
rm -f *.bak

# データベース最新化
rm -f /var/lib/tripwire/*.twd*
tripwire -m i -s -c tw.cfg -P $LOCALPASS

# chmod 700 tripwire.sh
# mv tripwire.sh /etc/cron.daily

[PHP] Symfony 動作[1]

1.${project_root}\apps\${app_name}\modules\${module_name}\actions\actions.class.phpに追加


public function executeMyAction()
{
$today = getdate();
$this->hour = $today['hours'];
}
2.${project_root}\apps\${app_name}\modules\${module_name}\templates\にmyActionSuccess.phpを作成

 <p>Hello, world!</p>
 <?php if ($hour >= 18): ?>
 <p>Or should I say good evening? It's already <?php echo $hour ?>.</p>
 <?php endif; ?>

3.http://localhost/${app_name}_dev.php/${module_name}/myAction

Hello, world!

Or should I say good evening? It's already 21.

[PHP] Symfony インストール

インストール

# pear install http://phing.info/pear/phing-current.tgz
# pear channel-discover pear.symfony-project.co
# pear install symfony/symfony

プロジェクトのセットアップ

# mkdir test
# cd test
# symfony init-project test

アプリケーションのセットアップ

#symfony init-app myapp

WEBServerのSetUp

httpd.confに追加

モジュールのセットアップ

# symfony init-module test testmodule
http://xxxx.com/index.php/testmoduleにアクセス

WEBアプリケーションフレームワーク

[Ruby]
Ruby on Rails
http://www.rubyonrails.org/


[Python]
django
http://www.djangoproject.com/

turbogears
http://www.turbogears.org/

[Perl]
catalyst
http://www.catalystframework.org/

[PHP]
maple [PHP4,5]
http://kunit.jp/maple/

symfony [PHP5]
http://www.symfony-project.com/