SEBWIN-401: Implemented fix for VMware issue: The registry values will now only be set if the active configuration explicity says so.

This commit is contained in:
Damian Büchel 2020-05-20 12:03:54 +02:00
parent 87882c3aa5
commit 7b8c69c1ba
10 changed files with 973 additions and 845 deletions

View file

@ -46,12 +46,15 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
case Keys.Service.EnableUserSwitch:
MapEnableUserSwitch(settings, value);
break;
case Keys.Service.EnableVmWareOverlay:
MapEnableVmWareOverlay(settings, value);
case Keys.Service.EnableVmwareOverlay:
MapEnableVmwareOverlay(settings, value);
break;
case Keys.Service.EnableWindowsUpdate:
MapEnableWindowsUpdate(settings, value);
break;
case Keys.Service.SetVmwareConfiguration:
MapSetVmwareConfiguration(settings, value);
break;
}
}
@ -135,7 +138,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
}
}
private void MapEnableVmWareOverlay(AppSettings settings, object value)
private void MapEnableVmwareOverlay(AppSettings settings, object value)
{
if (value is bool enable)
{
@ -150,5 +153,13 @@ namespace SafeExamBrowser.Configuration.ConfigurationData.DataMapping
settings.Service.DisableWindowsUpdate = !enable;
}
}
private void MapSetVmwareConfiguration(AppSettings settings, object value)
{
if (value is bool set)
{
settings.Service.SetVmwareConfiguration = set;
}
}
}
}

View file

@ -185,6 +185,7 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
settings.Service.DisableVmwareOverlay = true;
settings.Service.DisableWindowsUpdate = true;
settings.Service.Policy = ServicePolicy.Mandatory;
settings.Service.SetVmwareConfiguration = false;
settings.Taskbar.EnableTaskbar = true;
settings.Taskbar.ShowApplicationInfo = false;

View file

@ -228,8 +228,9 @@ namespace SafeExamBrowser.Configuration.ConfigurationData
internal const string EnableTaskManager = "insideSebEnableStartTaskManager";
internal const string EnableUserLock = "insideSebEnableLockThisComputer";
internal const string EnableUserSwitch = "insideSebEnableSwitchUser";
internal const string EnableVmWareOverlay = "insideSebEnableVmWareClientShade";
internal const string EnableVmwareOverlay = "insideSebEnableVmWareClientShade";
internal const string EnableWindowsUpdate = "enableWindowsUpdate";
internal const string SetVmwareConfiguration = "setVmwareConfiguration";
}
internal static class UserInterface

View file

