فایل خطمشی مجوز منبع واحد حقیقت برای پیکربندی مجوز پشته ارتباطات «خودروی نرمافزارمحور» (SDV) برای دسته سرویس SDV است.
فایل خطمشی مجوز حاوی فهرست اجازههای این دسته سرویس است که مشخص میکند این دسته چه کارهایی میتواند انجام دهد.
طرحواره پروتکل
فایل خطمشی مجوز از قالب textproto برای کدبندی اطلاعات مربوطه استفاده میکند.
طرح اولیه خطمشی مجوز بهصورت زیر است:
message AuthzPolicy {
// Optional. List of permissions to publish Data Tunnel publications.
repeated Publisher publisher = 4;
// Optional. List of permissions to discover and subscribe to Data Tunnel
// publications.
repeated Subscriber subscriber = 5;
// Optional. List of permissions to serve an RPC server.
repeated Server server = 6;
// Optional. List of permissions to discover and call methods of an RPC
// server.
repeated Client client = 7;
// Optional. Allow blanket "read" permission.
//
// Gives permission to discover and call all methods of all RPC servers,
// as well as discover and subscribe to all publications.
//
// WARNING: This flag grants elevated permissions and should be used with a
// good reason and for privileged agents only (e.g. Telemetry).
bool allow_read_all = 8;
}
// Defines a permission to publish Data Tunnel publications.
message Publisher {
// Required. Publication's protobuf message name.
string message = 1;
// Topic(s) to which this permission allows to publish to.
//
// Setting this field or setting 'allow_all_topics == true' is required.
repeated string topic = 2;
// Flag indicates that Service Bundle is allowed to register publication
// of the 'message' type with any 'topic'
//
// Should only be set to 'true' if the 'topic' field is not set.
bool allow_all_topics = 3;
}
// Defines a permission to discover and subscribe to Data Tunnel publications.
message Subscriber {
// Required. Publication's protobuf message name.
string message = 1;
// Topic(s) to which this permission allows to subscribe to.
//
// Setting this field or setting 'allow_all_topics == true' is required.
repeated string topic = 2;
// Flag indicates that Service Bundle is allowed to discover and subscribe to
// all publications of the 'message' type.
//
// Should only be set to 'true' if the 'topic' field is not set.
bool allow_all_topics = 3;
}
// Defines a permission to serve an RPC server.
message Server {
// Required. Server's protobuf service name.
string service = 1;
// Channel(s) which this permission allows to register.
//
// Setting this field or setting 'allow_all_channels == true' is required.
repeated string channel = 2;
// Flag indicates that Service Bundle is allowed to register RPC servers
// of the 'service' type with any 'channel'
//
// Should only be set to 'true' if the 'channel' field is not set.
bool allow_all_channels = 3;
}
// Defines a permission to discover and call methods of an RPC server.
message Client {
// Required. Server's protobuf service name.
string service = 1;
// Channel(s) which this permission allows to discover and call methods on.
//
// Setting this field or setting 'allow_all_channels == true' is required.
repeated string channel = 2;
// Flag indicates that Service Bundle is allowed to discover and call all RPC
// servers of the 'service' type.
//
// Should only be set to 'true' if the 'channel' field is not set.
bool allow_all_channels = 3;
}
مثال
# Allows this SB to register publication of TireStatus type with "left_tire" topic only.
publisher {
message: "com.sdv.TireStatus"
topic: "left_tire"
}
# Allows this SB to subscribe to publication of TireStatus type with "left_tire" topic only.
subscriber {
message: "com.sdv.TireStatus"
topic: "left_tire"
}
# Allows this SB to implement and serve UserPreferencesManager service on any channel.
server {
service: "com.sdv.UserPreferencesManager"
allow_all_channels: true
}
# Allows this SB to discover and call UserPreferencesManager service on any channel.
client {
service: "com.sdv.UserPreferencesManager"
allow_all_channels: true
}
نمونه خواندن همه با امتیاز ویژه
# Blanket read permission for privileged agents (e.g. Telemetry).
allow_read_all: true
تصمیم صدور مجوز
سیستم میتواند تصمیمات صدور مجوز زیر را اتخاذ کند:
- مجاز
AuthzPolicyموضوع حاوی قانون اجازه لازم است.- صراحتاً رد شد
AuthzPolicyموضوع یاAuthzPolicyماشین مجازی حاوی قانون اجازه لازم نیست. پیام خطای واضحی برگردانده میشود که نشاندهنده اجازه مفقودشده است.- انکار ضمنی
- خطای سیستم یا دادههای نامعتبر، مانند فایل خطمشی مفقود، عدم موفقیت در تجزیه نام، یا تعریف واحد مفقود.
منطق تصمیمگیری نمونه
وقتی بسته سرویس تلاش میکند با com.sdv.UserPreferencesManager در کانال default تماس بگیرد، مراحل زیر انجام میشود:
- پشته ارتباطات
AuthzPolicyبسته سرویس را برای اجازهclientبررسی میکند. اگر اجازه وجود نداشته باشد، درخواست صریحاً رد میشود که نشان میدهد سوژه اجازه ندارد. - برای ارتباط بین ماشینهای مجازی ازطریق شبکه توری، اجازه ماشین مجازی میزبان درطول تبادل اطلاعات توری «شناسایی سرویس» (SD) بررسی میشود، نه فقط درطول تلاش برای دسترسی. پشته ارتباطات
VmAuthzPolicyماشین مجازی میزبان را بررسی میکند تا مشخص کند آیا ماشین مجازی اجازه تعامل با سرویس را دارد یا نه. - اگر هم خطمشی موضوع و هم خطمشی سطح VM تعامل را مجاز کنند، درخواست مجاز است. درغیراینصورت، صریحاً رد میشود، که نشان میدهد ماشین مجازی اجازه ندارد.
برای اطلاعات بیشتر درباره خطمشیهای اعمالشده بین ماشینهای مجازی، اجازههای سطح ماشین مجازی را ببینید.