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में अनुमति से जुड़ा ज़रूरी नियम शामिल नहीं है. गड़बड़ी का मैसेज दिखता है, जिसमें साफ़ तौर पर यह बताया जाता है कि अनुमति नहीं है. - इंप्लिसिट रूप से अस्वीकार किया गया
- सिस्टम में गड़बड़ी या अमान्य डेटा. जैसे, नीति की फ़ाइल मौजूद न होना, नाम पार्स न हो पाना या यूनिट की परिभाषा मौजूद न होना.
फ़ैसले के लॉजिक का उदाहरण
जब कोई सेवा बंडल, चैनल default पर com.sdv.UserPreferencesManager को कॉल करने की कोशिश करता है, तो ये चरण पूरे होते हैं:
- कम्यूनिकेशन स्टैक,
clientअनुमति के लिए सेवा बंडल केAuthzPolicyकी जांच करता है. अगर अनुमति मौजूद नहीं है, तो अनुरोध को साफ़ तौर पर अस्वीकार कर दिया जाता है. इससे पता चलता है कि विषय के पास अनुमति नहीं है. - मेश नेटवर्क पर अलग-अलग वीएम के बीच कम्यूनिकेशन के लिए, सर्विस डिस्कवरी (एसडी) मेश की जानकारी के आदान-प्रदान के दौरान, होस्ट वीएम की अनुमति की जांच की जाती है. ऐसा सिर्फ़ ऐक्सेस करने की कोशिश के दौरान नहीं किया जाता. कम्यूनिकेशन स्टैक, होस्ट वीएम के
VmAuthzPolicyकी जांच करता है. इससे यह पता चलता है कि वीएम को सेवा के साथ इंटरैक्ट करने की अनुमति है या नहीं. - अगर विषय से जुड़ी नीति और वीएम-लेवल की नीति, दोनों में इंटरैक्शन की अनुमति है, तो अनुरोध को अनुमति दी जाती है. ऐसा न होने पर, इसे साफ़ तौर पर अस्वीकार कर दिया जाता है. इससे पता चलता है कि वीएम के पास अनुमति नहीं है.
वर्चुअल मशीनों के बीच लागू की गई नीतियों के बारे में ज़्यादा जानने के लिए, वीएम-लेवल की अनुमतियां देखें.