@ -12,11 +12,11 @@ using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using SafeExamBrowser.Configuration.Contracts;
using SafeExamBrowser.Settings;
using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Lockdown.Contracts;
using SafeExamBrowser.Logging.Contracts;
using SafeExamBrowser.Service.Operations;
using SafeExamBrowser.Settings;
namespace SafeExamBrowser.Service.UnitTests.Operations
{
@ -58,6 +58,7 @@ namespace SafeExamBrowser.Service.UnitTests.Operations
settings.Service.DisableChromeNotifications = true;
settings.Service.DisableEaseOfAccessOptions = true;
settings.Service.DisableSignout = true;
settings.Service.SetVmwareConfiguration = true;
var result = sut.Perform();
@ -72,6 +73,28 @@ namespace SafeExamBrowser.Service.UnitTests.Operations
Assert.AreEqual(OperationResult.Success, result);
}
[TestMethod]
public void Perform_MustOnlySetVmwareConfigurationIfEnabled()
{
var configuration = new Mock<IFeatureConfiguration>();
configuration.SetReturnsDefault(true);
factory.SetReturnsDefault(configuration.Object);
settings.Service.SetVmwareConfiguration = true;
sut.Perform();
factory.Verify(f => f.CreateVmwareOverlayConfiguration(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>()), Times.Once);
factory.Reset();
factory.SetReturnsDefault(configuration.Object);
settings.Service.SetVmwareConfiguration = false;
sut.Perform();
factory.Verify(f => f.CreateVmwareOverlayConfiguration(It.IsAny<Guid>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never);
}
[TestMethod]
public void Perform_MustUseSameGroupForAllConfigurations()
{
@ -84,6 +107,7 @@ namespace SafeExamBrowser.Service.UnitTests.Operations
.Returns(configuration.Object)
.Callback<Guid, string, string>((id, name, sid) => groupId = id);
factory.SetReturnsDefault(configuration.Object);
settings.Service.SetVmwareConfiguration = true;
sut.Perform();

View file

@ -7,6 +7,7 @@
*/
using System;
using System.Collections.Generic;
using SafeExamBrowser.Core.Contracts.OperationModel;
using SafeExamBrowser.Lockdown.Contracts;
using SafeExamBrowser.Logging.Contracts;
@ -41,7 +42,7 @@ namespace SafeExamBrowser.Service.Operations
var success = true;
var sid = Context.Configuration.UserSid;
var userName = Context.Configuration.UserName;
var configurations = new []
var configurations = new List<(IFeatureConfiguration, bool)>
{
(factory.CreateChangePasswordConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisablePasswordChange),
(factory.CreateChromeNotificationConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableChromeNotifications),
@ -54,10 +55,14 @@ namespace SafeExamBrowser.Service.Operations
(factory.CreateSwitchUserConfiguration(groupId), Context.Configuration.Settings.Service.DisableUserSwitch),
(factory.CreateTaskManagerConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableTaskManager),
(factory.CreateUserPowerOptionsConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisablePowerOptions),
(factory.CreateVmwareOverlayConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableVmwareOverlay),
(factory.CreateWindowsUpdateConfiguration(groupId), Context.Configuration.Settings.Service.DisableWindowsUpdate)
};
if (Context.Configuration.Settings.Service.SetVmwareConfiguration)
{
configurations.Add((factory.CreateVmwareOverlayConfiguration(groupId, sid, userName), Context.Configuration.Settings.Service.DisableVmwareOverlay));
}
logger.Info($"Attempting to perform lockdown (feature configuration group: {groupId})...");
foreach (var (configuration, disable) in configurations)

View file

@ -77,5 +77,10 @@ namespace SafeExamBrowser.Settings.Service
/// The active policy for the service component.
/// </summary>
public ServicePolicy Policy { get; set; }
/// <summary>
/// Determines whether the VMware configuration will be set by the service.
/// </summary>
public bool SetVmwareConfiguration { get; set; }
}
}

View file

@ -386,6 +386,7 @@ namespace SebWindowsConfig
public const String KeyInsideSebEnableEaseOfAccess = "insideSebEnableEaseOfAccess";
public const String KeyInsideSebEnableVmWareClientShade = "insideSebEnableVmWareClientShade";
public const String KeyInsideSebEnableNetworkConnectionSelector = "insideSebEnableNetworkConnectionSelector";
public const String KeySetVmwareConfiguration = "setVmwareConfiguration";
// Group "Hooked Keys"
public const String KeyHookKeys = "hookKeys";
@ -929,6 +930,7 @@ namespace SebWindowsConfig
SEBSettings.settingsDefault.Add(SEBSettings.KeyInsideSebEnableEaseOfAccess , false);
SEBSettings.settingsDefault.Add(SEBSettings.KeyInsideSebEnableVmWareClientShade, false);
SEBSettings.settingsDefault.Add(SEBSettings.KeyInsideSebEnableNetworkConnectionSelector, false);
SEBSettings.settingsDefault.Add(SEBSettings.KeySetVmwareConfiguration, false);
// Default settings for group "Hooked Keys"
SEBSettings.settingsDefault.Add(SEBSettings.KeyHookKeys, true);

View file

