Restore SEBPatch
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class ChangePasswordConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new []
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableChangePassword", 1, 0)
|
||||
};
|
||||
|
||||
public ChangePasswordConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
/// <summary>
|
||||
/// IMPORTANT: This registry configuration only has an effect after Chrome is restarted!
|
||||
///
|
||||
/// See https://www.chromium.org/administrators/policy-list-3#DefaultNotificationsSetting:
|
||||
/// • 1 = Allow sites to show desktop notifications.
|
||||
/// • 2 = Do not allow any site to show desktop notifications.
|
||||
/// • 3 = Ask every time a site wants to show desktop notifications.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class ChromeNotificationConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new []
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Policies\Google\Chrome", "DefaultNotificationsSetting", 2, 1)
|
||||
};
|
||||
|
||||
public ChromeNotificationConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class FindPrinterConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new[]
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoAddPrinter", 1, 0)
|
||||
};
|
||||
|
||||
public FindPrinterConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class LockWorkstationConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new []
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableLockWorkstation", 1, 0)
|
||||
};
|
||||
|
||||
public LockWorkstationConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class SignoutConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new []
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoLogoff", 1, 0)
|
||||
};
|
||||
|
||||
public SignoutConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class TaskManagerConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new []
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\System", "DisableTaskMgr", 1, 0)
|
||||
};
|
||||
|
||||
public TaskManagerConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal abstract class UserHiveConfiguration : RegistryConfiguration
|
||||
{
|
||||
protected string SID { get; }
|
||||
protected string UserName { get; }
|
||||
|
||||
protected override RegistryKey RootKey => Registry.Users;
|
||||
|
||||
public UserHiveConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger)
|
||||
{
|
||||
SID = sid ?? throw new ArgumentNullException(nameof(sid));
|
||||
UserName = userName ?? throw new ArgumentNullException(nameof(userName));
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{GetType().Name} ({Id}) for user '{UserName}'";
|
||||
}
|
||||
|
||||
protected override bool IsHiveAvailable(RegistryDataItem item)
|
||||
{
|
||||
var isAvailable = false;
|
||||
|
||||
try
|
||||
{
|
||||
isAvailable = Registry.Users.OpenSubKey(SID) != null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error($"Failed to check availability of registry hive for item {item}!", e);
|
||||
}
|
||||
|
||||
return isAvailable;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class UserPowerOptionsConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new[]
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", "NoClose", 1, 0)
|
||||
};
|
||||
|
||||
public UserPowerOptionsConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return DeleteConfiguration();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (c) 2024 ETH Zürich, IT Services
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SafeExamBrowser.Logging.Contracts;
|
||||
|
||||
namespace SafeExamBrowser.Lockdown.FeatureConfigurations.RegistryConfigurations.UserHive
|
||||
{
|
||||
[Serializable]
|
||||
internal class VmwareOverlayConfiguration : UserHiveConfiguration
|
||||
{
|
||||
protected override IEnumerable<RegistryConfigurationItem> Items => new []
|
||||
{
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\VMware, Inc.\VMware VDM\Client", "EnableShade", 0, 1),
|
||||
new RegistryConfigurationItem($@"HKEY_USERS\{SID}\Software\Policies\VMware, Inc.\VMware VDM\Client", "EnableShade", "False", "True")
|
||||
};
|
||||
|
||||
public VmwareOverlayConfiguration(Guid groupId, ILogger logger, string sid, string userName) : base(groupId, logger, sid, userName)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool Reset()
|
||||
{
|
||||
return EnableFeature();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user