mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Add "ForceClientHttps" application option.
This commit is contained in:
parent
97e31b44fc
commit
eff1b634e4
@ -18,6 +18,7 @@
|
||||
<Platforms>AnyCPU;x86;x64</Platforms>
|
||||
<StartupObject></StartupObject>
|
||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
||||
79
Desktop.Win/app.manifest
Normal file
79
Desktop.Win/app.manifest
Normal file
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<!-- UAC Manifest Options
|
||||
If you want to change the Windows User Account Control level replace the
|
||||
requestedExecutionLevel node with one of the following.
|
||||
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
|
||||
Specifying requestedExecutionLevel element will disable file and registry virtualization.
|
||||
Remove this element if your application requires this virtualization for backwards
|
||||
compatibility.
|
||||
-->
|
||||
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows Vista -->
|
||||
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
|
||||
|
||||
<!-- Windows 7 -->
|
||||
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
|
||||
|
||||
<!-- Windows 8 -->
|
||||
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
|
||||
|
||||
<!-- Windows 8.1 -->
|
||||
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
|
||||
|
||||
</application>
|
||||
</compatibility>
|
||||
|
||||
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
|
||||
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
|
||||
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
|
||||
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config.
|
||||
|
||||
Makes the application long-path aware. See https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
|
||||
<!--
|
||||
<application xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
|
||||
</windowsSettings>
|
||||
</application>
|
||||
-->
|
||||
|
||||
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
|
||||
<!--
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity
|
||||
type="win32"
|
||||
name="Microsoft.Windows.Common-Controls"
|
||||
version="6.0.0.0"
|
||||
processorArchitecture="*"
|
||||
publicKeyToken="6595b64144ccf1df"
|
||||
language="*"
|
||||
/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
</assembly>
|
||||
@ -135,7 +135,9 @@ namespace Remotely.Server.API
|
||||
var hostIndex = fileContents.IndexOf("HostName=");
|
||||
var orgIndex = fileContents.IndexOf("Organization=");
|
||||
|
||||
fileContents[hostIndex] = $"HostName=\"{Request.Scheme}://{Request.Host}\"";
|
||||
var effectiveScheme = _appConfig.ForceClientHttps ? "https" : Request.Scheme;
|
||||
|
||||
fileContents[hostIndex] = $"HostName=\"{effectiveScheme}://{Request.Host}\"";
|
||||
fileContents[orgIndex] = $"Organization=\"{organizationId}\"";
|
||||
var fileBytes = Encoding.UTF8.GetBytes(string.Join("\n", fileContents));
|
||||
return File(fileBytes, "application/octet-stream", fileName);
|
||||
@ -145,7 +147,8 @@ namespace Remotely.Server.API
|
||||
{
|
||||
LogRequest(nameof(GetDesktopFile));
|
||||
|
||||
var serverUrl = $"{Request.Scheme}://{Request.Host}";
|
||||
var effectiveScheme = _appConfig.ForceClientHttps ? "https" : Request.Scheme;
|
||||
var serverUrl = $"{effectiveScheme}://{Request.Host}";
|
||||
var embeddedData = new EmbeddedServerData(new Uri(serverUrl), organizationId);
|
||||
var result = await _embeddedDataSearcher.GetRewrittenStream(filePath, embeddedData);
|
||||
|
||||
@ -172,8 +175,9 @@ namespace Remotely.Server.API
|
||||
{
|
||||
case "WindowsInstaller":
|
||||
{
|
||||
var effectiveScheme = _appConfig.ForceClientHttps ? "https" : Request.Scheme;
|
||||
var serverUrl = $"{effectiveScheme}://{Request.Host}";
|
||||
var filePath = Path.Combine(_hostEnv.WebRootPath, "Content", "Remotely_Installer.exe");
|
||||
var serverUrl = $"{Request.Scheme}://{Request.Host}";
|
||||
var embeddedData = new EmbeddedServerData(new Uri(serverUrl), organizationId);
|
||||
var result = await _embeddedDataSearcher.GetRewrittenStream(filePath, embeddedData);
|
||||
|
||||
@ -228,10 +232,12 @@ namespace Remotely.Server.API
|
||||
ip = ip.MapToIPv4();
|
||||
}
|
||||
|
||||
var effectiveScheme = _appConfig.ForceClientHttps ? "https" : Request.Scheme;
|
||||
|
||||
_logger.LogInformation(
|
||||
"Started client download via {methodName}. Effective Scheme: {scheme}. Effective Host: {host}. Remote IP: {ip}.",
|
||||
methodName,
|
||||
Request.Scheme,
|
||||
effectiveScheme,
|
||||
Request.Host,
|
||||
$"{ip}");
|
||||
}
|
||||
|
||||
@ -150,6 +150,13 @@
|
||||
<br />
|
||||
<ValidationMessage For="() => Input.EnforceAttendedAccess" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Force Client HTTPS</label>
|
||||
<br />
|
||||
<InputCheckbox @bind-Value="Input.ForceClientHttps" autocomplete="off" />
|
||||
<br />
|
||||
<ValidationMessage For="() => Input.ForceClientHttps" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Known Proxies</label>
|
||||
<br />
|
||||
|
||||
@ -44,6 +44,9 @@ namespace Remotely.Server.Pages
|
||||
[Display(Name = "Enforce Attended Access")]
|
||||
public bool EnforceAttendedAccess { get; set; }
|
||||
|
||||
[Display(Name = "Force Client HTTPS")]
|
||||
public bool ForceClientHttps { get; set; }
|
||||
|
||||
[Display(Name = "Known Proxies")]
|
||||
public List<string> KnownProxies { get; set; } = new();
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ namespace Remotely.Server.Services
|
||||
string DBProvider { get; }
|
||||
bool EnableWindowsEventLog { get; }
|
||||
bool EnforceAttendedAccess { get; }
|
||||
bool ForceClientHttps { get; }
|
||||
string[] KnownProxies { get; }
|
||||
int MaxConcurrentUpdates { get; }
|
||||
int MaxOrganizationCount { get; }
|
||||
@ -50,6 +51,7 @@ namespace Remotely.Server.Services
|
||||
public string DBProvider => Config["ApplicationOptions:DBProvider"] ?? "SQLite";
|
||||
public bool EnableWindowsEventLog => bool.Parse(Config["ApplicationOptions:EnableWindowsEventLog"]);
|
||||
public bool EnforceAttendedAccess => bool.Parse(Config["ApplicationOptions:EnforceAttendedAccess"] ?? "false");
|
||||
public bool ForceClientHttps => bool.Parse(Config["ApplicationOptions:ForceClientHttps"] ?? "false");
|
||||
public string[] KnownProxies => Config.GetSection("ApplicationOptions:KnownProxies").Get<string[]>() ?? System.Array.Empty<string>();
|
||||
public int MaxConcurrentUpdates => int.Parse(Config["ApplicationOptions:MaxConcurrentUpdates"] ?? "10");
|
||||
public int MaxOrganizationCount => int.Parse(Config["ApplicationOptions:MaxOrganizationCount"] ?? "1");
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
"DBProvider": "SQLite",
|
||||
"EnableWindowsEventLog": false,
|
||||
"EnforceAttendedAccess": false,
|
||||
"ForceClientHttps": false,
|
||||
"KnownProxies": [],
|
||||
"MaxConcurrentUpdates": 10,
|
||||
"MaxOrganizationCount": 1,
|
||||
@ -39,4 +40,4 @@
|
||||
"UseHsts": false,
|
||||
"UseHttpLogging": false
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user