Skip to Content

許可のプロンプト

Ubuntu 26.04 では、アプリが機密リソースにアクセスしようとすると、ユーザー認証を要求するプロンプト ウィンドウを表示する新しい権限プロンプト システムが導入されています。このメカニズムにより、ユーザーが各アプリの権限をきめ細かく制御できるようになり、デスクトップのセキュリティが大幅に向上します。

仕組み

中心となる概念

権限プロンプト システムは、AppArmor 4.0 のプロンプト インターフェイスに基づいて構築されています。制限されたアプリ (主に Snap アプリ) が特定のアクセス許可を必要とする操作を試行すると、システムはリクエストをインターセプトし、ユーザーがそれを承認するかどうかを決定するためのダイアログを表示します。

ワークフローは次のとおりです。

  1. アプリが保護されたリソース (ファイル、カメラ、ネットワークなど) にアクセスしようとします。
  2. AppArmor がアクセス要求をインターセプトします
  3. システムは許可を求めるダイアログを表示します
  4. ユーザーは「許可」または「拒否」を選択します
  5. ユーザーは「一度だけ」または「常に許可/拒否」を選択できます。
  6. システムはユーザーの選択を記憶し、それを将来のリクエストに適用します。

保護されたリソースの種類

リソースの種類説明例
ファイルシステムユーザーファイルにアクセスする~/Documents 内のファイルの読み取り
カメラカメラデバイスを使用するビデオ通話アプリ
マイクロフォン録音デバイスを使用する音声録音アプリ
位置地理的位置を取得する地図アプリ
ネットワークネットワークアクセス特定のポートまたはアドレスへのアクセス
通知デスクトップ通知を送信するメッセージングアプリ
自動起動ブート時に実行バックグラウンドサービス

許可プロンプトインターフェイス

権限プロンプトがトリガーされると、次の情報を含むシステムレベルのダイアログが表示されます。

  • 要求元のアプリの名前とアイコン
  • 要求された許可の種類
  • 特定のリソース パス (ファイル パスなど)
  • アクションオプション:
    • 一度許可する
    • 常に許可する
    • 一度拒否する
    • 常に否定する

詳細オプション

ファイルシステムのアクセス許可について、ユーザーはさらに以下を選択できます。

  • 特定のファイルへのアクセスを許可する
  • ディレクトリ全体へのアクセスを許可する
  • 読み取り専用アクセスを許可する
  • 読み取り/書き込みアクセスを許可する

権限の管理

Security Center経由

Security Center の「アプリのアクセス許可」セクションを開いて、次の操作を行います。

  • 付与されたすべての権限を表示する
  • 権限を変更または取り消す
  • アプリまたは権限の種類ごとに参照する

コマンドライン経由

# View snap app connections (permissions) snap connections firefox # View all snap connections snap connections --all # Manually grant a connection sudo snap connect firefox:camera # Disconnect (revoke permission) sudo snap disconnect firefox:camera # View available interfaces snap interface camera

権限ルールの表示

許可を求めるルールは snapd によって管理されます (手書きのファイルではありません)。グラフィカルな「Security Center」を使用してそれらを表示および管理したり、snapd のプロンプト API を使用してクエリを実行したりできます。

# Query the current prompting rules via the snapd REST API sudo snap interface snap-interfaces-requests-control # Call the Prompting API over the local socket to list rules sudo curl -s --unix-socket /run/snapd.socket \ http://localhost/v2/interfaces/requests/rules

権限のリセット

# Recommended: clear an app's permission decisions via the Security Center GUI # Or call the Prompting API to delete a rule (requires the rule ID) # Reset a specific snap interface connection sudo snap disconnect firefox:home

Snap インターフェイスの説明

許可プロンプト システムは主に Snap インターフェイスを中心に動作します。一般的なインターフェイスには次のものがあります。

ファイルアクセスインターフェース

# home - access user home directory snap connections firefox | grep home # removable-media - access removable storage sudo snap connect myapp:removable-media # personal-files - access specific personal files # system-files - access specific system files

ハードウェアインターフェース

# camera - camera snap interface camera # audio-record - microphone snap interface audio-record # bluetooth-control - Bluetooth snap interface bluetooth-control # joystick - game controller snap interface joystick

ネットワークインターフェース

# network - network access # network-bind - listen on ports # network-observe - network monitoring # firewall-control - firewall control snap connections --all | grep network

許可プロンプトの動作の構成

グローバル設定

# Permission prompting is still experimental in 26.04; enable/disable it via the snapd experimental option sudo snap set system experimental.apparmor-prompting=true # Check whether it is currently enabled snap get system experimental.apparmor-prompting # You can also toggle it in the graphical Security Center

アプリごとの構成

# View an app's snap declaration snap info firefox # View all interfaces requested by an app snap connections firefox # Example output: # Interface Plug Slot Notes # camera firefox:camera :camera - # home firefox:home :home - # network firefox:network :network - # audio-playback firefox:audio-playback :audio-playback -

永続的な認可ルール

許可を求めるルールは snapd によって均一に管理され、手書きのファイルによって構成されることはありません。プロンプトダイアログで「常に許可」を選択すると、snapd によって永続ルールが自動的に作成されます。

ルールをプログラムで管理するには、/v2/interfaces/requests/rules インターフェイスを保持するクライアントによって開始される、snapd の プロンプト API (snap-interfaces-requests-control) を使用します。ルールのクエリ、作成、削除はすべて、ディスク上の JSON ファイルを直接編集するのではなく、snapd によって処理されます。

# List the current persistent rules sudo curl -s --unix-socket /run/snapd.socket \ http://localhost/v2/interfaces/requests/rules

従来の deb アプリへの影響

許可を求めるシステムは主に Snap アプリをターゲットとしています。 APT 経由でインストールされた従来のアプリは、引き続き従来の Linux 権限モデルを使用します。

  • deb アプリにはデフォルトですべてのユーザーレベルの権限が与えられます
  • AppArmor は、deb アプリを制限するように手動で構成できます
  • 機密性の高いアプリケーションの場合は、権限の分離を強化するために Snap バージョンを推奨します。
# Check AppArmor status sudo aa-status # View loaded AppArmor profiles sudo aa-status | grep profiles

開発者ガイド

Snap アプリのインターフェイスの宣言

アプリに必要なインターフェイスを snapcraft.yaml で宣言します。

apps: myapp: command: myapp plugs: - home - network - camera - audio-playback plugs: home: read: all write: all camera: null audio-playback: null

ベストプラクティス

  1. 必要な権限のみを要求します - 最小特権の原則に従います
  2. オンデマンドでリクエスト - ユーザーが関連機能をトリガーした場合にのみ権限をリクエストします
  3. フォールバックを提供します - アクセス許可が拒否された場合に代替機能を提供します
  4. 目的の説明 - 権限が必要な理由をユーザーに明確に通知します

トラブルシューティング

許可プロンプトが表示されない

# Check if the AppArmor prompting service is running systemctl --user status snap.snapd-desktop-integration.snapd-desktop-integration.service # Check snapd version (requires 2.66 or higher) snap version # Check if the kernel supports AppArmor prompting cat /sys/kernel/security/apparmor/features/prompting/supported

権限が拒否されたためアプリが動作しない

# View denied permission requests journalctl --user | grep -i "permission\|denied\|apparmor" # Manually grant necessary interfaces sudo snap connect myapp:home sudo snap connect myapp:network # Or reset all permission decisions rm ~/.local/share/apparmor/prompting/snap.myapp.json