권한 위반 디버깅

승인 위반은 서비스가 실행할 수 없는 작업을 실행하려고 할 때 발생합니다. 표준 permissionsOnly 적용 모드에서 소프트웨어 정의 차량 (SDV) 프레임워크는 주체 또는 해당 가상 머신 (VM)에 정책에 선언된 필수 권한이 있는지 확인합니다.

보안 컨텍스트 내에서 위반 메시지를 평가해야 합니다. 모든 위반이 오류 또는 무단 액세스 시도를 나타내는 것은 아닙니다.

모든 승인 결정이 로깅됩니다. 이를 확인하려면 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"
}

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 또는 권한이 실패하면 액세스가 거부되고 오류가 로깅됩니다.