||原文||[[http://ubuntuforums.org/member.php?u=89054|bodhi.zazen]] 氏による [[http://ubuntuforums.org/showthread.php?t=1008906|Introduction to AppArmor]]|| <
> ||<>|| ##== Introduction == == 紹介 == ##The intent of this post is to increase awareness of !AppArmor and encourage it's use by Ubuntu users. Although there are portions of this post that may seem quite technical, it is not my intent to give a full technical review of the workings of !AppArmor or compare !AppArmor to alternate options, such as [http://www.nsa.gov/selinux/ SELinux]. このポストの目的は !AppArmor というものに気付いている人を増やしたいのと Ubuntu ユーザー に !AppArmor を使うのを勧めることです。Although there are portions of this post that may seem quite technical, it is not my intent to give a full technical review of the workings of !AppArmor or compare !AppArmor to alternate options, such as [[http://www.nsa.gov/selinux/|SELinux]]. ##私の目的は完全な技術的な記事や[http://www.nsa.gov/selinux/ SELinux]の代替としての比較ではない(?)記事ではなくて、 ## 翻訳しない ##From the Novell site : Novell のサイトからの引用 {{{ AppArmor is designed to provide easy-to-use application security for both servers and workstations. Novell AppArmor is an access control system that lets you specify per program which files the program may read, write, and execute. AppArmor secures applications by enforcing good application behavior without relying on attack signatures, so it can prevent attacks even if they are exploiting previously unknown vulnerabilities. }}} ##!AppArmor is a security tool and uses name-based mandatory access controls to restrict or confine system access by "at risk" applications. "At risk" applications generally include both server and client applications with network access. In this post I will use Firefox as an example. !AppArmor はセキュリティツールで、”リスク”のあるアプリケーションによるシステムアクセスを制限し、限定するため管理する name-based 強制アクセス制御です。”リスク”のあるアプリケーションはサーバー・クライアントアプリケーションともにネットワークへのアクセスを含んでいます。このポストでは、例として Firefox を使うでしょう。 The goal is to apply application specific rules or "profiles" to "confine" Firefox, or any other application, to only the directories, files, and posix 1003.1e draft capabilities needed for normal functioning. In the event Firefox is compromised, Apparmor's confinement helps to prevent the compromising of the system as a whole. ##目的は Firefox を “confine”するための特有のルールや “profiles”をアプリケーションに適用することです。!AppArmor の制限は全体としてシステムの妥協を防ぎます。 ##!AppArmor is a powerful program and, when an application is confined, !AppArmor can restrict the activity of even the root user. !AppArmor was designed as an alternative to SELinux and is designed to be easier to use. !AppArmor は強力なプログラムです。 “confine”モードのプログラムでは、 !AppArmor はルートユーザーの活動でさえも制限することができます。!AppArmor は SELinux の代替を目指し、より簡単に使えることを目指しています。 ##!AppArmor is configured by writing a profile for an application. Profiles are written one application at at time and and typically targeted at applications which have network access. These profiles are a text files which restrict or confine an application. These restrictions are in addition to the standard Linux permissions. For example, you can not give access to a directory or file with !AppArmor if such access violates the permissions. !AppArmor はアプリケーションのためにプロファイルを書くことによって設定します。プロファイルは一度に一つのアプリケーションに書かれ、一般的に対象となるアプリケーションはネットワークにアクセスします。アプリケーションのアクセスを制限するためのプロファイルはテキストファイルです。制限とは標準の Linux のパーミッションに追加するものです。例えば、you can not give access to a directory or file with !AppArmor if such access violates the permissions. ##Let us imagine, for example, your browser, Firefox, is hijacked (due to some flaw in the code). Let us also imagine the cracker may then use Firefox to access your home directory or system files, allowing him or her to read and modify system files and/or execute arbitrary code. This hypothetical flaw in Firefox then leads to an escalation of privileges and root access is obtained. 想像しよう。例えば、あなたのブラウザー Firefox が(コードの欠陥のために)乗っとられた。またこうも想像できる。クラッカーが Firefox を使ってあなたのホームディレクトリーやシステムファイルにアクセスしようとしたら、誰かがシステムファイルを読んだり変更したりや勝手なコードを実行することを可能にするだろう。 This hypothetical flaw in Firefox then leads to an escalation of privileges and root access is obtained. ##The "traditional" security model would remedy the problem by first correcting the flaw in the code (ie a "security update" for Firefox) and possibly result in a new rule for HIDS, such as viruses scanners or root kits. “伝統的な”セキュリティモデルは(例えば Firefox のセキュリティアップデートのように)コードの欠陥の補修によって、問題を直してきた。たぶんウイルススキャナーやルートキットのような HIDS のための新しいルールが生じたのだろう。(?) ##The problem with this model it it does nothing to protect against the next attack, aka a [http://en.wikipedia.org/wiki/Zero-Day_Attack Zero Day Attack]. !AppArmor adds another check to the system, asking the question, should Firefox be accessing or making changes to system files ? !AppArmor confines Firefox and if there is a new exploit, !AppArmor will help prevent any escalation of privileges. このモデルの問題は[[http://en.wikipedia.org/wiki/Zero-Day_Attack|Zero Day Attack]] として知られる攻撃への防御がないことです。!AppArmor はシステムにもう1つのチェックを加えます。質問ですが、Firefox がシステムファイルにアクセスしたり、変更したりするべきでしょうか? !AppArmor は Firefox を制限し、 もし新たな脆弱性が存在したら !AppArmor は特権の拡大を防ぐのを助けます。 ##''I set up a collection of !AppArmor profiles [http://bodhizazen.net/aa-profiles/ here]. Additional contributions are welcome (PM me if interested).'' ''私は [[http://bodhizazen.net/aa-profiles/|ここ]] で !AppArmor のプロファイルの収集をしています。 追加的な貢献を歓迎します。 (PM me if interested).'' ##=== References === === 参照 === * http://en.wikipedia.org/wiki/Selinux * http://en.wikipedia.org/wiki/AppArmor * https://help.ubuntu.com/8.04/serverguide/C/apparmor.html * http://www.linux.com/feature/58789 * http://www.linuxtopia.org/online_books/opensuse_guides/apparmor_guide/index.html ##Last edited by bodhi.zazen; March 14th, 2009 at 01:38 AM.. == Ubuntu での AppArmor == ##First, by default !AppArmor does very little (and thus with this post I am hoping to change that ...). With a default installation of Ubuntu 8.04 , !AppArmor protects only CUPS (Ubutu 9.04 includes 7 profiles by default: dhclient-script (listed twice), dhclient3, cupsd, tcpdump, cups-pdf, nm-dhcp-clinet.action {basically cpus, dhclient, and tcpdump} ). 初期状態では、 !AppArmor はほとんど何もしません。 (and thus with this post I am hoping to change that ...). Ubuntu 8.04 のデフォルトでは、 !AppArmor は CUPS のみを保護します。(Ubutu 9.04 はデフォルトで7つのプロファイルを含みます。:{{{dhclient-script (listed twice), dhclient3, cupsd, tcpdump, cups-pdf, nm-dhcp-clinet.action {basically cpus, dhclient, and tcpdump} ).}}} ##You can install additional !AppArmor-profiles , which will get you started with a few additional applications, but we must also write and customize our own profiles. I will cover Firefox as an example. 追加的な !AppArmor-profiles をインストールすることが出来ます。 いくつかの追加的なアプリケーションを起動したとしても、プロファイルを書いたり、カスタマイズするべきでしょう。Firefox を例として説明します。 ##To install some additional profiles : 以下のコマンドで追加のプロファイルをインストールできます : {{{ sudo apt-get install apparmor-profiles }}} ##Although this installs some additional profiles, they are permissive in that they default to the complain mode (you will need to manually activate them). 追加のプロファイルをインストールしても、デフォルトでは complain モードです。(?)(手動でアクティブにする必要があります。) ##Profiles are stored in '''/etc/apparmor.d''' プロファイルは '''/etc/apparmor.d''' に入れられています。 ##On Ubuntu, !AppArmor logs profile violations to /var/log/messages Ubuntu の !AppArmor はプロファイル違反を `/var/log/messages` に記録します。 ##Apparmor uses the kernel standard securityfs mechanism load and monitor profiles. ## kernel standard securityfs mechanism は訳さない !AppArmor は kernel standard securityfs mechanism をプロファイルの読み込みとモニターに使います。 ##securityfs is moutned on '''/sys/kernel/security''' . ##'''/sys/kernel/security/apparmor/profiles''' is a virtualized file representing the currently loaded set of profiles. securityfs は '''/sys/kernel/security''' にマウントされています。 '''/sys/kernel/security/apparmor/profiles''' は 現在の読み込まれているプロファイルの設定を表現する仮想ファイルです。 ##On Ubuntu there are no gui tools to manage or write profiles, so we are talking good old command line tools and editing configuration files. The configuration files are text files and ,with a little reading, are fairly easy to understand. Ubuntu では、プロファイルを管理、書き込みする GUI ツールはありません。だから コマンドラインツールと設定ファイルの編集をします。設定ファイルはテキストファイルで、少し読めばとても簡単に理解できます。 ##=== Profiles === === プロファイル === ##Profiles are stored in '''/etc/apparmor.d''' プロファイルは '''/etc/apparmor.d''' に入れられています。 ##Profiles are names for the application they confine, using the full path, dropping the first / and converting the others to a . Firefox is a bit confusing because /usr/bin/firefox is a link to /usr/bin/firefox-3.0, which in turn is a link to /usr/lib/firefox-3.0.4/firefox.sh (On Ubuntu 9.04 Alpha). プロファイルは制限しようとするアプリケーションのフルパスの最初の / は消されほかの / は . に変換された名前です。Firefox は少しややこしくて /usr/bin/firefox は/usr/bin/firefox-3.0にリンクされて、/usr/lib/firefox-3.0.4/firefox.sh にリンクされています。(Ubuntu 9.04 Alpha の場合) ##Thus '''/usr/lib/firefox-3.0.4/firefox.sh''' ##becomes '''usr.lib.firefox-3.0.4.firefox.sh''' ##and is stored in '''/etc/!AppArmor.d/usr.lib.firefox-3.0.4.firefox.sh''' 1. '''/usr/lib/firefox-3.0.4/firefox.sh''' が 1. '''usr.lib.firefox-3.0.4.firefox.sh''' になり 1. '''/etc/!AppArmor.d/usr.lib.firefox-3.0.4.firefox.sh''' として保存される。 ##More on profiles later. 詳細は後ほど === Enforcement === ##Once a profile is defined it is automatically activated when the application is started. There are 2 modes of operation, complain and enforce. ## complain と enforce は訳さない。 一度プロファイルを定義するとアプリケーションを起動したときに自動的に有効になります。complain と enforce 2 つのモードがあります。 ## complain:: - In complain mode AA monitors applications and logs violations to your profile without restricting or confining the application. I think of this as "Testing" mode. complain:: complain モードでは AA(!AppArmor?) はアプリケーションを制限しませんが、アプリケーションを監視し、プロファイル違反を記録します。私はこれをテストモードだと思っています。 ## enforce:: - In enforce mode AA monitors applications and logs violations to your profile. In the event of a violation, access to the resource is denied and the application is confined. enforce:: enforce モードでは AA(!AppArmor?) はアプリケーションを監視し、プロファイル違反を記録します。違反があれば、アクセスを禁止します。(?) === Start / Stop AppArmor === ##Usage: /etc/init.d/apparmor {start|stop|restart|try-restart|reload|force-reload|status|kill} ## service 書式 : /etc/init.d/apparmor {start|stop|restart|try-restart|reload|force-reload|status|kill} Start:: sudo /etc/init.d/apparmor start Stop:: sudo /etc/init.d/apparmor stop Reload:: sudo /etc/init.d/apparmor reload Show status:: sudo /etc/init.d/apparmor status ##and on ... 以下同じ ##=== Additional useful AppArmor commands === === 便利な AppArmor のコマンド === ##||Note: In these examples, | = or. So you may use geprof or aa-gprof (and on).|| ||メモ: “|” = "or" です。つまり geprof または aa-gprof を表わしています。|| ##Source : [http://www.novell.com/documentation/AppArmor/book_opensuse_aaquick21_start/index.html?page=/documentation/AppArmor/book_opensuse_aaquick21_start/data/article_book_book_opensuse_aaquick_start.html Novell AppArmor Guide] ## 引用部分は翻訳しない。 引用元 : [[http://www.novell.com/documentation/AppArmor/book_opensuse_aaquick21_start/index.html?page=/documentation/AppArmor/book_opensuse_aaquick21_start/data/article_book_book_opensuse_aaquick_start.html|Novell AppArmor Guide]] http://webapp5.rrz.uni-hamburg.de/SuSe-Dokumentation/manual/sles-manuals_en/manual/sec.aaquick.cmdline.html ==== genprof | aa-genprof ==== {{{ Generate or update a profile. When running, you must specify a program to profile. If the specified program is not an absolute path, genprof searches the $PATH variable. If a profile does not exist, genprof creates one using autodep. }}} ##Syntax : sudo genprof application ##Example sudo genprof firefox ##This generates a profile for firefox at /etc/apparmor.d/usr.lib.firefox-3.0.4.firefox.sh 構文:: sudo genprof application 例:: sudo genprof firefox * /etc/apparmor.d/usr.lib.firefox-3.0.4.firefox.sh に Firefox のプロファイルを作ります。 ==== autodep | aa-autodep ==== {{{ Guess basic AppArmor profile requirements. autodep creates a stub profile for the program or application examined. The resulting profile is called approximate because it does not necessarily contain all of the profile entries that the program needs to be confined properly. }}} ==== complain | aa-complain ==== {{{ Set an AppArmor profile to enforce mode from complain mode.}}} ##syntax : complain rule ##Example : sudo complain firefox 構文:: complain rule 例:: sudo complain firefox ==== enforce | aa-enforce ==== {{{ Set an AppArmor profile to enforce mode from complain mode. }}} ##syntax : enforce rule ##Example : sudo enforce firefox 構文:: enforce rule 例:: sudo enforce firefox ==== unconfined | aa-unconfined ==== {{{ Output a list of processes with open tcp or udp ports that do not have AppArmor profiles loaded. }}} ==== logprof | aa-logprof ==== {{{ Manage AppArmor profiles. logprof is an interactive tool used to review the learning or complain mode output found in the AppArmor syslog entries and to generate new entries in AppArmor profiles.}}} Translation: search your logs for problems and use this information to modify the firefox profile. ==== apparmor_parser ==== ##This is used to load, or more commonly reload a profile into the kernel. After modifying (editing) a profile use : これはプロファイルのカーネルへの読み出し(一般的には再読み出しに使われ再読み出し)のために使われます。プロファイルを編集した後に使ってください。 : {{{ sudo apparmor_parser -r /etc/apparmor.d/}}} ##Where "" is the profile to re-load. "" の所はリロードするプロファイルに置き換えてください。 ##If you prefer you can restart !AppArmor (same as reload) !AppArmor の再起動でも出来ます(再読み出しと同じ) {{{ /etc/init.d/apparmor restart}}} ## Last edited by bodhi.zazen; July 13th, 2009 at 03:06 AM.. ##== Anatomy of a Profile == == プロファイルの分析 == ##== AppArmor on Ubuntu == == プロファイルの分析 == ##Now we are getting into the nitty gritty ここからが肝心な部分です。 ##Each application you wish to confine under !AppArmor is given a profile which is stored in the /etc/!AppArmor.d directory. !AppArmor のもとで制限するアプリケーションは /etc/!AppArmor.d ディレクトリーの中にプロファイルを与えられます。 ##Each profile is named after the application to which it applies, changing the / in the path to a . (the first / is simply dropped). Each profile is named after the application to which it applies, パス中の / は . に変えられます。(最初の / は消されます。) ## それぞれのプロファイルは適応するアプリケーションへの ##So, /usr/lib/firefox-3.0.4/firefox.sh becomes '''usr.lib.firefox-3.0.4.firefox.sh'''. つまり、 /usr/lib/firefox-3.0.4/firefox.sh は '''usr.lib.firefox-3.0.4.firefox.sh''' になります。 ##Profiles are nothing more then text files and are generated by you the user sometimes with the assistance of !AppArmor tools from the command line (sorry no GUI in Ubuntu, although there is a GUI in YAST on OpenSUSE). They can be viewed and manually managed (tweaked) with any editor (gedit, nano, vim, etc). I will walk you through generating a profile for firefox in the next post. プロファイルはテキストファイル以上のものではありません。プロファイルは コマンドライン(OpenSUSE では YaST という GUI のツールがありますが、 Ubuntu では GUI のツールはありません。) のツールユーザーによって作られたりします。プロファイルはエディター(gedit, nano, vim など)で見たり、手作業で管理(チューンアップ)できます。I will walk you through generating a profile for firefox in the next post. ##Profiles are comprised of 4 sections #include, capability entries, rules, and hats. プロファイルは4つのセクション #include, capability entries, rules, hats から構成されます。 === # include === ###include is akin to sourcing or libraries and allows you to generate a list of common restrictions. Rather then writing this list over and over in profiles, you can keep it in a common location and incorporate it into a profile with an #include. When you update the common list, all your profiles are updated. #include は sourcing や libraries に似ていて、一般的な制限のリストを作ります。Rather then writing this list over and over in profiles, you can keep it in a common location and incorporate it into a profile with an #include. When you update the common list, all your profiles are updated. ## #includeによってプロファイルを読み込み、 common list をアップデートした時、すべてのプロファイルはアップデートされます。 === Capability entries === ##In English, this is permission checking. 英語では permission checking と言います。 ##In Geek speak : ギークの言葉では : {{{ Capabilities statements are simply the word capability followed by the name of the POSIX.1e capability as defined in the capabilities(7) man page. }}} ##And, if you are interested, [http://linux.die.net/man/7/capabilities capabilities(7) man page]. 興味があるなら [[http://linux.die.net/man/7/capabilities|capabilities(7) man page]] を読んでください。 === Rules === ##These are basically a set of permissions applied to files or directories. The syntas is a path followed by a set of rules. 基本的にファイルやディレクトリに適用するパーミッションの設定があります。構文は設定したいパスの後にルールです。 {{{ [path] [rules]}}} ==== path ==== ##You may use Globing or special characters in the path. パスの中には Glob や special characters が使えます。 {{{ * Substitutes for any number of characters, except /. ** Substitutes for any number of characters, including /. ? Substitutes for any single character, except /. [ abc ] Substitutes for the single character a, b, or c. [ a-c ] Substitutes for the single character a, b, or c. { ab,cd } Expand to one rule to match ab and another to match cd. [ ^a ] Substitutes for any character except a. }}} ##Rules for files include ファイルのルール: {{{ r = read w = write l = link k = lock a = append }}} ##Rules for executable (applications) include 実行可能(アプリケーション)のルール: {{{ ix = inherit = Inherit the parent's profile. px = requires a separate profile exists for the application, with environment scrubbing. Px = requires a separate profile exists for the application, without environment scrubbing. ux and Ux = Allow execution of an application unconfined, with and without environmental scrubbing. (use with caution if at all). m = allow executable mapping. }}} ##For a more detailed explaination see the man page : [http://man-wiki.net/index.php/5:AppArmor.d AppArmor(5)] 詳細な説明は [[http://man-wiki.net/index.php/5:AppArmor.d|AppArmor(5)]] を参照してください。 ##Example (from the above man page) 例(man page より) {{{ # a variable definition @{HOME} = /home/*/ /root/ # a comment about foo. /usr/bin/foo { /bin/mount ux, /dev/{,u}random r, /etc/ld.so.cache r, /etc/foo.conf r, /etc/foo/* r, /lib/ld-*.so* x, /lib/lib*.so* r, /proc/[0-9]** r, /usr/lib/** r, /tmp/foo.pid wr, /tmp/foo.* lrw, /@{HOME}/.foo_file rw, # a comment about foo's subprofile, bar. ^bar { /lib/ld-*.so* x, /usr/bin/bar ix, /var/spool/* rwl, } } }}} ##Comments : ## 1. Note the use of variable. This is only necessary if you mount your /home partition in a non-standard location. ## " /@{HOME}/.foo_file" ## 1. Comments start with an octothorpe (#). ## 1. /etc/foo/* r, ## Allows read access to the files in /etc/foo ## /etc/** would allow read access to all sub-directories in /etc Comments : 1. 変数を使うのは、 /home パーティションを標準でない場所にマウントする必要がある場合だけです。 " /@{HOME}/.foo_file" 1. コメントは # で始めます。 1. /etc/foo/* r, /etc/foo の中のファイルへのアクセスを許可します。 /etc/** は /etc の中のすべてのサブディレクトリーへのアクセスを許可します。 === Hats === While an !AppArmor profile is applied to an application, there are times with a sub process of the program may need access differing from the main program. In this event, the sup process may "change hats" or use an alternate sub-profile. A profile may have more then 1 sub-profile, however the sub-profiles may not have sud-sub profiles (if that makes sense). ##プロファイルは 1つの サブプロファイルを持っているかもしれない。しかしサブプロファイルはサブサブプロファイルを持っていない (if that makes sense) ##Right now very few applications use hats, and one example is Apache. 現時点では hats を使っているアプリケーションはとても少ない。例えば Apache です。 ##For a more detailed explanation see もっと詳細な説明 {{{ man !AppArmor man !AppArmor.d }}} ##Last edited by bodhi.zazen; December 12th, 2008 at 02:08 AM.. ##== Generating Profiles == == プロファイルの作成 == ##By default, Ubuntu includes a profile only for CUPS. You can install a few additional profiles with デフォルトでは Ubuntu は CUPS のプロファイルしか含んでいません。 以下のコマンドで追加のプロファイルをインストールできます。 {{{ sudo apt-get install apparmor-profiles }}} ##The additional profiles are : 追加のプロファイル : {{{ usr.sbin.avahi-daemon , usr.sbin.nmbd , bin.ping, sbin.klogd , usr.sbin.nscd , sbin.syslogd , usr.sbin.dnsmasq, usr.sbin.ntpd , sbin.syslog-ng, usr.sbin.identd , usr.sbin.smbd , gdm-guest-session , usr.sbin.mdnsd , and usr.sbin.traceroute }}} ##Also included are some information for #includes in /etc/!AppArmor.d/abstractions directory. また /etc/!AppArmor.d/abstractions に #includes のための情報を含んでいます。 ||Note: After you generate a new profile, or edit an existing profile, the profile must be (re)loaded into the kernel and the application to which it applies must be restarted. The can be performed by restarting the application or rebooting.|| ##|| 新しいプロファイルを作ったり、プロファイルを編集した後には、プロファイルはカーネルに(リ)ロードされ、プロファイルを適用するアプリケーションは再起動する必要があります。|| {{{ sudo apparmor_parser -r /etc/apparmor.d/ }}} "" の所はリロードするプロファイルに置き換えてください。 ##As promised, let us generate a profile for firefox. 約束通り、Firefox のプロファイルを作ります。 ##First, close firefox. はじめに、Firefox を閉じてください。 ##Next run 以下を実行してください。 {{{ sudo genprof firefox }}} ##This will generate a "basic" profile for Firefox and place it into complain mode. You will be able to run Firefox and any violations of the profile will be logged. これは Firefox のための”基本的な”プロファイルを作成し、Firefox を complain モードにします。You will be able to run Firefox and any violations of the profile will be logged. ##Firefoxとほかのプロファイルの違反はログされます。 ##I suggest you start by reviewing the profile for Firefox and add what you can. Firefox のプロファイルを見直し、あなたの出来ることを追加することを提案します。 ##Now lets follow the logs while we take Firefox for a spin. Open a terminal and enter Now lets follow the logs while we take Firefox for a spin. 端末を開いて入力してください。 {{{ tail -F /var/log/messages}}} ##The next step, with the !AppArmor profile for Firefox still in complain mode, start Firefox and perform "normal activities". Open and close Firefox, browse some web sites, download some simple files, browse local files, etc. This will vary from one setup to another and we do not all use Firefox in the same way. Firefox の !AppArmor のプロファイルはすでに complain モードになっています。Firefox を起動し、”普通の活動”をしてください。Firefox を起動したり、終了したり、Web サイトを閲覧したり、ファイルをダウンロードしたり、ローカルのファイルを閲覧したり... など。 This will vary from one setup to another and we do not all use Firefox in the same way. ##During this trial period you will see a variety of error messages flash in the terminal where your are following /var/log/messages. Initially you will get an overwhelming number, that is OK, work through the error messages one at at time, modify your profile, quit Firefox, reload your profile and work on the next set of messages. 試行錯誤の期間では、/var/log/messages を見たときたくさんのエラーメッセージを目にするでしょう。Initially you will get an overwhelming number, that is OK, work through the error messages one at at time, modify your profile, quit Firefox, reload your profile and work on the next set of messages. ##始めは膨大な数でも OK です。プロファイルを編集し、Firefoxを終了し、プロファイルを再読み込みし、 ##If you get stuck and do not understand what to add, use aa-logprof. I suggest you make a backup of your current profile first (keep backups outside of /etc/apparmor.d): もし困ったり、何を加えるべきか分からなかったら、aa-logprof を使いましょう。私はまず現在のプロファイルのバックアップを取るべきだと思います。(バックアップは/etc/apparmor.d の外にしてください。) {{{ sudo cp /etc/apparmor.d/user.lib.firefox-3.0.4.firefox.sh /root/user.lib.firefox-3.0.4.firefox.sh }}} ##Next, 次に、 {{{ sudo aa-logprof firefox}}} This will search your logs and modify your profile on the basis of how you answer the resulting questions. ## これはログを探し、基本的に質問への回答からプロファイルを編集します。 ||Note: aa-logprof is a bit unrefined and you should review and edit the resulting changes in the profile manually.|| ##||メモ: aa-logprof は ##My final profile was (Ubuntu 9.04 Alpha, FF 3.0.4): 私の最終的なプロファイル(Ubuntu 9.04 Alpha, Firefox 3.0.4) {{{ # Last Modified: Thu Dec 11 21:08:14 2008 #include /usr/lib/firefox-3.0.4/firefox.sh { #include #include #include #Include #include #include network dgram, network stream, /bin/dash rix, /bin/grep rix, /bin/ps rix, /usr/bin/basename rix, /usr/lib/firefox-3.0.4/firefox mrix, /usr/lib/gamin/gam_server mrix, /dev/shm/ r, owner /dev/shm/pulse-* rw, /etc/ r, /etc/firefox-3.0/pref/ r, /etc/firefox-3.0/pref/* r, /etc/gre.d/ r, /etc/gre.d/1.9.0.4.system.conf r, /etc/mime.types r, /etc/pulse/client.conf r, /etc/sound/events/gtk-events-2.soundlist r, /etc/xulrunner-1.9/system-greprefs.js r, owner /home/** rw, owner /home/*/.adobe/ rw, owner /home/*/.adobe/** rw, owner /home/*/.config/gtk-2.0/** rwk, owner /home/*/.macromedia/ w, owner /home/*/.macromedia/** rw, owner /home/*/.mozilla/** rwk, owner /home/*/.pulse-cookie rwk, owner /home/*/.pulse/ w, owner /home/*/{Desktop,Documents,Downloads}/ rw, owner /home/*/{Desktop,Documents,Downloads}/** rw, owner /proc/*/maps r, /proc/*/mounts/* r, owner /proc/*/stat r, /proc/version r, /usr/local/share/** r, /usr/share/** r, /var/lib/dbus/machine-id r, } }}} ##||Note: If you use this profile you will probably NOT be able to browse local files and / or pictures etc.|| ||メモ: このプロファイルを使用したとき、ローカルのファイルや / や画像を閲覧できなくなります。|| Generating a profile is thus an active process an one where you can learn what "normal functioning" of Firefox entails. There are only really two mistakes you can make: ##プロファイルの作成は、このように活動中のプロセスのどこにFirefox の”普通の機能”が必要とするものを知ることが出来ます。2つのミスがあります。: ## 1. Too restrictive. In extreme cases Firefox will not run (when Apparmor is in the enforcing mode). ## 1. Too permissive. Keep in mind, however, that before you make a profile Firefox had relatively unfettered access to your system. Also standard Linux permissions still apply. 1. 制限のしすぎ。極端な場合、(enforce モードにした時に) Firefox が起動しません。 1. 許可のしすぎ。Keep in mind, however, that before you make a profile Firefox had relatively unfettered access to your system. Also standard Linux permissions still apply. ##Firefox のプロファイルを作る前はシステムへのアクセスが比較的自由だった。標準的な Linux のパーミッションも適用する。keep in mind:肝に銘じる ##Some helpful globs: 役に立つ glob: {{{ /home/*/ /usr/share/** r /usr/local/share/** r }}} ##When you are ready, put the Firefox profile into enforcing mode. Watch your log and re-start Firefox. You may need to further modify your profile. 準備が出来たら、Firefox のプロファイルを enforce モードにしてください。ログを見て Firefox を再起動してください。まだ変更を加えないといけないかもしれません。(?) As with any application, as you use !AppArmor you will get a feel for how it works and how to write efficient Profiles. ##どのように動かすのかと効果のあるプロファイルを書く方法を。 ##'''DON'T FORGET to reload a profile after editing it.''' '''編集の後にはリロードを忘れないでください。''' {{{ sudo apparmor_parser -r /etc/apparmor.d/}}} ##Or if you prefer, または、 {{{ /etc/init.d/apparmor restart}}} ##I would also like to start a thread : また私はこのスレッドを始めたいと思っています。: [[http://ubuntuforums.org/showthread.php?p=6353911|Share your AppArmor Profiles]]