@ -30,8 +30,8 @@ namespace SebWindowsConfig
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SebWindowsConfigForm));
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.openFileDialogSebConfigFile = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialogSebConfigFile = new System.Windows.Forms.SaveFileDialog();
this.imageListTabIcons = new System.Windows.Forms.ImageList(this.components);
@ -435,6 +435,7 @@ namespace SebWindowsConfig
this.editDuplicateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.configureClientToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.applyAndStartSEBToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.checkBoxSetVmwareConfiguration = new System.Windows.Forms.CheckBox();
this.tabPageHookedKeys.SuspendLayout();
this.groupBoxFunctionKeys.SuspendLayout();
this.groupBoxSpecialKeys.SuspendLayout();
@ -888,6 +889,7 @@ namespace SebWindowsConfig
//
// groupBoxInsideSeb
//
this.groupBoxInsideSeb.Controls.Add(this.checkBoxSetVmwareConfiguration);
this.groupBoxInsideSeb.Controls.Add(this.checkBoxInsideSebEnableNetworkConnectionSelector);
this.groupBoxInsideSeb.Controls.Add(this.checkBoxInsideSebEnableSwitchUser);
this.groupBoxInsideSeb.Controls.Add(this.checkBoxInsideSebEnableLockThisComputer);
@ -902,7 +904,7 @@ namespace SebWindowsConfig
this.groupBoxInsideSeb.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.groupBoxInsideSeb.Name = "groupBoxInsideSeb";
this.groupBoxInsideSeb.Padding = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.groupBoxInsideSeb.Size = new System.Drawing.Size(305, 229);
this.groupBoxInsideSeb.Size = new System.Drawing.Size(305, 245);
this.groupBoxInsideSeb.TabIndex = 25;
this.groupBoxInsideSeb.TabStop = false;
this.groupBoxInsideSeb.Text = "While running SEB";
@ -911,7 +913,7 @@ namespace SebWindowsConfig
//
this.checkBoxInsideSebEnableNetworkConnectionSelector.AutoSize = true;
this.checkBoxInsideSebEnableNetworkConnectionSelector.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.checkBoxInsideSebEnableNetworkConnectionSelector.Location = new System.Drawing.Point(16, 195);
this.checkBoxInsideSebEnableNetworkConnectionSelector.Location = new System.Drawing.Point(16, 213);
this.checkBoxInsideSebEnableNetworkConnectionSelector.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.checkBoxInsideSebEnableNetworkConnectionSelector.Name = "checkBoxInsideSebEnableNetworkConnectionSelector";
this.checkBoxInsideSebEnableNetworkConnectionSelector.Size = new System.Drawing.Size(196, 17);
@ -1010,7 +1012,7 @@ namespace SebWindowsConfig
//
this.checkBoxInsideSebEnableEaseOfAccess.AutoSize = true;
this.checkBoxInsideSebEnableEaseOfAccess.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.checkBoxInsideSebEnableEaseOfAccess.Location = new System.Drawing.Point(16, 174);
this.checkBoxInsideSebEnableEaseOfAccess.Location = new System.Drawing.Point(16, 194);
this.checkBoxInsideSebEnableEaseOfAccess.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.checkBoxInsideSebEnableEaseOfAccess.Name = "checkBoxInsideSebEnableEaseOfAccess";
this.checkBoxInsideSebEnableEaseOfAccess.Size = new System.Drawing.Size(136, 17);
@ -1026,7 +1028,7 @@ namespace SebWindowsConfig
//
this.checkBoxInsideSebEnableVmWareClientShade.AutoSize = true;
this.checkBoxInsideSebEnableVmWareClientShade.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.checkBoxInsideSebEnableVmWareClientShade.Location = new System.Drawing.Point(16, 154);
this.checkBoxInsideSebEnableVmWareClientShade.Location = new System.Drawing.Point(35, 175);
this.checkBoxInsideSebEnableVmWareClientShade.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
this.checkBoxInsideSebEnableVmWareClientShade.Name = "checkBoxInsideSebEnableVmWareClientShade";
this.checkBoxInsideSebEnableVmWareClientShade.Size = new System.Drawing.Size(164, 17);
@ -1754,8 +1756,8 @@ namespace SebWindowsConfig
//
// Type
//
dataGridViewCellStyle1.BackColor = System.Drawing.Color.Silver;
this.Type.DefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.Silver;
this.Type.DefaultCellStyle = dataGridViewCellStyle3;
this.Type.HeaderText = "Type";
this.Type.Name = "Type";
this.Type.ReadOnly = true;
@ -4261,8 +4263,8 @@ namespace SebWindowsConfig
// spellCheckerDictionaryFilesColumn
//
this.spellCheckerDictionaryFilesColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.spellCheckerDictionaryFilesColumn.DefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.spellCheckerDictionaryFilesColumn.DefaultCellStyle = dataGridViewCellStyle4;
this.spellCheckerDictionaryFilesColumn.HeaderText = "Files";
this.spellCheckerDictionaryFilesColumn.Name = "spellCheckerDictionaryFilesColumn";
this.spellCheckerDictionaryFilesColumn.ReadOnly = true;
@ -5659,6 +5661,20 @@ namespace SebWindowsConfig
this.applyAndStartSEBToolStripMenuItem.Visible = false;
this.applyAndStartSEBToolStripMenuItem.Click += new System.EventHandler(this.applyAndStartSEBToolStripMenuItem_Click);
//
// checkBoxSetVmwareConfiguration
//
this.checkBoxSetVmwareConfiguration.AutoSize = true;
this.checkBoxSetVmwareConfiguration.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.checkBoxSetVmwareConfiguration.Location = new System.Drawing.Point(16, 154);
this.checkBoxSetVmwareConfiguration.Name = "checkBoxSetVmwareConfiguration";
this.checkBoxSetVmwareConfiguration.Size = new System.Drawing.Size(148, 17);
this.checkBoxSetVmwareConfiguration.TabIndex = 77;
this.checkBoxSetVmwareConfiguration.Text = "Set VMware configuration";
this.toolTip1.SetToolTip(this.checkBoxSetVmwareConfiguration, "Determines whether the configuration value for VMware Client Shade will be set by" +
" SEB.");
this.checkBoxSetVmwareConfiguration.UseVisualStyleBackColor = true;
this.checkBoxSetVmwareConfiguration.CheckedChanged += new System.EventHandler(this.checkBoxSetVmwareConfiguration_CheckedChanged);
//
// SebWindowsConfigForm
//
this.AllowDrop = true;
@ -6185,6 +6201,7 @@ namespace SebWindowsConfig
private System.Windows.Forms.CheckBox checkBoxAllowChromeNotifications;
private System.Windows.Forms.CheckBox checkBoxAllowDeveloperConsole;
private System.Windows.Forms.CheckBox checkBoxAllowPdfReaderToolbar;
private System.Windows.Forms.CheckBox checkBoxSetVmwareConfiguration;
}
}

