Commit 00baf539 authored by drcrash's avatar drcrash Committed by Commit bot

Added flag for enterprise zero-touch enrollment and force enrollment if

its value is the string forced.

BUG=624187,b/29833682

Review-Url: https://codereview.chromium.org/2107033002
Cr-Commit-Position: refs/heads/master@{#403278}
parent c36b54a4
...@@ -52,10 +52,14 @@ namespace policy { ...@@ -52,10 +52,14 @@ namespace policy {
namespace { namespace {
// Well-known requisition types.
const char kNoRequisition[] = "none"; const char kNoRequisition[] = "none";
const char kRemoraRequisition[] = "remora"; const char kRemoraRequisition[] = "remora";
const char kSharkRequisition[] = "shark"; const char kSharkRequisition[] = "shark";
// Zero-touch enrollment flag values.
const char kZeroTouchEnrollmentForced[] = "forced";
// These are the machine serial number keys that we check in order until we // These are the machine serial number keys that we check in order until we
// find a non-empty serial number. The VPD spec says the serial number should be // find a non-empty serial number. The VPD spec says the serial number should be
// in the "serial_number" key for v2+ VPDs. However, legacy devices used a // in the "serial_number" key for v2+ VPDs. However, legacy devices used a
...@@ -136,6 +140,7 @@ void DeviceCloudPolicyManagerChromeOS::Initialize(PrefService* local_state) { ...@@ -136,6 +140,7 @@ void DeviceCloudPolicyManagerChromeOS::Initialize(PrefService* local_state) {
base::Unretained(this))); base::Unretained(this)));
InitializeRequisition(); InitializeRequisition();
InitializeEnrollment();
} }
void DeviceCloudPolicyManagerChromeOS::AddDeviceCloudPolicyManagerObserver( void DeviceCloudPolicyManagerChromeOS::AddDeviceCloudPolicyManagerObserver(
...@@ -175,8 +180,7 @@ void DeviceCloudPolicyManagerChromeOS::SetDeviceRequisition( ...@@ -175,8 +180,7 @@ void DeviceCloudPolicyManagerChromeOS::SetDeviceRequisition(
local_state_->ClearPref(prefs::kDeviceEnrollmentAutoStart); local_state_->ClearPref(prefs::kDeviceEnrollmentAutoStart);
local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit); local_state_->ClearPref(prefs::kDeviceEnrollmentCanExit);
} else { } else {
local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); SetDeviceEnrollmentAutoStart();
local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
} }
} }
} }
...@@ -320,8 +324,7 @@ void DeviceCloudPolicyManagerChromeOS::InitializeRequisition() { ...@@ -320,8 +324,7 @@ void DeviceCloudPolicyManagerChromeOS::InitializeRequisition() {
requisition); requisition);
if (requisition == kRemoraRequisition || if (requisition == kRemoraRequisition ||
requisition == kSharkRequisition) { requisition == kSharkRequisition) {
local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); SetDeviceEnrollmentAutoStart();
local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
} else { } else {
local_state_->SetBoolean( local_state_->SetBoolean(
prefs::kDeviceEnrollmentAutoStart, prefs::kDeviceEnrollmentAutoStart,
...@@ -336,6 +339,21 @@ void DeviceCloudPolicyManagerChromeOS::InitializeRequisition() { ...@@ -336,6 +339,21 @@ void DeviceCloudPolicyManagerChromeOS::InitializeRequisition() {
} }
} }
void DeviceCloudPolicyManagerChromeOS::InitializeEnrollment() {
// Enrollment happens during OOBE only.
if (chromeos::StartupUtils::IsOobeCompleted())
return;
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(
chromeos::switches::kEnterpriseEnableZeroTouchEnrollment) &&
command_line->GetSwitchValueASCII(
chromeos::switches::kEnterpriseEnableZeroTouchEnrollment) ==
kZeroTouchEnrollmentForced) {
SetDeviceEnrollmentAutoStart();
}
}
void DeviceCloudPolicyManagerChromeOS::NotifyConnected() { void DeviceCloudPolicyManagerChromeOS::NotifyConnected() {
FOR_EACH_OBSERVER( FOR_EACH_OBSERVER(
Observer, observers_, OnDeviceCloudPolicyManagerConnected()); Observer, observers_, OnDeviceCloudPolicyManagerConnected());
......
...@@ -119,6 +119,8 @@ class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { ...@@ -119,6 +119,8 @@ class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
// Initializes requisition settings at OOBE with values from VPD. // Initializes requisition settings at OOBE with values from VPD.
void InitializeRequisition(); void InitializeRequisition();
// Initializes enrollment settings at OOBE with values from flags.
void InitializeEnrollment();
void NotifyConnected(); void NotifyConnected();
void NotifyDisconnected(); void NotifyDisconnected();
......
...@@ -210,6 +210,10 @@ const char kEnterpriseEnrollmentInitialModulus[] = ...@@ -210,6 +210,10 @@ const char kEnterpriseEnrollmentInitialModulus[] =
const char kEnterpriseEnrollmentModulusLimit[] = const char kEnterpriseEnrollmentModulusLimit[] =
"enterprise-enrollment-modulus-limit"; "enterprise-enrollment-modulus-limit";
// Enables the zero-touch enterprise enrollment flow.
const char kEnterpriseEnableZeroTouchEnrollment[] =
"enterprise-enable-zero-touch-enrollment";
// Enables the chromecast support for video player app. // Enables the chromecast support for video player app.
const char kEnableVideoPlayerChromecastSupport[] = const char kEnableVideoPlayerChromecastSupport[] =
"enable-video-player-chromecast-support"; "enable-video-player-chromecast-support";
......
...@@ -81,6 +81,7 @@ CHROMEOS_EXPORT extern const char kEnterpriseDisableArc[]; ...@@ -81,6 +81,7 @@ CHROMEOS_EXPORT extern const char kEnterpriseDisableArc[];
CHROMEOS_EXPORT extern const char kEnterpriseEnableForcedReEnrollment[]; CHROMEOS_EXPORT extern const char kEnterpriseEnableForcedReEnrollment[];
CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentInitialModulus[]; CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentInitialModulus[];
CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentModulusLimit[]; CHROMEOS_EXPORT extern const char kEnterpriseEnrollmentModulusLimit[];
CHROMEOS_EXPORT extern const char kEnterpriseEnableZeroTouchEnrollment[];
CHROMEOS_EXPORT extern const char kFirstExecAfterBoot[]; CHROMEOS_EXPORT extern const char kFirstExecAfterBoot[];
CHROMEOS_EXPORT extern const char kForceFirstRunUI[]; CHROMEOS_EXPORT extern const char kForceFirstRunUI[];
CHROMEOS_EXPORT extern const char kForceLoginManagerInTests[]; CHROMEOS_EXPORT extern const char kForceLoginManagerInTests[];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment