跳至內容
阿里BaBa電腦筆記
使用者工具
登入
網站工具
工具
顯示頁面
舊版
反向連結
最近更新
多媒體管理器
網站地圖
登入
最近更新
多媒體管理器
網站地圖
足跡:
linux:perm:selinux
本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。
======基本Selinux未完成....====== * selinux是當年美國國家安全局專門為Linux量身定制的安群機制[[wp>selinux|wiki_selinux]]。目前Selinux以kernel為基楚的方式,已整合到Linux kernel 2.6.x。 * selinux主要以MAC(Mandatory Access Control)委任式存取控制系統的每個程序。Selinux管理程序方式,是依照SELINUX規則來限定程序存取範圍,其中規則以安全本文(SELINUX Context)為重要。 ======如何讓Linux支援selinux====== * 修改/etc/selinux/config<code 1>#vim /etc/selinux/config</code><code 1> # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=enforcing --->enforcing 有支援selinux --->disabled 關閉 selinux --->permissive 有支援selinux,但不阻擋,只有顯示訊息在log檔中/var/log/messages # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted </code><code 1>修改此設定檔完後,要重新開機才會生效 #reboot</code> * 透過指令方式做管理<code 1>#sestatus SELinux status: enabled SELinuxfs mount: /selinux Current mode: enforcing Mode from config file: enforcing Policy version: 24 Policy from config file: targeted -------------------------------------------- #顯示Current mode:enforcing 表示目前有支援selinux </code><code 1>#setenforce 0 有支援selinux,但不阻擋。即為permissive #setenforce 1 有支援selinux </code> ======基本設定selinux規則====== * 基本SELINUX指令<code 1>#ll -dZ /var/www/html/ drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /var/www/html/ #ls -lZ /tmp/host -rw-r--r--. root root unconfined_u:object_r:user_tmp_t:s0 /tmp/host 可以看到不同的檔案被SELINUX 標示Security Content就不一樣 /var/www/html/ :httpd_sys_content_t /tmp/host :user_tmp_t </code><code>若要設定/tmp/host與/var/www/html/一樣的Security Content #chcon -t httpd_sys_content_t /tmp/host #ls -lZ /tmp/host -rw-r--r--. root root unconfined_u:object_r:httpd_sys_content_t:s0 /tmp/host </code> * SELINUX Booleans<code 1>除了selinux context 規則外,還有需多以細項規則 off及on來限制。 ex:Apache Web有一項個人用戶網站;以自己的家目錄當個人網站(http:www.xxxx.com/~ali/), 但是SELINUX開啟時,就會把這項功能oFF掉,因此就要動用到SELINUX Boleans </code>取得家目錄selinux booleans<code>#getsebool -a|grep -i httpd|grep -i home httpd_enable_homedirs --> off </code>設定selinux Booleans off為 on<code 1>#setsebool -P httpd_enable_homedirs=on</code> =====好用的SELINUX 管理程式(semanage)===== * 安裝policycoreutils-python這個套件<code 1>yum install policycoreutils-python</code> ======參考資料====== - [[http://linux.vbird.org/linux_basic/0440processcontrol.php#selinux|鳥歌_SELINUX初探]] - [[http://www.dotblogs.com.tw/billy3321/archive/2008/10/23/5761.aspx|雨倉的SELINUX初探心得]]
linux/perm/selinux.txt
· 上一次變更: 2013/07/06 01:28 (外部編輯)
頁面工具
顯示頁面
舊版
反向連結
回到頁頂