승인 위반은 서비스가 실행이 허용되지 않은 작업을 수행하려고 할 때 발생합니다. 표준 permissionsOnly 시행 모드에서 소프트웨어 정의 차량(SDV) 프레임워크는 주체 또는 가상 머신(VM)에 정책에 선언된 필수 권한이 있는지 확인합니다. Soong은 빌드 시 승인 .textproto 파일을 검증하거나 VSIDL 카탈로그 또는 번들 매니페스트와 교차 확인하지 않으므로 구문 오류와 누락되거나 일치하지 않는 권한은 경고 없이 컴파일되며 엔드포인트 등록, 검색, 교차 VM 동기화, 데이터 터널 액세스 또는 RPC 호출 중에 런타임 시에만 실패합니다.
보안 컨텍스트 내에서 위반 메시지를 평가해야 합니다. 모든 위반이 오류 또는 무단 액세스 시도를 나타내는 것은 아닙니다.
모든 승인 결정이 로깅됩니다. 이를 보려면 logcat 출력에서 감사 메시지를 검색합니다.
adb -s $SERIAL logcat | grep 'audit message'
승인 완료
성공한 검사는 debug 수준에서 로깅됩니다.
이는 주체에 선언된 필수 권한이 있음을 나타냅니다.
D SdvServiceManagerServer: instance2:com.sdv.google.sample.bar.ServiceBundleBar/instance declares permission to access com.sdv.google.sample.foo.ServiceBundleFoo#foo-rpc, audit message: ...
위반 및 권한 누락
권한이 누락되면 위반이 발생합니다.
이는 주체에 승인 정책의 client, server, publisher 또는 subscriber와 같은 필요한 권한이 없거나 주체의 VM에 VM 수준 정책의 권한이 없는 경우에 발생합니다.
이는 error 수준에서 로깅됩니다.
E SdvServiceManagerServer: Authz violation. instance2:com.sdv.google.sample.bar.ServiceBundleBar/instance does not declare permission to access com.sdv.google.sample.foo.ServiceBundleFoo#foo-rpc, audit message: Subject lacks 'client' permission...
해결
로그의 audit message에는 위반을 해결하기 위해 추가해야 하는 항목에 관한 유용한 제안이 포함되어 있는 경우가 많습니다.
예를 들어 다음과 같은 권한 오류가 표시될 수 있습니다.
Subject 'vm:com.client.Bundle/default' lacks 'client' permission for service 'com.server.TargetType' with channel 'my-unit'. Add 'client { service: "com.server.TargetType" channel: "my-unit" }' to the subject's Authz policy
주체의 승인 정책 textproto에 규칙을 추가하여 이 문제를 해결합니다.
client {
service: "com.server.TargetType"
channel: "my-unit"
}
오류 메시지에 주체의 VM에 권한이 누락되었다고 표시되면 com.oem.sdv.authz APEX의 <vm_name>.textproto 또는 .default.textproto과 같은 VM 수준 정책에 권한을 추가해야 합니다.
allow_server {
service: "com.server.TargetType"
channel: "my-unit"
}
SDV Core에서는 번들별, 호환 에이전트, VM 수준(com.oem.sdv.authz) 정책이 APEX 컨테이너 내에 패키징됩니다. updatable: true가 있는 APEX의 경우 전체 시스템 이미지를 다시 빌드하는 대신 영향을 받는 APEX만 다시 빌드하고 스테이징할 수 있습니다(업데이트할 수 없는 APEX는 전체 이미지를 업데이트해야 함). SDV IVI에서 VM 수준 정책은 /vendor에서 업데이트 가능한 com.oem.sdv.authz APEX를 사용하고(adb install --staged 및 adb reboot로 스테이징됨) /product/etc/sdv_authz_policies/, /system/etc/sdv_authz_policies/, /system_ext/etc/sdv_authz_policies/ 또는 /vendor/etc/sdv_authz_policies/의 서비스별, 앱별, 에이전트별 주체 정책은 해당 파티션 이미지를 업데이트해야 합니다. 자세한 내용은 배포 및 개발 중 빠른 서비스 번들 업데이트를 참조하세요.
ACL에서 마이그레이션
이전 버전과의 호환성 및 이전을 위해 프레임워크는 이전 액세스 제어 목록(ACL)을 고려하는 ACLs only, Lenient, Strict 모드를 지원합니다.
ACL 전용 모드
ACLs only 모드에서는 ACL에서 허용하는 경우에만 액세스가 허용됩니다. 권한은 무시됩니다. ACL에서 액세스를 거부하면 오류가 로깅됩니다.
E SdvServiceManagerServer: Authz violation. com.sdv.google.sample.foo.ServiceBundleFoo#foo-rpc denies access to instance2:com.sdv.google.sample.bar.ServiceBundleBar/instance, audit message: ...
관대한 모드
Lenient 모드에서는 ACL 또는 권한 중 하나가 허용하는 경우 액세스가 허용됩니다.
ACL을 사용하여 액세스 권한이 부여되었지만 권한이 누락된 경우, 시스템 기능을 유지하면서 누락된 권한을 식별할 수 있도록 debug 수준에서 소프트 위반으로 로깅됩니다.
D SdvServiceManagerServer: Permissions Authz violation (access granted by ACLs): instance2:com.sdv.google.sample.bar.ServiceBundleBar/instance does not declare permission to access com.sdv.google.sample.foo.ServiceBundleFoo#foo-rpc, audit message: ...
ACL과 권한이 모두 실패하면 두 가지 모두에 대한 오류로 로깅됩니다.
E SdvServiceManagerServer: Authz violation. com.sdv.google.sample.foo.ServiceBundleFoo#foo-rpc denies access to instance2:com.sdv.google.sample.bar.ServiceBundleBar/instance, audit message: ...
E SdvServiceManagerServer: Authz violation. instance2:com.sdv.google.sample.bar.ServiceBundleBar/instance does not declare permission to access com.sdv.google.sample.foo.ServiceBundleFoo#foo-rpc, audit message: ...
엄격 모드
Strict 모드에서는 ACL과 권한 모두 액세스를 허용해야 합니다. ACL 또는 권한이 실패하면 액세스가 거부되고 오류가 로깅됩니다.