「Firejail」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(→‎インストール: 英語版より転載)
11行目: 11行目:
 
{{Note|For information about {{man|7|user_namespaces}} support in Arch Linux kernels see [[Security#Sandboxing applications]]. [https://github.com/netblue30/firejail/issues/1842#issuecomment-376642039 Firejail can use it even if it is disabled].}}
 
{{Note|For information about {{man|7|user_namespaces}} support in Arch Linux kernels see [[Security#Sandboxing applications]]. [https://github.com/netblue30/firejail/issues/1842#issuecomment-376642039 Firejail can use it even if it is disabled].}}
 
{{Warning|While upstream is gradually adopting whitelists, (cf {{ic|/etc/firejail/firefox.profile}},) most of the supplied profiles still rely heavily on blacklists. This means that anything not explicitly forbidden by the profile will be accessible to the application. For example, if you have btrfs snapshots available in {{ic|/mnt/btrfs}}, a jailed program may be forbidden from accessing {{ic|$HOME/.ssh}}, but would still be able to access {{ic|/mnt/btrfs/@some-snapshot/$HOME/.ssh}}. Make sure to audit your profiles, see [[#Testing profiles]]}}
 
{{Warning|While upstream is gradually adopting whitelists, (cf {{ic|/etc/firejail/firefox.profile}},) most of the supplied profiles still rely heavily on blacklists. This means that anything not explicitly forbidden by the profile will be accessible to the application. For example, if you have btrfs snapshots available in {{ic|/mnt/btrfs}}, a jailed program may be forbidden from accessing {{ic|$HOME/.ssh}}, but would still be able to access {{ic|/mnt/btrfs/@some-snapshot/$HOME/.ssh}}. Make sure to audit your profiles, see [[#Testing profiles]]}}
  +
  +
=== Apparmor integration ===
  +
  +
Since 0.9.60-1, {{Pkg|firejail}}, has supported more direct integration with Apparmor through a generic apparmor profile. During installation, the profile, {{ic|firejail-default}}, is placed in {{ic|/etc/apparmor.d}} directory, and needs to be loaded into the kernel by running the following command as root:
  +
  +
# apparmor_parser -r /etc/apparmor.d/firejail-default
  +
  +
To quote the manual:
  +
  +
:The installed profile is supplemental for main firejail functions and among other things does the following:
  +
:* Disable ptrace. With ptrace it is possible to inspect and hijack running programs. Usually this is needed only for debugging.
  +
:* Whitelist write access to several files under {{ic|/run}}, {{ic|/proc}} and {{ic|/sys}}.
  +
:* Allow running programs only from well-known system paths, such as {{ic|/bin}}, {{ic|/sbin}}, {{ic|/usr/bin}} etc. Those paths are available as read-only. Running programs and scripts from user home or other directories writable by the user is not allowed.
  +
:* Prevent using non-standard network sockets. Only {{ic|unix}}, {{ic|inet}}, {{ic|inet6}}, {{ic|netlink}}, {{ic|raw}} and packet are allowed.
  +
:* Deny access to known sensitive paths like {{ic|.snapshots}}.
  +
  +
Local customizations of the apparmor profile are supported by editing the file {{ic|/etc/apparmor.d/local/firejail-local}}
   
 
==設定==
 
==設定==

2021年1月27日 (水) 11:43時点における版

関連記事

Firejail は Linux の名前空間や seccomp-bpf、Linux のケイパビリティを使うことで、信頼のおけないアプリケーションの実行環境を制限することでセキュリティのリスクを減らす、使いやすい SUID サンドボックスプログラムです。単体で使えるだけでなく、Grsecurity などの他のカーネル防護システムと一緒に使用することでセキュリティをさらに高めることができます。Firejail はブラウザやデスクトップアプリケーション、デーモン/サーバーなどで使うのに適しています。

インストール

firejail または firejail-gitAUR パッケージをインストールしてください。Firejail で使用するためのGUIアプリケーション、firetools も用意されています。

ノート: For information about user_namespaces(7) support in Arch Linux kernels see Security#Sandboxing applications. Firejail can use it even if it is disabled.
警告: While upstream is gradually adopting whitelists, (cf /etc/firejail/firefox.profile,) most of the supplied profiles still rely heavily on blacklists. This means that anything not explicitly forbidden by the profile will be accessible to the application. For example, if you have btrfs snapshots available in /mnt/btrfs, a jailed program may be forbidden from accessing $HOME/.ssh, but would still be able to access /mnt/btrfs/@some-snapshot/$HOME/.ssh. Make sure to audit your profiles, see #Testing profiles

Apparmor integration

Since 0.9.60-1, firejail, has supported more direct integration with Apparmor through a generic apparmor profile. During installation, the profile, firejail-default, is placed in /etc/apparmor.d directory, and needs to be loaded into the kernel by running the following command as root:

# apparmor_parser -r /etc/apparmor.d/firejail-default

To quote the manual:

The installed profile is supplemental for main firejail functions and among other things does the following:
  • Disable ptrace. With ptrace it is possible to inspect and hijack running programs. Usually this is needed only for debugging.
  • Whitelist write access to several files under /run, /proc and /sys.
  • Allow running programs only from well-known system paths, such as /bin, /sbin, /usr/bin etc. Those paths are available as read-only. Running programs and scripts from user home or other directories writable by the user is not allowed.
  • Prevent using non-standard network sockets. Only unix, inet, inet6, netlink, raw and packet are allowed.
  • Deny access to known sensitive paths like .snapshots.

Local customizations of the apparmor profile are supported by editing the file /etc/apparmor.d/local/firejail-local

設定

Firejail は実行するアプリケーションごとにプロファイルを使います。デフォルトのプロファイルは /etc/firejail/application.profile にあります。デフォルトのプロファイルを修正したり、デフォルトに含まれていないアプリケーションのカスタムプロファイルを作成する場合、~/.config/firejail に新しいルールやデフォルトのコピーを配置することができます。

空白が含まれるパス

カスタムプロファイルを使ってディレクトリを参照したりホワイトリスト・ブラックリストに入れる場合、次のように絶対パスを使ってください (例: palemoonAUR): /home/user/.moonchild productions

使用方法

firejail で seccomp を使ってアプリケーションを実行するには (例: okular)、以下を実行:

$ firejail --seccomp okular

プライベートモード

Firejail にはワンタイムのプライベートモードも存在します。プライベートモードでは chroot でホームディレクトリのマウントがされません。ディスクに何の痕跡も残さないでアプリケーションを実行することが可能です。例えば、okular をプライベートモードで実行するには、以下を実行:

$ firejail --seccomp --private okular

デフォルトで Firejail を使う

デフォルトで Firejail でアプリケーションを実行するには、以下のように /usr/bin/firejail のシンボリックリンクを作成してください:

$ ln -s /usr/bin/firejail /usr/local/bin/okular

また、コンソールや .desktop ファイルからアプリケーションを起動している場合、それぞれのアプリケーションのランチャーを /usr/local/bin に作成することができます。例えば、okular なら以下のファイルを作成して実行可能権限を付与してください:

/usr/local/bin/okular
firejail --seccomp /usr/bin/okular $@

デスクトップファイル

標準のパスを使わないアプリケーションも存在します。そのようなアプリケーションでは /usr/share/applications/*.desktop.desktop ランチャーを ~/.local/share/applications/ にコピーして EXEC 行に firejail (や seccomp) を記述すれば firejail を使うことができます。

デーモン

デーモンの場合、デーモンの systemd ユニットファイルを上書きして firejail を呼び出すようにしてください。systemd#ユニットファイルの編集を参照。

ノート

Firejail では上手く動作しないアプリケーションや、特別な設定を必要とするアプリケーションが存在します。特定のアプリケーションで全てのディレクトリが使用できない、ブラックリストに入れられている場合、プロファイルを編集してアプリケーションからアクセスする必要がある非標準のディレクトリを有効化してください。例えば Wine がそれに当てはまります。Wine は大抵の場合 seccomp を使用していると動作しません。

他の設定も存在します。firejail の開発は変更が激しいので詳しくは firejail の man ページを参照してください。

Firetools

Firejail を使用するための GUI アプリケーションが存在します: firetools

トラブルシューティング

PulseAudio

Firejail で PulseAudio が上手く動作しないという 既知の問題 が存在します。一時的に解決する方法:

cp /etc/pulse/client.conf ~/.config/pulse/
echo "enable-shm = no" >> ~/.config/pulse/client.conf

参照