OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 syntax = "proto2"; | 5 syntax = "proto2"; |
6 | 6 |
7 import "cloud_policy.proto"; | |
8 | |
9 option optimize_for = LITE_RUNTIME; | 7 option optimize_for = LITE_RUNTIME; |
10 | 8 |
11 package enterprise_management; | 9 package enterprise_management; |
12 | 10 |
13 // Protocol buffers for the obsolete protocol: | 11 // Meta-settings that control how a user receives regular settings |
14 // ------------------------------------------- | 12 // (CloudPolicySettings) for Chrome. The name "Initial" indicates that |
15 // GenericValue, GenericNamedValue, GenericSetting, DevicePolicySetting, | 13 // these settings will be downloaded before Chrome starts requesting |
16 // DevicePolicySettingRequest, DevicePolicyRequest, DevicePolicyResponse | 14 // regular settings. |
17 // TODO(gfeher): Remove these when both Chrome and DMServer is switched to | 15 message ChromeInitialSettingsProto { |
18 // using the new protocol. | 16 enum EnrollmentProvision { |
| 17 // The users's device is not automatically enrolled for policies, but the |
| 18 // user may choose to try to enroll it. |
| 19 UNMANAGED = 0; |
| 20 // The user must enroll its device for policies. |
| 21 MANAGED = 1; |
| 22 } |
| 23 // Chrome will interpret this as UNMANAGED if unset. |
| 24 optional EnrollmentProvision enrollment_provision = 1 [default = UNMANAGED]; |
| 25 } |
| 26 |
| 27 // A setting is a set of generic name value pairs. |
| 28 // TODO(gfeher): remove this after Chrome OS TT is over. |
| 29 message GenericSetting { |
| 30 repeated GenericNamedValue named_value = 1; |
| 31 } |
19 | 32 |
20 // Generic value container. | 33 // Generic value container. |
21 message GenericValue { | 34 message GenericValue { |
22 enum ValueType { | 35 enum ValueType { |
23 VALUE_TYPE_BOOL = 1; | 36 VALUE_TYPE_BOOL = 1; |
24 VALUE_TYPE_INT64 = 2; | 37 VALUE_TYPE_INT64 = 2; |
25 VALUE_TYPE_STRING = 3; | 38 VALUE_TYPE_STRING = 3; |
26 VALUE_TYPE_DOUBLE = 4; | 39 VALUE_TYPE_DOUBLE = 4; |
27 VALUE_TYPE_BYTES = 5; | 40 VALUE_TYPE_BYTES = 5; |
28 VALUE_TYPE_BOOL_ARRAY = 6; | 41 VALUE_TYPE_BOOL_ARRAY = 6; |
(...skipping 15 matching lines...) Expand all Loading... |
44 repeated string string_array = 9; | 57 repeated string string_array = 9; |
45 repeated double double_array = 10; | 58 repeated double double_array = 10; |
46 } | 59 } |
47 | 60 |
48 // Generic name value pair container. | 61 // Generic name value pair container. |
49 message GenericNamedValue { | 62 message GenericNamedValue { |
50 required string name = 1; | 63 required string name = 1; |
51 optional GenericValue value = 2; | 64 optional GenericValue value = 2; |
52 } | 65 } |
53 | 66 |
54 // A setting is a set of generic name value pairs. | |
55 message GenericSetting { | |
56 repeated GenericNamedValue named_value = 1; | |
57 } | |
58 | |
59 // Identify a single device policy setting key/value pair. | 67 // Identify a single device policy setting key/value pair. |
| 68 // TODO(gfeher): remove this after Chrome OS TT is over. |
60 message DevicePolicySetting { | 69 message DevicePolicySetting { |
61 // key of the policy setting | 70 // key of the policy setting |
62 required string policy_key = 1; | 71 required string policy_key = 1; |
63 // value of the setting | 72 // value of the setting |
64 optional GenericSetting policy_value = 2; | 73 optional GenericSetting policy_value = 2; |
65 // watermark for setting value. | 74 // watermark for setting value. |
66 optional string watermark = 3; | 75 optional string watermark = 3; |
67 } | 76 } |
68 | 77 |
| 78 // Request from device to server to register device. |
| 79 message DeviceRegisterRequest { |
| 80 // Reregister device without erasing server state. It can be used |
| 81 // to refresh dmtoken etc. Client MUST set this value to true if it |
| 82 // reuses an existing device id. |
| 83 optional bool reregister = 1; |
| 84 |
| 85 // Device register type. This field does not exist for TT release. |
| 86 // When a client requests for policies, server should verify the |
| 87 // client has been registered properly. For example, a client must |
| 88 // register with type DEVICE in order to retrieve device policies. |
| 89 enum Type { |
| 90 TT = 0; // Register for TT release. |
| 91 USER = 1; // Register for user polices. |
| 92 DEVICE = 2; // Register for device policies. |
| 93 } |
| 94 // NOTE: we also use this field to detect client version. If this |
| 95 // field is missing, then the request comes from TT. We will remove |
| 96 // Chrome OS TT support once it is over. |
| 97 optional Type type = 2 [default = TT]; |
| 98 |
| 99 // Machine hardware id, such as MEID, Mac adress. |
| 100 // This field is required if register type == DEVICE. |
| 101 optional string machine_id = 3; |
| 102 |
| 103 // Machine model name, such as "ZGA", "Cr-48", "Nexus One". If the |
| 104 // model name is not available, client SHOULD send generic name like |
| 105 // "Android", or "Chrome OS". |
| 106 optional string machine_model = 4; |
| 107 } |
| 108 |
| 109 // Response from server to device register request. |
| 110 message DeviceRegisterResponse { |
| 111 // Device mangement token for this registration. This token MUST be |
| 112 // part of HTTP Authorization header for all future requests from |
| 113 // device to server. |
| 114 required string device_management_token = 1; |
| 115 |
| 116 // Device display name. By default, server generates the name in |
| 117 // the format of "Machine Model - Machine Id". However, domain |
| 118 // admin can update it using CPanel, so do NOT treat it as constant. |
| 119 optional string machine_name = 2; |
| 120 } |
| 121 |
| 122 // Request from device to server to unregister device. |
| 123 // GoogleDMToken MUST be in HTTP Authorization header. |
| 124 message DeviceUnregisterRequest { |
| 125 } |
| 126 |
| 127 // Response from server to device for unregister request. |
| 128 message DeviceUnregisterResponse { |
| 129 } |
| 130 |
69 // Request for a setting or with optional watermark on client side. | 131 // Request for a setting or with optional watermark on client side. |
| 132 // TODO(gfeher): remove this after Chrome OS TT is over. |
70 message DevicePolicySettingRequest { | 133 message DevicePolicySettingRequest { |
71 // setting key | 134 // setting key |
72 required string key = 1; | 135 required string key = 1; |
73 // watermark last read from server if available. | 136 // watermark last read from server if available. |
74 optional string watermark = 2; | 137 optional string watermark = 2; |
75 } | 138 } |
76 | 139 |
77 // Request from device to server to read device policies. | 140 message PolicyFetchRequest { |
| 141 // This is the policy type, which maps to D3 policy type internally. |
| 142 // By convention, we use "/" as separator to create policy namespace. |
| 143 // The policy type names are case insensitive. |
| 144 // |
| 145 // Possible values for Chrome OS are: |
| 146 // google/chromeos/device => ChromeSettingsProto |
| 147 // google/chromeos/user => ChromeSettingsProto |
| 148 // google/chromeos/unregistered_user => ChromeInitialSettingsProto |
| 149 optional string policy_type = 1; |
| 150 |
| 151 // This is the last policy timestamp that client received from server. |
| 152 optional int64 timestamp = 2; |
| 153 |
| 154 // Tell server what kind of security signature is required. |
| 155 enum SignatureType { |
| 156 NONE = 0; |
| 157 X509 = 1; |
| 158 } |
| 159 optional SignatureType signature_type = 3 [default = NONE]; |
| 160 } |
| 161 |
| 162 // This message is included in serialized form in PolicyFetchResponse |
| 163 // below. It may also be signed, with the signature being created for |
| 164 // the serialized form. |
| 165 message PolicyData { |
| 166 // See PolicyFetchRequest.policy_type. |
| 167 optional string policy_type = 1; |
| 168 |
| 169 // [timestamp] is milli seconds since Epoch in UTC timezone. It is |
| 170 // included here so that the time at which the server issued this |
| 171 // response cannot be faked (as protection against replay attacks). |
| 172 // It is the timestamp generated by DMServer, NOT the time admin |
| 173 // last updated the policy or anything like that. |
| 174 optional int64 timestamp = 2; |
| 175 |
| 176 // The DM token that was used by the client in the HTTP POST header |
| 177 // for authenticating the request. It is included here again so that |
| 178 // the client can verify that the response is meant for him (and not |
| 179 // issued by a replay or man-in-the-middle attack). |
| 180 optional string request_token = 3; |
| 181 |
| 182 // The serialized value of the actual policy protobuf. This can be |
| 183 // deserialized to an instance of, for example, ChromeSettingsProto |
| 184 // or ChromeUserSettingsProto. |
| 185 optional bytes policy_value = 4; |
| 186 |
| 187 // The device display name assigned by the server. It is only |
| 188 // filled if the display name is available. |
| 189 // |
| 190 // The display name of the machine as generated by the server or set |
| 191 // by the Administrator in the CPanel GUI. This is the same thing as |
| 192 // |machine_name| in DeviceRegisterResponse but it might have |
| 193 // changed since then. |
| 194 optional string machine_name = 5; |
| 195 } |
| 196 |
| 197 message PolicyFetchResponse { |
| 198 // Since a single policy request may ask for multiple policies, we |
| 199 // provide separate error code for each individual policy fetch. |
| 200 |
| 201 // We will use standard HTTP Status Code as error code. |
| 202 optional int32 error_code = 1; |
| 203 |
| 204 // Human readable error message for customer support purpose. |
| 205 optional string error_message = 2; |
| 206 |
| 207 // This is a serialized bytes of PolicyData protobuf above. |
| 208 optional bytes policy_data = 3; |
| 209 |
| 210 // Signature of the policy data above. |
| 211 optional bytes policy_data_signature = 4; |
| 212 |
| 213 // The chain of DER-encoded X.509 certificates of the server's |
| 214 // signing key. The first element should be the certificate whose |
| 215 // private key was used for signing the response, and each of the |
| 216 // following certificates signs the previous one. |
| 217 // |
| 218 // If this field does not exist, it means the policy_data is not |
| 219 // signed. |
| 220 repeated bytes certificate_chain = 5; |
| 221 } |
| 222 |
| 223 // Request from device to server for reading policies. |
78 message DevicePolicyRequest { | 224 message DevicePolicyRequest { |
79 // identify request scope: CrOS settings or other type of settings. | 225 // identify request scope: CrOS settings or other type of settings. |
| 226 // TODO(gfeher): remove this after Chrome OS TT is over. |
80 optional string policy_scope = 1; | 227 optional string policy_scope = 1; |
81 // identify key to the settings: proxy etc. | 228 // identify key to the settings: proxy etc. |
| 229 // TODO(gfeher): remove this after Chrome OS TT is over. |
82 repeated DevicePolicySettingRequest setting_request = 2; | 230 repeated DevicePolicySettingRequest setting_request = 2; |
83 } | 231 |
84 | 232 // The policy fetch request. If this field exists, the request must |
85 // Response from server to agent for reading policies. | 233 // comes from a non-TT client. The repeated field allows client to |
| 234 // request multiple policies for better performance. |
| 235 repeated PolicyFetchRequest request = 3; |
| 236 } |
| 237 |
| 238 // Response from server to device for reading policies. |
86 message DevicePolicyResponse { | 239 message DevicePolicyResponse { |
87 // the result of the settings. | 240 // the result of the settings. |
| 241 // TODO(gfeher): remove this after Chrome OS TT is over. |
88 repeated DevicePolicySetting setting = 1; | 242 repeated DevicePolicySetting setting = 1; |
89 } | 243 |
90 | 244 // The policy fetch response. |
91 // Request from device to server to register device. The response will include | 245 repeated PolicyFetchResponse response = 3; |
92 // a device token that can be used to query policies. | 246 } |
93 message DeviceRegisterRequest { | 247 |
94 // reregister device without erasing server state. | 248 // Request from the DMAgent on the device to the DMServer. This is |
95 // it can be used to refresh dmtoken etc. | 249 // container for all requests from device to server. The overall HTTP |
96 optional bool reregister = 1; | 250 // request MUST be in the following format: |
97 } | |
98 | |
99 // Response from server to device register request. | |
100 message DeviceRegisterResponse { | |
101 // device mangement toke for this registration. | |
102 required string device_management_token = 1; | |
103 } | |
104 | |
105 // Protocol buffers for the new protocol: | |
106 // -------------------------------------- | |
107 | |
108 // Request from device to server to get policies for an unregistered user. | |
109 // These are actually "meta-policies", that control the rules for the user | |
110 // about enrolling for real policies. | |
111 message InitialPolicyRequest { | |
112 } | |
113 | |
114 message InitialPolicySettings { | |
115 enum EnrollmentRule { | |
116 // The user must enroll its device for policies. | |
117 MANAGED = 1; | |
118 // The users's device is not automatically enrolled for policies, but the | |
119 // user may choose to try to enroll it. | |
120 UNMANAGED = 2; | |
121 } | |
122 | |
123 optional EnrollmentRule enrollment_rule = 1; | |
124 } | |
125 | |
126 // Response from server to device containing the policies available before | |
127 // registration. | |
128 message InitialPolicyResponse { | |
129 optional InitialPolicySettings settings = 1; | |
130 } | |
131 | |
132 // Request from device to server to unregister device management token. | |
133 message DeviceUnregisterRequest { | |
134 } | |
135 | |
136 // Response from server to unregister request. | |
137 message DeviceUnregisterResponse { | |
138 } | |
139 | |
140 // Request from device to server to register device. The response will include | |
141 // a device token that can be used to query policies. | |
142 message CloudRegisterRequest { | |
143 enum Type { | |
144 // Requesting token for user policies. | |
145 USER = 1; | |
146 // Requesting token for device policies. | |
147 DEVICE = 2; | |
148 } | |
149 optional Type type = 1; | |
150 // Unique identifier of the machine. Only set if type == DEVICE. | |
151 // This won't be sent in later requests, the machine can be identified | |
152 // by its device token. | |
153 optional string machine_id = 2; | |
154 } | |
155 | |
156 // Response from server to device register request. | |
157 message CloudRegisterResponse { | |
158 // Token for this registration. | |
159 required string device_management_token = 1; | |
160 | |
161 // The name of the requesting device, assigned by the server. | |
162 optional string machine_name = 2; | |
163 } | |
164 | |
165 message CloudPolicyRequest { | |
166 // Identify request scope: chromeos/device for device policies, chromeos/user | |
167 // for user policies. Only those policy scopes will be served, that are | |
168 // allowed by the type choice in CloudRegisterRequest. | |
169 optional string policy_scope = 1; | |
170 | |
171 // The token used to query device policies on the device sending the request. | |
172 // Note, that the token used for actual authentication is sent in an HTTP | |
173 // header. These two tokens are the same if this request is for querying | |
174 // device policies and they differ if this request is for querying user | |
175 // policies. In the second case, the server can use device_policy_token to | |
176 // identify the device and determine if the user is allowed to get policies | |
177 // on the given device. | |
178 optional string device_policy_token = 2; | |
179 } | |
180 | |
181 // Response from server to device for reading policies. | |
182 message CloudPolicyResponse { | |
183 // Serialized SignedCloudPolicyResponse. | |
184 optional bytes signed_response = 1; | |
185 // RSA signature of the SHA1 hash of the above data. | |
186 optional bytes signature = 2; | |
187 // The chain of DER-encoded X.509 certificates of the server's signing key. | |
188 // The first element should be the certificate whose private key was used | |
189 // for signing the response, and each of the following certificates signs the | |
190 // previous one. | |
191 repeated bytes certificate_chain = 3; | |
192 } | |
193 message SignedCloudPolicyResponse { | |
194 // The following two are necessary against replay attacks. | |
195 // |timestamp| is a unix timestamp (seconds since 1970). | |
196 optional int64 timestamp = 1; | |
197 // The token that was used for the request. | |
198 optional string request_token = 2; | |
199 // The name of the device, assigned by the server. | |
200 optional string device_name = 3; | |
201 // CloudPolicySettings is defined in cloud_policy.proto (which is | |
202 // auto-generated from chrome/app/policy_templates.json). | |
203 optional CloudPolicySettings settings = 4; | |
204 } | |
205 | |
206 // Request from the DMAgent on the device to the DMServer. | |
207 // This is container for all requests from client. | |
208 // | 251 // |
209 // Http Query parameters: | 252 // * HTTP method is POST |
210 // Query parameters contain the following information in each request: | 253 // * Data mime type is application/x-protobuffer |
211 // request: register/unregister/policy/cloud_policy/cloud_register/ | 254 // * HTTP parameters are (all required, all case sensitive): |
212 // initial_policy | 255 // * request: MUST BE one of register/unregister/policy/ping |
213 // devicetype: CrOS/Android/Iphone etc. | 256 // * devicetype: MUST BE "1" for Android or "2" for Chrome OS. |
214 // apptype: CrOS/AndroidDM etc. | 257 // * apptype: MUST BE Android or Chrome. |
215 // agent: identify agent on device. | 258 // * deviceid: MUST BE no more than 64-char in [\x20-\x7E]. |
| 259 // * agent: MUST BE no more than 64-char long. |
| 260 // * HTTP Authorization header MUST be in the following formats: |
| 261 // * For register and ping requests |
| 262 // Authorization: GoogleLogin auth=<auth cookie for Mobile Sync> |
216 // | 263 // |
217 // Authorization: | 264 // * For unregister and policy requests |
218 // 1. If request is initial_policy, client must pass in GoogleLogin | 265 // Authorization: GoogleDMToken token=<dm token from register> |
219 // auth cookie in Authorization header: | |
220 // Authorization: GoogleLogin auth=<auth cookie> | |
221 // The response will contain settings that a user can get without | |
222 // registration. Currently the only such setting is a flag indicating if the | |
223 // user is in a managed domain or not. (We don't want to expose device ids of | |
224 // users not in managed domains.) | |
225 // 2. If request is register_request, client must pass in GoogleLogin auth | |
226 // cookie in Authorization header: | |
227 // Authorization: GoogleLogin auth=<auth cookie> | |
228 // The response will contain an unique DMToken for future requests. | |
229 // Depending on domain policy, the request may need admin approval before | |
230 // DMToken is issued. | |
231 // 3. For other requests, client must pass in DMToken in Authorization header: | |
232 // Authorization: GoogleDMToken token=<google dm token> | |
233 // | 266 // |
| 267 // * OAuth is NOT supported yet. |
234 message DeviceManagementRequest { | 268 message DeviceManagementRequest { |
235 // Register request (old protocol). | 269 // Register request. |
236 optional DeviceRegisterRequest register_request = 1; | 270 optional DeviceRegisterRequest register_request = 1; |
237 | 271 |
238 // Unregister request. | 272 // Unregister request. |
239 optional DeviceUnregisterRequest unregister_request = 2; | 273 optional DeviceUnregisterRequest unregister_request = 2; |
240 | 274 |
241 // Data request. | 275 // Policy request. |
242 optional DevicePolicyRequest policy_request = 3; | 276 optional DevicePolicyRequest policy_request = 3; |
243 | |
244 // Data request (new protocol). | |
245 optional CloudPolicyRequest cloud_policy_request = 4; | |
246 | |
247 // Request for initial (before registration) policies. | |
248 optional InitialPolicyRequest initial_policy_request = 5; | |
249 | |
250 // Register request (new protocol). | |
251 optional CloudRegisterRequest cloud_register_request = 6; | |
252 } | 277 } |
253 | 278 |
254 // Response from server to device. | 279 // Response from server to device. |
255 message DeviceManagementResponse { | 280 message DeviceManagementResponse { |
256 // Error code to client. | 281 // Error code to client. |
257 enum ErrorCode { | 282 enum ErrorCode { |
258 SUCCESS = 0; | 283 SUCCESS = 0; |
259 // Returned for register request when device management is not supported | 284 // Returned for register request when device management is not supported |
260 // for the domain. | 285 // for the domain. |
261 DEVICE_MANAGEMENT_NOT_SUPPORTED = 1; | 286 DEVICE_MANAGEMENT_NOT_SUPPORTED = 1; |
262 // Returned when the device is not found. | 287 // Returned when the device is not found. |
263 DEVICE_NOT_FOUND = 2; | 288 DEVICE_NOT_FOUND = 2; |
264 // Returned when passed in device management token doesn't match the token | 289 // Returned when passed in device management token doesn't match the token |
265 // on server side. | 290 // on server side. |
266 DEVICE_MANAGEMENT_TOKEN_INVALID = 3; | 291 DEVICE_MANAGEMENT_TOKEN_INVALID = 3; |
267 // Returned when device registration is pending approval (if required). | 292 // Returned when device registration is pending approval (if required). |
268 ACTIVATION_PENDING = 4; | 293 ACTIVATION_PENDING = 4; |
269 // Returned when the policy is not found. | 294 // Returned when the policy is not found. |
270 POLICY_NOT_FOUND = 5; | 295 POLICY_NOT_FOUND = 5; |
271 } | 296 } |
272 | 297 |
273 // Error code for this request. | 298 // Error code for this request. |
274 required ErrorCode error = 1; | 299 required ErrorCode error = 1; |
275 | 300 |
276 // Error message. | 301 // Error message. |
277 optional string error_message = 2; | 302 optional string error_message = 2; |
278 | 303 |
279 // Register response (old protocol). | 304 // Register response |
280 optional DeviceRegisterResponse register_response = 3; | 305 optional DeviceRegisterResponse register_response = 3; |
281 | 306 |
282 // Unregister response | 307 // Unregister response |
283 optional DeviceUnregisterResponse unregister_response = 4; | 308 optional DeviceUnregisterResponse unregister_response = 4; |
284 | 309 |
285 // Policy response. | 310 // Policy response. |
286 optional DevicePolicyResponse policy_response = 5; | 311 optional DevicePolicyResponse policy_response = 5; |
287 | |
288 // Policy response (new protocol). | |
289 optional CloudPolicyResponse cloud_policy_response = 6; | |
290 | |
291 // Response to initial (before registration) policy request. | |
292 optional InitialPolicyResponse initial_policy_response = 7; | |
293 | |
294 // Register response (new protocol). | |
295 optional CloudRegisterResponse cloud_register_response = 8; | |
296 } | 312 } |
OLD | NEW |