SELinux 的 audit2allow 工具程式

5月 9th, 2006 1 Comment »

The command audit2allow can receive input via three methods. Default is from standard input (STDIN). Using the -i option reads input from /var/log/messages, and the -d option reads input from dmesg output.

也就是說 audit2allow 有三種接收輸入的方法:
1.預設是由標準輸入 STDIN 接收
2.使用 -i 選項,如 -i /var/log/messages or -i /var/log/audit/audit.log (若有啟動 auditd 時)
3.使用 -d 選項,可以接收 dmesg 的訊息
例如:

[root@candyz:/var/log] audit2allow -i /var/log/messages
allow getty_t var_log_t:file write;
[root@candyz:/var/log] audit2allow -d
allow getty_t var_log_t:file write;

當看到一堆如下的 avc denied 之類的訊息時,要怎麼解決?

audit(1146842928.277:2): avc:  denied  { getattr } for  pid=3357 comm="httpd"
 name="test.php" dev=hda6 ino=137349 scontext=root:system_r:httpd_t
 tcontext=root:object_r:var_t tclass=file

* 在 RHEL4 或 FC3 上的解決方式:

$ cd /etc/selinux/targeted/src/policy/

使用 -d 從 dmesg 讀取 avc messages

$ audit2allow -d -o domain/misc/local.te

or 使用 -l -i /var/log/messages 讀取 /var/log/messages 的 avc messages
# 若有啟動 auditd 則要改讀 /var/log/audit/audit.log

$ audit2allow -l -i /var/log/messages -o domain/misc/local.te

or 直接從 STDIN 讀取 avc messages, 如 /tmp/avcs 裡面放的就是儲存好的 avc messages

$ audit2allow -o domain/misc/local.te < /tmp/avcs

最後再執行 make load 即可

$ make load

然後就會看到如 avc granted 之類的訊息了

* 在 FC5 上的解決方式:

[root@candyz:~] cd /etc/selinux/targeted/modules/
[root@candyz:/etc/selinux/targeted/modules] audit2allow -M local -d
Generating type enforcment file: local.te
Compiling policy
checkmodule -M -m -o local.mod local.te
semodule_package -o local.pp -m local.mod

******************** IMPORTANT ***********************

In order to load this newly created policy package into the kernel,
you are required to execute

semodule -i local.pp

同樣的,除了用 audit2allow -M local -d 從 dmesg 讀取訊息外
也可以用 audit2allow -M local -l -i /var/log/messages
或是 audit2allow -M local -i /var/log/audit/audit.log
或是 audit2allow -M local < /tmp/avcs

最後記得要執行 semodule -i local.pp 來 load new policy to kernel,這點很重要

[root@candyz:/etc/selinux/targeted/modules] semodule -i local.pp

另外也可以用 audit2allow 來產生 local.te 檔案,然後可以去編輯或修改 local.te
[root@candyz:~] cd /etc/selinux/targeted/modules/
[root@candyz:/etc/selinux/targeted/modules] audit2allow -m local -l -i /var/log/messages > local.te

# 然後再執行 checkmodule 指令來產生 local.mod

[root@candyz:/etc/selinux/targeted/modules] checkmodule -M -m -o local.mod local.te

# 然後再執行 semodule_package 指令來產生 local.pp

[root@candyz:/etc/selinux/targeted/modules] semodule_package -o local.pp -m local.mod

同樣的,最後記得要執行 semodule -i local.pp 來 load new policy to kernel,這點很重要

[root@candyz:/etc/selinux/targeted/modules] semodule -i local.pp

或是產生 local.te 檔後,直接執行:

[root@candyz:/etc/selinux/targeted/modules] make -f /usr/share/selinux/devel/Makefile

這樣等於是執行 checkmodule + semodule_package
最後記得再 semodule -i local.pp 即可

IE6 on Linux

5月 9th, 2006 3 Comments »

看到一個 Blog IEs 4 Linux 的網站
於是下載 IEs 4 Linux 2.0 beta 3 回來玩玩看
我在 FC5 以,將其解開,直接執行 ./ies4linux 然後照著安裝即可
當然,在安裝前,要先裝好 wine 及 cabextract
整個裝好後,還缺少中文字型,於是我就把 FC5 上面的 Uming or Ukai 等中文 ttf 字型,cp 到 wine 路徑下的 windows 的 fonts 底下
然後再重新執行 ie6 即可
目前看來,似乎已經有個 ie6 可以用了…

ie6 on Linux

ie6 on Linux

Mac OS X X11.app 下的 GTK 應用程式的選單字型

5月 9th, 2006 2 Comments »

我常在 Mac OS X 下使用 X11 下的應用程式,不管用 fink or darwinport
每每在使用 GTK 相關的應用程式時,那個選單的字型,實在是有夠難看又不清楚,如下圖:
gedit

因此,只要編輯了 ~/.gtkrc-2.0 這個檔案,加入字型的設定,畫面就好看多了,如下圖:
gedit and .gtkrc-2.0

FireStats icon Powered by FireStats