권한 요청
Ubuntu 26.04은 앱이 민감한 리소스에 액세스하려고 할 때 사용자 승인을 요청하는 프롬프트 창을 표시하는 새로운 권한 프롬프트 시스템을 도입합니다. 이 메커니즘은 사용자에게 각 앱의 권한을 세밀하게 제어할 수 있게 하여 데스크톱 보안을 크게 향상시킵니다.
작동 방식
핵심 개념
권한 프롬프트 시스템은 AppArmor 4.0의 프롬프트 인터페이스를 기반으로 구축되었습니다. 제한된 앱(주로 Snap 앱)이 특정 권한이 필요한 작업을 시도하면 시스템은 요청을 가로채고 사용자가 승인 여부를 결정할 수 있는 대화 상자를 표시합니다.
작업 흐름은 다음과 같습니다.
- 앱이 보호된 리소스(예: 파일, 카메라, 네트워크 등)에 액세스하려고 시도합니다.
- AppArmor이 액세스 요청을 가로챕니다.
- 시스템에 권한 프롬프트 대화 상자가 표시됩니다.
- 사용자가 “허용” 또는 “거부”를 선택합니다.
- 사용자는 “이번 한 번만” 또는 “항상 허용/거부”를 선택할 수 있습니다.
- 시스템은 사용자의 선택을 기억하고 이를 향후 요청에 적용합니다.
보호되는 리소스 유형
| 리소스 유형 | 설명 | 예 |
|---|---|---|
| 파일 시스템 | 사용자 파일에 액세스 | ~/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의 Prompting 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:homeSnap 인터페이스 설명
권한 프롬프트 시스템은 주로 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모범 사례
- 필요한 권한만 요청 - 최소 권한의 원칙을 따릅니다.
- 요청 시 요청 - 사용자가 관련 기능을 실행할 때만 권한을 요청합니다.
- 대체 제공 - 권한이 거부된 경우 대체 기능을 제공합니다.
- 목적 설명 - 권한이 필요한 이유를 사용자에게 명확하게 알립니다.
문제 해결
권한 프롬프트가 나타나지 않음
# 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