Restore SEBPatch

This commit is contained in:
2025-06-01 11:44:20 +02:00
commit 8c656e3137
1297 changed files with 142172 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
/*
* 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/.
*/
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// Defines all possible states of an <see cref="IFeatureConfiguration"/>.
/// </summary>
public enum FeatureConfigurationStatus
{
/// <summary>
/// The configuration is in an undefined state.
/// </summary>
Undefined,
/// <summary>
/// The configuration is disabled.
/// </summary>
Disabled,
/// <summary>
/// The configuration is enabled.
/// </summary>
Enabled
}
}

View File

@@ -0,0 +1,26 @@
/*
* 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/.
*/
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// Defines a mechanism which tries to restore all changes saved in a <see cref="IFeatureConfigurationBackup"/>.
/// </summary>
public interface IAutoRestoreMechanism
{
/// <summary>
/// Starts the procedure.
/// </summary>
void Start();
/// <summary>
/// Stops the procedure.
/// </summary>
void Stop();
}
}

View File

@@ -0,0 +1,59 @@
/*
* 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;
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// Allows to control a feature of the computer, the operating system or an installed software.
/// </summary>
public interface IFeatureConfiguration
{
/// <summary>
/// The unique identifier of this feature configuration.
/// </summary>
Guid Id { get; }
/// <summary>
/// The identifier of the group of changes to which this feature configuration belongs.
/// </summary>
Guid GroupId { get; }
/// <summary>
/// Disables the feature. Returns <c>true</c> if successful, otherwise <c>false</c>.
/// </summary>
bool DisableFeature();
/// <summary>
/// Enables the feature. Returns <c>true</c> if successful, otherwise <c>false</c>.
/// </summary>
bool EnableFeature();
/// <summary>
/// Retrieves the current status of the configuration.
/// </summary>
FeatureConfigurationStatus GetStatus();
/// <summary>
/// Initializes the currently active configuration of the feature.
/// </summary>
void Initialize();
/// <summary>
/// Resets the feature to its default configuration. Returns <c>true</c> if successful, otherwise <c>false</c>.
/// </summary>
bool Reset();
/// <summary>
/// Restores the feature to its previous configuration (i.e. before it was enabled or disabled). Returns <c>true</c> if successful,
/// otherwise <c>false</c>.
/// </summary>
bool Restore();
}
}

View File

@@ -0,0 +1,39 @@
/*
* 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;
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// Defines the functionality of a backup repository for <see cref="IFeatureConfiguration"/>.
/// </summary>
public interface IFeatureConfigurationBackup
{
/// <summary>
/// Deletes the given <see cref="IFeatureConfiguration"/> from the backup repository.
/// </summary>
void Delete(IFeatureConfiguration configuration);
/// <summary>
/// Gets all <see cref="IFeatureConfiguration"/> currently saved in the backup repository.
/// </summary>
IList<IFeatureConfiguration> GetAllConfigurations();
/// <summary>
/// Gets all <see cref="IFeatureConfiguration"/> which are part of the given group.
/// </summary>
IList<IFeatureConfiguration> GetBy(Guid groupId);
/// <summary>
/// Saves the given <see cref="IFeatureConfiguration"/> in the backup repository.
/// </summary>
void Save(IFeatureConfiguration configuration);
}
}

View File

@@ -0,0 +1,94 @@
/*
* 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;
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// The factory for all <see cref="IFeatureConfiguration"/> currently supported.
/// </summary>
public interface IFeatureConfigurationFactory
{
/// <summary>
/// Creates all feature configurations.
/// </summary>
IList<IFeatureConfiguration> CreateAll(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the option to change the password of a user account via the security screen.
/// </summary>
IFeatureConfiguration CreateChangePasswordConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control notifications of the Google Chrome browser.
/// </summary>
IFeatureConfiguration CreateChromeNotificationConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the ease of access options on the security screen.
/// </summary>
IFeatureConfiguration CreateEaseOfAccessConfiguration(Guid groupId);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the find printer option in the print dialog of Windows.
/// </summary>
IFeatureConfiguration CreateFindPrinterConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the option to lock the computer via the security screen.
/// </summary>
IFeatureConfiguration CreateLockWorkstationConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the power options on the security screen.
/// </summary>
IFeatureConfiguration CreateMachinePowerOptionsConfiguration(Guid groupId);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the network options on the security screen.
/// </summary>
IFeatureConfiguration CreateNetworkOptionsConfiguration(Guid groupId);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control remote desktop connections.
/// </summary>
IFeatureConfiguration CreateRemoteConnectionConfiguration(Guid groupId);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the option to sign out out via security screen.
/// </summary>
IFeatureConfiguration CreateSignoutConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the option to switch to another user account via the security screen.
/// </summary>
IFeatureConfiguration CreateSwitchUserConfiguration(Guid groupId);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the task manager of Windows.
/// </summary>
IFeatureConfiguration CreateTaskManagerConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the power options in the start menu.
/// </summary>
IFeatureConfiguration CreateUserPowerOptionsConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control the user interface overlay for VMware clients.
/// </summary>
IFeatureConfiguration CreateVmwareOverlayConfiguration(Guid groupId, string sid, string userName);
/// <summary>
/// Creates an <see cref="IFeatureConfiguration"/> to control Windows Update.
/// </summary>
IFeatureConfiguration CreateWindowsUpdateConfiguration(Guid groupId);
}
}

View File

@@ -0,0 +1,31 @@
/*
* 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/.
*/
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// Provides functionality to ensure that one or more <see cref="IFeatureConfiguration"/> remain in a given <see cref="FeatureConfigurationStatus"/>.
/// </summary>
public interface IFeatureConfigurationMonitor
{
/// <summary>
/// Registers a configuration to be monitored for the given status.
/// </summary>
void Observe(IFeatureConfiguration configuration, FeatureConfigurationStatus status);
/// <summary>
/// Stops the monitoring activity and removes all observed configurations.
/// </summary>
void Reset();
/// <summary>
/// Starts the monitoring activity.
/// </summary>
void Start();
}
}

View File

@@ -0,0 +1,26 @@
/*
* 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/.
*/
namespace SafeExamBrowser.Lockdown.Contracts
{
/// <summary>
/// Provides functionality to update and enforce the system configuration.
/// </summary>
public interface ISystemConfigurationUpdate
{
/// <summary>
/// Executes the update synchronously.
/// </summary>
void Execute();
/// <summary>
/// Executes the udpate asynchronously.
/// </summary>
void ExecuteAsync();
}
}

View File

@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SafeExamBrowser.Lockdown.Contracts")]
[assembly: AssemblyDescription("Safe Exam Browser")]
[assembly: AssemblyCompany("ETH Zürich")]
[assembly: AssemblyProduct("SafeExamBrowser.Lockdown.Contracts")]
[assembly: AssemblyCopyright("Copyright © 2024 ETH Zürich, IT Services")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3368b17d-6060-4482-9983-aa800d74041d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3368B17D-6060-4482-9983-AA800D74041D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SafeExamBrowser.Lockdown.Contracts</RootNamespace>
<AssemblyName>SafeExamBrowser.Lockdown.Contracts</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="FeatureConfigurationStatus.cs" />
<Compile Include="IAutoRestoreMechanism.cs" />
<Compile Include="IFeatureConfiguration.cs" />
<Compile Include="IFeatureConfigurationBackup.cs" />
<Compile Include="IFeatureConfigurationFactory.cs" />
<Compile Include="IFeatureConfigurationMonitor.cs" />
<Compile Include="ISystemConfigurationUpdate.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>