Tệp chính sách uỷ quyền là một nguồn đáng tin cậy duy nhất cho cấu hình uỷ quyền của ngăn xếp giao tiếp Xe được xác định bằng phần mềm (SDV) cho gói dịch vụ SDV.
Tệp chính sách uỷ quyền chứa danh sách quyền cho gói dịch vụ này, trong đó chỉ định những việc mà gói này có thể làm.
Giản đồ proto
Tệp chính sách uỷ quyền sử dụng định dạng textproto để mã hoá thông tin liên quan.
Giản đồ proto của chính sách uỷ quyền như sau:
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;
}
Ví dụ
# 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
}
Ví dụ về quyền đọc tất cả
# Blanket read permission for privileged agents (e.g. Telemetry).
allow_read_all: true
Quyết định uỷ quyền
Hệ thống có thể đưa ra các quyết định uỷ quyền sau:
- Được phép
AuthzPolicycủa đối tượng chứa quy tắc quyền cần thiết.- Bị từ chối rõ ràng
AuthzPolicycủa đối tượng hoặcAuthzPolicycủa máy ảo không chứa quy tắc quyền cần thiết. Một thông báo lỗi rõ ràng sẽ được trả về cho biết quyền bị thiếu.- Bị từ chối ngầm
- Lỗi hệ thống hoặc dữ liệu không hợp lệ, chẳng hạn như thiếu tệp chính sách, không phân tích cú pháp được tên hoặc thiếu định nghĩa đơn vị.
Ví dụ về logic quyết định
Các bước sau đây sẽ xảy ra khi một gói dịch vụ cố gắng gọi com.sdv.UserPreferencesManager trên kênh default:
- Ngăn xếp giao tiếp kiểm tra
AuthzPolicycủa gói dịch vụ để tìm quyềnclient. Nếu thiếu quyền, yêu cầu sẽ Bị từ chối rõ ràng, cho biết đối tượng thiếu quyền. - Đối với giao tiếp trên nhiều máy ảo qua mạng lưới, quyền của máy ảo lưu trữ sẽ được kiểm tra trong quá trình trao đổi thông tin về mạng lưới Khám phá dịch vụ (SD), thay vì chỉ trong quá trình cố gắng truy cập. Ngăn xếp giao tiếp kiểm tra
VmAuthzPolicycủa máy ảo lưu trữ để xác định xem máy ảo có được phép tương tác với dịch vụ hay không. - Nếu cả chính sách đối tượng và chính sách cấp máy ảo đều cho phép tương tác, thì yêu cầu sẽ Được phép. Nếu không, yêu cầu sẽ Bị từ chối rõ ràng, cho biết máy ảo thiếu quyền.
Để biết thêm thông tin về các chính sách được thực thi giữa các máy ảo, hãy xem Quyền cấp máy ảo.