1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 option optimize_for = LITE_RUNTIME;
9 package enterprise_management;
11 // Request from device to server to register device.
12 message DeviceRegisterRequest {
13 // Reregister device without erasing server state. It can be used
14 // to refresh dmtoken etc. Client MUST set this value to true if it
15 // reuses an existing device id.
16 optional bool reregister = 1;
18 // Device register type. This field does not exist for TT release.
19 // When a client requests for policies, server should verify the
20 // client has been registered properly. For example, a client must
21 // register with type DEVICE in order to retrieve device policies.
23 TT = 0; // Register for TT release.
24 USER = 1; // Register for Chrome OS user polices.
25 DEVICE = 2; // Register for device policies.
26 BROWSER = 3; // Register for Chrome user policies.
27 ANDROID_BROWSER = 4; // Register for Android Chrome browser user policies.
28 IOS_BROWSER = 5; // Register for iOS Chrome browser user policies.
30 // NOTE: we also use this field to detect client version. If this
31 // field is missing, then the request comes from TT. We will remove
32 // Chrome OS TT support once it is over.
33 optional Type type = 2 [default = TT];
35 // Machine hardware id, such as serial number.
36 // This field is required if register type == DEVICE.
37 optional string machine_id = 3;
39 // Machine model name, such as "ZGA", "Cr-48", "Nexus One". If the
40 // model name is not available, client SHOULD send generic name like
41 // "Android", or "Chrome OS".
42 optional string machine_model = 4;
44 // OBSOLETE: Legacy auto-enrollment is not longer supported.
45 optional bool OBSOLETE_auto_enrolled = 5 [deprecated = true];
47 // Indicates a requisition of the registering entity that the server can act
48 // upon. This allows clients to pass hints e.g. at device enrollment time
49 // about the intended use of the device.
50 optional string requisition = 6;
52 // The current server-backed state key for the client, if applicable. This can
53 // be used by the server to link the registration request to an existing
54 // device record for re-enrollment.
55 optional bytes server_backed_state_key = 7;
57 // Enumerates different flavors of registration.
59 // User manually enrolls a device for device management.
60 FLAVOR_ENROLLMENT_MANUAL = 0;
61 // User re-starts enrollment manually to recover from loss of policy.
62 FLAVOR_ENROLLMENT_MANUAL_RENEW = 1;
63 // Device enrollment forced by local device configuration, such as OEM
64 // partition flags to force enrollment.
65 FLAVOR_ENROLLMENT_LOCAL_FORCED = 2;
66 // Enrollment advertised by local device configuration, such as OEM
67 // partition flags indicating to prompt for enrollment, but allowing the
69 FLAVOR_ENROLLMENT_LOCAL_ADVERTISED = 3;
70 // Device state downloaded from the server during OOBE indicates that
71 // (re-)enrollment is mandatory.
72 FLAVOR_ENROLLMENT_SERVER_FORCED = 4;
73 // Device state downloaded from the server during OOBE indicates that the
74 // device should prompt for (re-)enrollment, but the user is allowed to
76 FLAVOR_ENROLLMENT_SERVER_ADVERTISED = 5;
77 // Device detected in steady state that it is supposed to be enrolled, but
78 // the policy is missing.
79 FLAVOR_ENROLLMENT_RECOVERY = 6;
80 // User policy registration for a logged-in user.
81 FLAVOR_USER_REGISTRATION = 7;
84 // Indicates the registration flavor. This is passed to the server FYI when
85 // registering for policy so the server can distinguish registration triggers.
86 optional Flavor flavor = 8;
89 // Response from server to device register request.
90 message DeviceRegisterResponse {
91 // Device management token for this registration. This token MUST be
92 // part of HTTP Authorization header for all future requests from
94 required string device_management_token = 1;
96 // Device display name. By default, server generates the name in
97 // the format of "Machine Model - Machine Id". However, domain
98 // admin can update it using CPanel, so do NOT treat it as constant.
99 optional string machine_name = 2;
101 // Enum listing the possible modes the device should be locked into when the
102 // registration is finished.
104 // In ENTERPRISE mode the device has no local owner and device settings are
105 // controlled through the cloud policy infrastructure. Auto-enrollment is
106 // supported in that mode.
108 // Devices in RETAIL mode also have no local owner and get their device
109 // settings from the cloud, but additionally this mode enables the demo
110 // account on the device.
113 optional DeviceMode enrollment_type = 3 [default = ENTERPRISE];
116 // Request from device to server to unregister device.
117 // GoogleDMToken MUST be in HTTP Authorization header.
118 message DeviceUnregisterRequest {
121 // Response from server to device for unregister request.
122 message DeviceUnregisterResponse {
125 // Request from device to server to upload device EMCert
126 // (enterprise machine cert used for remote attestation).
127 // GoogleDMToken MUST be in HTTP Authorization header.
128 message DeviceCertUploadRequest {
129 // EMCert in X.509 format.
130 optional bytes device_certificate = 1;
133 // Response from server to device for cert upload request.
134 message DeviceCertUploadResponse {
137 // Request to access a Google service with the given scope.
138 message DeviceServiceApiAccessRequest {
139 // The list of auth scopes the device requests from DMServer.
140 repeated string auth_scope = 1;
142 // OAuth2 client ID to which the returned authorization code is bound.
143 optional string oauth2_client_id = 2;
146 message DeviceServiceApiAccessResponse {
147 // The OAuth2 authorization code for the requested scope(s).
148 // This can be exchanged for a refresh token.
149 optional string auth_code = 1;
152 message PolicyFetchRequest {
153 // This is the policy type, which maps to D3 policy type internally.
154 // By convention, we use "/" as separator to create policy namespace.
155 // The policy type names are case insensitive.
157 // Possible values for Chrome OS are:
158 // google/chromeos/device => ChromeDeviceSettingsProto
159 // google/chromeos/user => ChromeSettingsProto
160 // google/chromeos/publicaccount => ChromeSettingsProto
161 // google/chrome/extension => ExternalPolicyData
162 // google/android/user => ChromeSettingsProto
163 // google/ios/user => ChromeSettingsProto
164 optional string policy_type = 1;
166 // This is the last policy timestamp that client received from server.
167 optional int64 timestamp = 2;
169 // Tell server what kind of security signature is required.
174 optional SignatureType signature_type = 3 [default = NONE];
176 // The version number of the public key that is currently stored
177 // on the client. This should be the last number the server had
178 // supplied as new_public_key_version in PolicyData.
179 // This field is unspecified if the client does not yet have a
181 optional int32 public_key_version = 4;
183 // Machine hardware id, such as serial number.
184 // This field is should be set only if the serial number for the device is
185 // missing from the server, as indicated by the valid_serial_number_missing
186 // field in the last policy fetch response.
187 optional string machine_id = 5;
189 // This field is used for devices to send the additional ID to fetch settings.
190 // Retrieving some settings requires more than just device or user ID.
191 // For example, to retrieve public account, devices need to pass in
192 // public account ID in addition to device ID. To retrieve extension or
193 // plug-in settings, devices need to pass in extension/plug-in ID in
194 // addition to user ID.
195 // policy_type represents the type of settings (e.g. public account,
196 // extension) devices request to fetch.
197 optional string settings_entity_id = 6;
199 // If this fetch is due to a policy invalidation, this field contains the
200 // version provided with the invalidation. The server interprets this value
201 // and the value of invalidation_payload to fetch the up-to-date policy.
202 optional int64 invalidation_version = 7;
204 // If this fetch is due to a policy invalidation, this field contains the
205 // payload delivered with the invalidation. The server interprets this value
206 // and the value of invalidation_version to fetch the up-to-date policy.
207 optional bytes invalidation_payload = 8;
209 // Hash string for the chrome policy verification public key which is embedded
210 // into Chrome binary. Matching private key will be used by the server
211 // to sign per-domain policy keys during key rotation. If server does not
212 // have the key which matches this hash string, that could indicate malicious
213 // or out-of-date Chrome client.
214 optional string verification_key_hash = 9;
217 // This message customizes how the device behaves when it is disabled by its
218 // owner. The message will be sent as part of the DeviceState fetched during
219 // normal operation and as part of the DeviceStateRetrievalResponse fetched when
220 // the device is wiped/reinstalled.
221 message DisabledState {
222 // A message to the finder/thief that should be shown on the screen.
223 optional string message = 1;
226 message DeviceState {
227 // Modes of operation that the device can be in.
229 // The device is operating normally. Sessions can be started and the device
231 DEVICE_MODE_NORMAL = 0;
232 // The device has been disabled by its owner. The device will show a warning
233 // screen and will not allow any sessions to be started.
234 DEVICE_MODE_DISABLED = 1;
236 // The mode of operation that the device should be in.
237 optional DeviceMode device_mode = 1 [default = DEVICE_MODE_NORMAL];
239 // State that is relevant only when the |device_mode| is
240 // |DEVICE_MODE_DISABLED|.
241 optional DisabledState disabled_state = 2;
244 // This message is included in serialized form in PolicyFetchResponse
245 // below. It may also be signed, with the signature being created for
246 // the serialized form.
248 // See PolicyFetchRequest.policy_type.
249 optional string policy_type = 1;
251 // [timestamp] is milliseconds since Epoch in UTC timezone. It is
252 // included here so that the time at which the server issued this
253 // response cannot be faked (as protection against replay attacks).
254 // It is the timestamp generated by DMServer, NOT the time admin
255 // last updated the policy or anything like that.
256 optional int64 timestamp = 2;
258 // The DM token that was used by the client in the HTTP POST header
259 // for authenticating the request. It is included here again so that
260 // the client can verify that the response is meant for him (and not
261 // issued by a replay or man-in-the-middle attack).
262 optional string request_token = 3;
264 // The serialized value of the actual policy protobuf. This can be
265 // deserialized to an instance of, for example, ChromeSettingsProto,
266 // ChromeDeviceSettingsProto, or ExternalPolicyData.
267 optional bytes policy_value = 4;
269 // The device display name assigned by the server. It is only
270 // filled if the display name is available.
272 // The display name of the machine as generated by the server or set
273 // by the Administrator in the CPanel GUI. This is the same thing as
274 // |machine_name| in DeviceRegisterResponse but it might have
275 // changed since then.
276 optional string machine_name = 5;
278 // Version number of the server's current public key. (The key that
279 // was used to sign this response. Numbering should start at 1 and be
280 // increased by 1 at each key rotation.)
281 optional int32 public_key_version = 6;
283 // The user this policy is intended for. In case of device policy, the name
284 // of the owner (who registered the device).
285 optional string username = 7;
287 // In this field the DMServer should echo back the "deviceid" HTTP parameter
289 optional string device_id = 8;
291 // Indicates which state this association with DMServer is in. This can be
292 // used to tell the client that it is not receiving policy even though the
293 // registration with the server is kept active.
294 enum AssociationState {
295 // Association is active and policy is pushed.
297 // Association is alive, but the corresponding domain is not managed.
299 // Client got dropped on the server side.
302 optional AssociationState state = 9 [default = ACTIVE];
304 // Indicates if the the server cannot find a valid serial number for the
305 // device. If this flag is set, the device should send the valid serial
306 // number with a device policy fetch request. Note that this only
307 // applies to device policy.
308 optional bool valid_serial_number_missing = 10;
310 // Indicates which public account or extension/plug-in this policy data is
311 // for. See PolicyFetchRequest.settings_entity_id for more details.
312 optional string settings_entity_id = 11;
314 // Indicates the identity the device service account is associated with.
315 // This is only sent as part of device policy fetch.
316 optional string service_account_identity = 12;
318 // The object source which hosts policy objects within the invalidation
319 // service. This value is combined with invalidation_name to form the object
320 // id used to register for invalidations to this policy.
321 optional int32 invalidation_source = 13;
323 // The name which uniquely identifies this policy within the invalidation
324 // service object source. This value is combined with invalidation_source to
325 // form the object id used to register for invalidations to this policy.
326 optional bytes invalidation_name = 14;
328 // Server-provided identifier of the fetched policy. This is to be used
329 // by the client when requesting Policy Posture assertion through an API
330 // call or SAML flow.
331 optional string policy_token = 15;
333 // Indicates the management mode of the device. Note that old policies do not
334 // have this field. If this field is not set but request_token is set, assume
335 // the management mode is ENTERPRISE_MANAGED. If both this field and
336 // request_token are not set, assume the management mode is LOCAL_OWNER.
337 enum ManagementMode {
338 // The device is owned locally. The policies are set by the local owner of
341 // The device is enterprise-managed. The policies come from the enterprise
342 // server. See the comment above for backward compatibility.
343 ENTERPRISE_MANAGED = 1;
344 // The device is consumer-managed. The policies currently can only be set
345 // by the local owner of the device.
346 CONSUMER_MANAGED = 2;
348 optional ManagementMode management_mode = 16;
350 // Indicates the state that the device should be in.
351 optional DeviceState device_state = 17;
354 message PolicyFetchResponse {
355 // Since a single policy request may ask for multiple policies, we
356 // provide separate error code for each individual policy fetch.
358 // We will use standard HTTP Status Code as error code.
359 optional int32 error_code = 1;
361 // Human readable error message for customer support purpose.
362 optional string error_message = 2;
364 // This is a serialized |PolicyData| protobuf (defined above).
365 optional bytes policy_data = 3;
367 // Signature of the policy data above.
368 optional bytes policy_data_signature = 4;
370 // If the public key has been rotated on the server, the new public
371 // key is sent here. It is already used for |policy_data_signature|
372 // above, whereas |new_public_key_signature| is created using the
373 // old key (so the client can trust the new key). If this is the
374 // first time when the client requests policies (so it doesn't have
375 // on old public key), then |new_public_key_signature| is empty.
376 optional bytes new_public_key = 5;
377 optional bytes new_public_key_signature = 6;
379 // If new_public_key is specified, this field contains a signature
380 // of a PolicyPublicKeyAndDomain protobuf, signed using a key only
381 // available to DMServer. The public key portion of this well-known key is
382 // embedded into the Chrome binary. The hash of that embedded key is passed
383 // to DMServer as verification_key_hash field in PolicyFetchRequest. DMServer
384 // will pick a private key on the server which matches the hash (matches
385 // public key on the client). If DMServer is unable to find matching key, it
386 // will return an error instead of policy data.
387 // In case hash was not specified, DMServer will leave verification signature
388 // field empty (legacy behavior).
389 // In addition to the checks between new_public_key
390 // and new_public_key_signature described above, Chrome also verifies
391 // new_public_key with the embedded public key and
392 // new_public_key_verification_signature.
393 optional bytes new_public_key_verification_signature = 7;
396 // Protobuf used to generate the new_public_key_verification_signature field.
397 message PolicyPublicKeyAndDomain {
398 // The public key to sign (taken from the |new_public_key| field in
399 // PolicyFetchResponse).
400 optional bytes new_public_key = 1;
402 // The domain associated with this key (should match the domain portion of
403 // the username field of the policy).
404 optional string domain = 2;
407 // This protobuf defines a single remote command from server to client for
409 message RemoteCommand {
411 // Simple echo command for testing, will be ignored in production code.
412 COMMAND_ECHO_TEST = -1;
414 // Reboot the device.
419 optional Type type = 1;
421 // An opaque unique identifier for the command.
422 optional int64 unique_id = 2;
424 // The time at which the command was issued, in milliseconds.
425 optional int64 timestamp = 3;
427 // Extra parameters for this command, might be a serialization of another
429 optional bytes payload = 4;
432 // This protobuf defines the execution result of a single remote command
433 // which will be sent back to the server.
434 message RemoteCommandResult {
436 RESULT_IGNORED = 0; // The command was ignored as obsolete.
437 RESULT_FAILURE = 1; // The command could not be executed.
438 RESULT_SUCCESS = 2; // The command was successfully executed.
441 // The result of the command.
442 optional ResultType result = 1;
444 // The opaque unique identifier of the command. This value is copied from the
445 // RemoteCommand protobuf that contained the command.
446 optional int64 unique_id = 2;
448 // The time at which the command was executed, if the the result is
450 optional int64 timestamp = 3;
452 // Extra information sent to server as result of execution, might be a
453 // serialization of another protobuf.
454 optional bytes payload = 4;
457 message DeviceRemoteCommandRequest {
458 // The command ID of the last command received from the server until
459 // now. Omitted if no commands have been received yet.
460 optional int64 last_command_unique_id = 1;
462 // The execution results of previously fetched commands.
463 // The client should send back a command result whenever possible.
464 repeated RemoteCommandResult command_results = 2;
467 message DeviceRemoteCommandResponse {
468 // The queue of pending commands.
469 repeated RemoteCommand commands = 1;
472 // Request from device to server for reading policies.
473 message DevicePolicyRequest {
474 // The policy fetch request. If this field exists, the request must
475 // comes from a non-TT client. The repeated field allows client to
476 // request multiple policies for better performance.
477 repeated PolicyFetchRequest request = 3;
480 // Response from server to device for reading policies.
481 message DevicePolicyResponse {
482 // The policy fetch response.
483 repeated PolicyFetchResponse response = 3;
487 // [timestamp] is milli seconds since Epoch in UTC timezone.
488 optional int64 start_timestamp = 1;
489 optional int64 end_timestamp = 2;
492 message ActiveTimePeriod {
493 optional TimePeriod time_period = 1;
495 // The active duration during the above time period.
496 // The unit is milli-second.
497 optional int32 active_duration = 2;
500 // This captures launch events for one app/extension or other installments.
501 message InstallableLaunch {
502 optional string install_id = 1;
504 // Time duration where this report covers. These are required
505 // and the record will be ignored if not set.
506 optional TimePeriod duration = 2;
508 // Client will send at most 50 timestamps to DM. All the rest
509 // launch activities will be summed into the total count.
510 // We will distribute the count evenly among the time span when
511 // doing time based aggregation.
512 repeated int64 timestamp = 3;
513 optional int64 total_count = 4;
516 // Used to report the device location.
517 message DeviceLocation {
520 ERROR_CODE_POSITION_UNAVAILABLE = 1;
523 // Latitude in decimal degrees north (WGS84 coordinate frame).
524 optional double latitude = 1;
526 // Longitude in decimal degrees west (WGS84 coordinate frame).
527 optional double longitude = 2;
529 // Altitude in meters (above WGS84 datum).
530 optional double altitude = 3;
532 // Accuracy of horizontal position in meters.
533 optional double accuracy = 4;
535 // Accuracy of altitude in meters.
536 optional double altitude_accuracy = 5;
538 // Heading in decimal degrees clockwise from true north.
539 optional double heading = 6;
541 // Horizontal component of device velocity in meters per second.
542 optional double speed = 7;
544 // Time of position measurement in milisecons since Epoch in UTC time.
545 optional int64 timestamp = 8;
547 // Error code, see enum above.
548 optional ErrorCode error_code = 9;
550 // Human-readable error message.
551 optional string error_message = 10;
554 // Details about a network interface.
555 message NetworkInterface {
556 // Indicates the type of network device.
557 enum NetworkDeviceType {
565 // Network device type.
566 optional NetworkDeviceType type = 1;
568 // MAC address (if applicable) of the corresponding network device. This is
569 // formatted as an ASCII string with 12 hex digits. Example: A0B1C2D3E4F5.
570 optional string mac_address = 2;
572 // MEID (if applicable) of the corresponding network device. Formatted as
573 // ASCII string composed of 14 hex digits. Example: A10000009296F2.
574 optional string meid = 3;
576 // IMEI (if applicable) of the corresponding network device. 15-16 decimal
577 // digits encoded as ASCII string. Example: 355402040158759.
578 optional string imei = 4;
580 // The device path associated with this network interface.
581 optional string device_path = 5;
585 // Information about configured/visible networks - this is separate from
586 // NetworkInterface because a configured network may not be associated with
587 // any specific interface, or may be visible across multiple interfaces.
588 message NetworkState {
589 // The current state of this network.
590 enum ConnectionState {
601 ACTIVATION_FAILURE = 10;
605 // For networks associated with a device, the path of the device.
606 optional string device_path = 1;
608 // Current state of this connection as reported by shill.
609 optional ConnectionState connection_state = 2;
611 // For wireless networks, the signal_strength in dBm.
612 optional int32 signal_strength = 3;
614 // The IP address this interface is bound to, if any.
615 optional string ip_address = 4;
617 // The gateway IP for this interface, if any.
618 optional string gateway = 5;
621 // Details about a device user.
623 // Types of device users which can be reported.
625 // A user managed by the same domain as the device.
626 USER_TYPE_MANAGED = 0;
628 // A user not managed by the same domain as the device.
629 USER_TYPE_UNMANAGED = 1;
632 // The type of the user.
633 required UserType type = 1;
635 // Email address of the user. Present only if the user type is managed.
636 optional string email = 2;
639 // Information about a single disk volume.
641 optional string volume_id = 1;
642 optional int64 storage_total = 2;
643 optional int64 storage_free = 3;
646 // Report device level status.
647 message DeviceStatusReportRequest {
648 // The OS version reported by the device is a platform version
649 // e.g. 1435.0.2011_12_16_1635.
650 optional string os_version = 1;
651 optional string firmware_version = 2;
653 // "Verified", "Dev". Same as verified mode.
654 // If the mode is unknown, this field should not be set.
655 optional string boot_mode = 3;
657 // Device active times collection since last report rpc call.
658 // No longer used -- use active_period instead.
659 repeated TimePeriod active_time = 4 [deprecated = true];
661 // The browser version string as shown in the About dialog.
663 optional string browser_version = 5;
665 // A list of periods when the device was active, aggregated by day.
666 repeated ActiveTimePeriod active_period = 6;
668 // The device location.
669 optional DeviceLocation device_location = 7;
671 // List of network interfaces.
672 repeated NetworkInterface network_interface = 8;
674 // List of recent device users, in descending order by last login time.
675 repeated DeviceUser user = 9;
677 // Disk space + other info about mounted/connected volumes.
678 repeated VolumeInfo volume_info = 10;
680 // List of visible/configured networks
681 repeated NetworkState network_state = 11;
683 // Samples of CPU utilization (0-100), sampled once every 120 seconds.
684 repeated int32 cpu_utilization_pct = 12;
686 // Free RAM (unreliable due to GC).
687 optional int64 deprecated_system_ram_free = 13 [deprecated = true];
689 // Total RAM on the device.
690 optional int64 system_ram_total = 14;
692 // Samples of free RAM [in bytes] (unreliable due to GC).
693 repeated int64 system_ram_free = 15;
696 // Provides status information for an installed app/extension.
698 // ID of the installed app/extension
699 required string app_id = 1;
701 // Currently installed version of the app.
702 required string extension_version = 2;
704 // Self-reported status summary (via chrome.reporting APIs)
705 optional string status = 3;
707 // If true, the application is currently in a self-reported error state.
708 optional bool error = 4;
711 // Report session (a user on one device) level status.
712 message SessionStatusReportRequest {
713 // Installed apps for this user on this device.
714 // No longer used -- use installed_apps instead.
715 repeated string installed_app_id = 1 [deprecated = true];
717 // Installed extensions for this user on this device.
718 // No longer used -- use installed_extensions instead.
719 repeated string installed_extension_id = 2 [deprecated = true];
721 // One stat per app for top 30 apps.
722 repeated InstallableLaunch app_launch_stat = 3;
724 // If this is a kiosk session, this is the device local account ID.
725 optional string device_local_account_id = 4;
727 // Information about installed apps for this user on this device.
728 repeated AppStatus installed_apps = 5;
730 // Information about installed extensions for this user on this device.
731 repeated AppStatus installed_extensions = 6;
734 // Response from DMServer to update devices' status.
735 // It is possible that status report fails but policy request succeed. In such
736 // case, the DeviceStatusReportResponse will contain an error code and the
737 // device should re-send status report data in the next policy request. The
738 // device should re-send report data if policy request fails, even if
739 // DeviceStatusReportResponse contains no error code.
740 message DeviceStatusReportResponse {
741 optional int32 error_code = 1;
743 // Human readable error message for customer support purpose.
744 optional string error_message = 2;
747 // Response from DMServer to update user devices' status.
748 // It is possible that status report fails but policy request succeed. In such
749 // case, the SessionStatusReportResponse will contain an error code and the
750 // device should re-send status report data in the next policy request. The
751 // device should re-send report data if policy request fails, even if
752 // SessionStatusReportResponse contains no error code.
753 message SessionStatusReportResponse {
754 optional int32 error_code = 1;
756 // Human readable error message for customer support purpose.
757 optional string error_message = 2;
760 // Request from device to server to determine whether the device should
761 // go through enterprise enrollment. Unlike the other requests, this request is
762 // not authenticated.
763 message DeviceAutoEnrollmentRequest {
764 // SHA-256 hash of the device's serial number, mod |modulus|.
765 // Should always be present.
766 optional int64 remainder = 1;
768 // Modulus of the hash used by the client. Should always be present. This
769 // is the number of buckets the client thinks the server has. For now,
770 // it is a power of 2, but due to the strict constraint on how many serial
771 // numbers a bucket can contain, it may become non power of 2. If that
772 // happens, client-side needs to change its assumption.
773 optional int64 modulus = 2;
776 // Response from server to auto-enrollment detection request.
777 message DeviceAutoEnrollmentResponse {
778 // If this field is present, the other fields are ignored and the client
779 // should send a new DeviceAutoEnrollmentRequest with a new |remainder|
780 // computed using this new |modulus|. If this field is empty, the client's
781 // request was accepted.
782 // DMServer guarantees that if the modulus sent by client in
783 // DeviceAutoEnrollmentRequest matches server's expectation, this field
785 optional int64 expected_modulus = 1;
787 // List of hashes in the client's hash bucket. If the client's hash matches
788 // any in this list, the client device should do enterprise enrollment.
789 // If it matches none, enrollment should be optional.
790 // Each entry has exactly 256 bits (32 bytes).
791 repeated bytes hash = 2;
794 // Sent by the client to the server. The device management server keeps a
795 // mapping of device identifiers to device state. Devices query this table after
796 // hard reset in order recover state. This request is keyed just by the opaque
797 // server-backed state key; there is no further authentication.
798 message DeviceStateRetrievalRequest {
799 // Opaque, client-determined, unpredictable, stable and unique device
800 // identifier to retrieve state for. This field contains 32 bytes of data that
801 // looks essentially random to the server. It may be generated e.g. by running
802 // a concatenation of suitable device identifiers through a cryptographic hash
803 // algorithm such as SHA-256.
804 optional bytes server_backed_state_key = 1;
807 // Sent by the client to the server when in registered state to update the
808 // device-determined device state keys.
809 message DeviceStateKeyUpdateRequest {
810 // The client-determined state keys. To the server, these look like 32 bytes
811 // of random data. The client should generate these keys using a deterministic
812 // algorithm that takes stable device identifiers as an input and produces a
813 // key as the output, possibly by running the identifiers through a
814 // cryptographic hash function such as SHA-256.
815 repeated bytes server_backed_state_key = 1;
818 // Server to client message carrying the device state response. Because the
819 // request is not authenticated, the only protection against state extraction
820 // from server is the unpredictability of the server-backed state ID. Thus, the
821 // response should not contain any sensitive data. If the server doesn't know
822 // the requested identifier, it just return a message with restore_mode set to
823 // RESTORE_MODE_NONE.
824 message DeviceStateRetrievalResponse {
825 // Restorative action to take after device reset.
827 // No state restoration.
828 RESTORE_MODE_NONE = 0;
829 // Enterprise enrollment requested, but user may skip.
830 RESTORE_MODE_REENROLLMENT_REQUESTED = 1;
831 // Enterprise enrollment is enforced and cannot be skipped.
832 RESTORE_MODE_REENROLLMENT_ENFORCED = 2;
833 // The device has been disabled by its owner. The device will show a warning
834 // screen and prevent the user from proceeding further.
835 RESTORE_MODE_DISABLED = 3;
837 // The server-indicated restore mode.
838 optional RestoreMode restore_mode = 1 [default = RESTORE_MODE_NONE];
840 // Primary domain the device is associated with.
841 optional string management_domain = 2;
843 // State that is relevant only when the |restore_mode| is
844 // |RESTORE_MODE_DISABLED|.
845 optional DisabledState disabled_state = 3;
848 // Sent by the client to the server to pair the Host device with the Controller
849 // device. The HTTP request contains an end-user OAuth token and only succeeds
850 // if both Host and Controller devices belong to the end-user domain.
851 message DevicePairingRequest {
853 // The device ID of the Host device.
854 optional string host_device_id = 1;
856 // The device ID of the Controller device.
857 optional string controller_device_id = 2;
860 // Response from the server to the device pairing request.
861 message DevicePairingResponse {
863 // The client should check HTTP status code first. If HTTP status code is not
864 // 200 (e.g. 500 internal error), then it means the pairing fails. If HTTP
865 // status code is 200, then the client should check the status code within the
870 // A generic failure code for pairing.
873 // The Host device cannot be found in the user's domain.
874 HOST_DEVICE_NOT_FOUND = 2;
876 // The Controller device cannot be found in the user's domain.
877 CONTROLLER_DEVICE_NOT_FOUND = 3;
879 // The Host device is deprovisioned.
880 HOST_DEVICE_DEPROVISIONED = 4;
882 // The Controller device is deprovisioned.
883 CONTROLLER_DEVICE_DEPROVISIONED = 5;
886 optional StatusCode status_code = 1 [default = FAILED];
889 // Sent by the client to the server to check if the devices are paired. The HTTP
890 // request contains controller service account OAuth token as well as the
891 // DMToken from the Host device.
892 message CheckDevicePairingRequest {
894 // The device ID of the Host device.
895 optional string host_device_id = 1;
897 // The device ID of the Controller device.
898 optional string controller_device_id = 2;
901 // Response from the server to the check device pairing request.
902 message CheckDevicePairingResponse {
904 // The client should check HTTP status code first. If HTTP status code is not
905 // 200 (e.g. 500 internal error), then it means the pairing status is unknown.
906 // If HTTP status code is 200, then the client should check the status code
907 // within the response.
911 // The Host and Controller devices are not paired.
914 // The Host device cannot be found in the Host device domain.
915 HOST_DEVICE_NOT_FOUND = 2;
917 // The Controller device cannot be found in the Host device domain.
918 CONTROLLER_DEVICE_NOT_FOUND = 3;
920 // The Host device is deprovisioned.
921 HOST_DEVICE_DEPROVISIONED = 4;
923 // The Controller device is deprovisioned.
924 CONTROLLER_DEVICE_DEPROVISIONED = 5;
926 // Invalid controller identity.
927 INVALID_CONTROLLER_DEVICE_IDENTITY = 6;
930 optional StatusCode status_code = 1 [default = NOT_PAIRED];
933 // Request from the DMAgent on the device to the DMServer. This is
934 // container for all requests from device to server. The overall HTTP
935 // request MUST be in the following format:
937 // * HTTP method is POST
938 // * Data mime type is application/x-protobuffer
939 // * HTTP parameters are (all required, all case sensitive):
940 // * request: MUST BE one of
941 // * api_authorization
943 // * check_device_pairing
945 // * device_state_retrieval
946 // * enterprise_check
954 // * devicetype: MUST BE "1" for Android or "2" for Chrome OS.
955 // * apptype: MUST BE Android or Chrome.
956 // * deviceid: MUST BE no more than 64-char in [\x21-\x7E].
957 // * agent: MUST BE a string of characters.
958 // * HTTP Authorization header MUST be in the following formats:
959 // * For register and ping requests
960 // Authorization: GoogleLogin auth=<auth cookie for Mobile Sync>
962 // * For unregister, policy, status, cert_upload and remote commands requests
963 // Authorization: GoogleDMToken token=<dm token from register>
965 // * The Authorization header isn't used for enterprise_check
966 // request, nor for register requests using OAuth. In the latter case,
967 // the OAuth token is passed in the "oauth" parameter.
969 // DeviceManagementRequest should only contain one request which matches the
970 // HTTP query parameter - request, as listed below. Other requests within the
971 // container will be ignored.
972 // cert_upload: cert_upload_request
973 // check_device_pairing: check_device_pairing_request
974 // device_pairing: device_pairing_request
975 // device_state_retrieval: device_state_retrieval_request
976 // enterprise_check: auto_enrollment_request
977 // ping: policy_request
978 // policy: policy_request
979 // register: register_request
980 // status: device_status_report_request or session_status_report_request
981 // unregister: unregister_request
982 // remote_commands: remote_command_request
985 message DeviceManagementRequest {
987 optional DeviceRegisterRequest register_request = 1;
989 // Unregister request.
990 optional DeviceUnregisterRequest unregister_request = 2;
993 optional DevicePolicyRequest policy_request = 3;
996 optional DeviceStatusReportRequest device_status_report_request = 4;
997 optional SessionStatusReportRequest session_status_report_request = 5;
999 // Auto-enrollment detection.
1000 optional DeviceAutoEnrollmentRequest auto_enrollment_request = 6;
1002 // EMCert upload (for remote attestation)
1003 optional DeviceCertUploadRequest cert_upload_request = 7;
1005 // Request for OAuth2 authorization codes to access Google services.
1006 optional DeviceServiceApiAccessRequest service_api_access_request = 8;
1008 // Device-state retrieval.
1009 optional DeviceStateRetrievalRequest device_state_retrieval_request = 9;
1011 // Device state key update.
1012 optional DeviceStateKeyUpdateRequest device_state_key_update_request = 10;
1014 // Pair two devices.
1015 optional DevicePairingRequest device_pairing_request = 11;
1017 // Check if two devices are paired.
1018 optional CheckDevicePairingRequest check_device_pairing_request = 12;
1020 // Remote command fetching.
1021 optional DeviceRemoteCommandRequest remote_command_request = 13;
1024 // Response from server to device.
1026 // The server uses the following numbers as HTTP status codes
1027 // to report top-level errors.
1029 // 200 OK: valid response is returned to client.
1030 // 400 Bad Request: invalid argument.
1031 // 401 Unauthorized: invalid auth cookie or DM token.
1032 // 403 Forbidden: device management is not allowed.
1033 // 404 Not Found: the request URL is invalid.
1034 // 410 Device Not Found: the device id is not found.
1035 // 491 Request Pending: the request is pending approval.
1036 // 500 Internal Server Error: most likely a bug in DM server.
1037 // 503 Service Unavailable: most likely a backend error.
1038 // 901 Device Not Found: the device id is not found.
1039 // 902 Policy Not Found: the policy is not found.
1040 message DeviceManagementResponse {
1042 optional string error_message = 2;
1044 // Register response
1045 optional DeviceRegisterResponse register_response = 3;
1047 // Unregister response
1048 optional DeviceUnregisterResponse unregister_response = 4;
1051 optional DevicePolicyResponse policy_response = 5;
1053 // Device status report response.
1054 optional DeviceStatusReportResponse device_status_report_response = 6;
1056 // Session status report response.
1057 optional SessionStatusReportResponse session_status_report_response = 7;
1059 // Auto-enrollment detection response.
1060 optional DeviceAutoEnrollmentResponse auto_enrollment_response = 8;
1062 // EMCert upload response.
1063 optional DeviceCertUploadResponse cert_upload_response = 9;
1065 // Response to OAuth2 authorization code request.
1066 optional DeviceServiceApiAccessResponse service_api_access_response = 10;
1068 // Device-state retrieval.
1069 optional DeviceStateRetrievalResponse device_state_retrieval_response = 11;
1071 // Response to device pairing request.
1072 optional DevicePairingResponse device_pairing_response = 12;
1074 // Response to check device pairing request.
1075 optional CheckDevicePairingResponse check_device_pairing_response = 13;
1077 // Response to remote command request.
1078 optional DeviceRemoteCommandResponse remote_command_response = 14;