パッケージのディレクトリを追加します。
$ grep ^PORTDIR_OVERLAY /etc/make.conf
PORTDIR_OVERLAY="${PORTDIR_OVERLAY} /usr/local/portage/test"ebuildファイルを追加します。
$ diff /usr/portage/sys-apps/ccs-tools/ccs-tools-1.8.0_p20110214.ebuild ccs-tools-1.8.1_p20110511.ebuild
28c28
< epatch "${FILESDIR}/${P}-parallel.patch"
---
> #epatch "${FILESDIR}/${P}-parallel.patch"Manifestを作成します。
$ sudo ebuild ccs-tools-1.8.1_p20110511.ebuild manifest
ファイルの一覧。
$ find /usr/local/portage/test/sys-apps/ccs-tools /usr/local/portage/test/sys-apps/ccs-tools /usr/local/portage/test/sys-apps/ccs-tools/ccs-tools-1.8.1_p20110511.ebuild /usr/local/portage/test/sys-apps/ccs-tools/Manifest /usr/local/portage/test/sys-apps/ccs-tools/files
インストールします。
$ sudo ACCEPT_KEYWORDS="**" emerge -avt ccs-tools
成功しました。
$ eix -c ccs-tools [D] sys-apps/ccs-tools (1.8.1_p20110511[?]@2011年06月11日 -> ??): TOMOYO Linux tools [1] /usr/local/portage/test
正常に動くかどうかは不明です。
同じソフトか似ているソフトのebuildファイルをベースに使えばインストールだけは大丈夫そうです。
以下はメモです。
kernelをインストールする。
$ cd linux-2.6.38-gentoo-r6 $ wget -O ccs-tools-1.8.1-20110511.tar.gz 'http://sourceforge.jp/frs/redir.php?f=/tomoyo/49693/ccs-tools-1.8.1-20110511.tar.gz' $ tar -zxf ccs-patch-1.8.1-20110511.tar.gz $ patch --dry-run -Np1 < patches/ccs-patch-2.6.38.diff $ patch -Np1 < patches/ccs-patch-2.6.38.diff ...
初期化する。
$ sudo /usr/lib/ccs/init_policy
$ sudo ls -Al /etc/ccs/ 合計 16 -rwx------ 1 root root 65 6月 11 21:06 ccs-load-module lrwxrwxrwx 1 root root 33 6月 11 21:06 domain_policy.conf -> policy/current/domain_policy.conf lrwxrwxrwx 1 root root 36 6月 11 21:06 exception_policy.conf -> policy/current/exception_policy.conf lrwxrwxrwx 1 root root 27 6月 11 21:06 manager.conf -> policy/current/manager.conf drwx------ 3 root root 4096 6月 11 21:06 policy lrwxrwxrwx 1 root root 27 6月 11 21:06 profile.conf -> policy/current/profile.conf -rw-r--r-- 1 root root 158 6月 11 21:06 stat.conf drwx------ 2 root root 4096 6月 11 21:06 tools
OSを再起動する。
ログ取得。
$ sudo ccs-auditd $ sudo ls -al /var/log/tomoyo/
学習(0) => 強制(3)にしてログを見る。
$ sudo tail -f /var/log/tomoyo/reject_003.log ...
apacheを起動する。
$ sudo /etc/init.d/apache2 restart
apacheの設定の変更する。
$ sudo ccs-editpolicy ...
セーブする。
$ sudo ccs-savepolicy
OSを再起動する。
ブート時の内容が増えた?
... linkstation: disarming the AVR watchdog: Calling /sbin/ccs-init to load policy. Please wait. CCSecurity: 1.8.1+ 2011/05/11 Mandatory Access Control activated.
保存場所。
$ sudo ls -al /etc/ccs/policy
表示の切り替え後に /usr/sbin/apache2 の表示が消える。
$ sudo ccs-editpolicy ...検索(f)で /usr/sbin/apache2 に移動してから表示の切り替え(@)を押すと画面の一番下に移動する。
もう一度検索する。
修正内容。
cgi系いらないかもしれないがそのまま。
ipアドレスはiptablesでいいかもしれないので全部許可。
拡張子をまとめる方法がわからない。ないかも。kernelのソフトは高機能な正規表現は禁止かも。
例。
file chown /var/run/cgisock.\$ 81
file mksock/chmod /var/run/cgisock.\$ 0700
file read /etc/apache2/modules.d/\+\+_\*.conf
file read /etc/apache2/vhosts.d/\+\+_\*.conf
file read /usr/lib/apache2/modules/mod_\*.so
file read /usr/share/apache2/icons/\*.gif
file read /usr/share/apache2/icons/\*.png
file read /usr/share/apache2/icons/\{\*\}/\*.gif
file read /usr/share/apache2/icons/\{\*\}/\*.png
file read /var/www/\{\*\}/htdocs/.htaccess
file read /var/www/\{\*\}/htdocs/\*.html
file read /var/www/\{\*\}/htdocs/\*.ico
file read /var/www/\{\*\}/htdocs/\*.php
file read /var/www/\{\*\}/htdocs/\*.txt
file read /var/www/\{\*\}/htdocs/\{\*\}/.htaccess
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.bz2
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.css
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.flv
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.gif
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.gz
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.html
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.ico
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.jpeg
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.jpg
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.js
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.pdf
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.php
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.png
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.tgz
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.txt
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.xml
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.xz
file read /var/www/\{\*\}/htdocs/\{\*\}/\*.zip
file unlink /var/run/cgisock.\$
network inet stream accept 0.0.0.0-255.255.255.255 1024-65000
network unix stream bind/listen /var/run/cgisock.\$ログの閲覧。
最後の方の文字列が追加したい場合の内容っぽい。
$ sudo ls -al /var/log/tomoyo/動かない => ログから設定追加。
or 動かない 3 => 2 => 動いたらログから設定追加。
or 動かない 3 => 1 => 動かない動作を再実行してから3に戻す。
or ログから対話式で設定を追加するコマンドがあると書いてあった。
用途。
未知のプログラムを動作させるときに、なにやっているか見る。
プログラムの使用しないファイルを削除する。
例えば利便性のために書き込みを許可して意味がなくなる。
web上からphpファイルを作成するphpプログラムなど。
file write /var/www/\{\*\}/htdocs/\*
file write /var/www/\{\*\}/htdocs/\{\*\}/\*こんな感じであればまだ良い?すぐに消すのでなければ変わらない?file write /var/www/\{\*\}/tmp/\*
file write /var/www/\{\*\}/tmp/\{\*\}/\*
file write /var/www/\{\*\}/htdocs/webtmp/\*
file write /var/www/\{\*\}/htdocs/webtmp/\{\*\}/\*たぶんselinuxより設定するのが楽。しかしグラフィカルに設定するツールがあるが使ったことはない。http://tomoyo.sourceforge.jp/1.8/index.html.ja
http://tomoyo.sourceforge.jp/1.8/policy-specification/expression-rules.html.ja#wildcard
0 件のコメント:
コメントを投稿