View file

@ -805,6 +805,8 @@ namespace SebWindowsConfig
checkBoxInsideSebEnableLogOff .Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableLogOff];
checkBoxInsideSebEnableShutDown .Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableShutDown];
checkBoxInsideSebEnableEaseOfAccess .Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableEaseOfAccess];
checkBoxSetVmwareConfiguration.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeySetVmwareConfiguration];
checkBoxInsideSebEnableVmWareClientShade.Enabled = checkBoxSetVmwareConfiguration.Checked;
checkBoxInsideSebEnableVmWareClientShade.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableVmWareClientShade];
checkBoxInsideSebEnableNetworkConnectionSelector.Checked = (Boolean)SEBSettings.settingsCurrent[SEBSettings.KeyInsideSebEnableNetworkConnectionSelector];
@ -4550,5 +4552,11 @@ namespace SebWindowsConfig
{
SEBSettings.settingsCurrent[SEBSettings.KeyAllowPDFReaderToolbar] = checkBoxAllowPdfReaderToolbar.Checked;
}
private void checkBoxSetVmwareConfiguration_CheckedChanged(object sender, EventArgs e)
{
SEBSettings.settingsCurrent[SEBSettings.KeySetVmwareConfiguration] = checkBoxSetVmwareConfiguration.Checked;
checkBoxInsideSebEnableVmWareClientShade.Enabled = checkBoxSetVmwareConfiguration.Checked;
}
}
}

File diff suppressed because it is too large Load diff