Merge pull request #6601 from duplicati/feature/disable-console-control
Added option to disable console control
This commit is contained in:
@@ -77,6 +77,8 @@ namespace Duplicati.Server.Database
|
||||
public const string ADDITIONAL_REPORT_URL = "additional-report-url";
|
||||
public const string BACKUP_LIST_SORT_ORDER = "backup-list-sort-order";
|
||||
public const string DISABLE_API_EXTENSIONS = "disable-api-extensions";
|
||||
public const string POWER_MODE_PROVIDER = "power-mode-provider";
|
||||
public const string DISABLE_CONSOLE_CONTROL = "disable-console-control";
|
||||
}
|
||||
|
||||
private readonly Dictionary<string, string?> settings;
|
||||
@@ -650,6 +652,21 @@ namespace Duplicati.Server.Database
|
||||
}
|
||||
}
|
||||
|
||||
public bool DisableConsoleControl
|
||||
{
|
||||
get
|
||||
{
|
||||
return Utility.ParseBool(settings[CONST.DISABLE_CONSOLE_CONTROL], false);
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (databaseConnection.m_lock)
|
||||
settings[CONST.DISABLE_CONSOLE_CONTROL] = value.ToString();
|
||||
SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public X509Certificate2Collection? ServerSSLCertificate
|
||||
{
|
||||
get
|
||||
|
||||
@@ -144,6 +144,12 @@ public class RemoteControllerHandler(Connection connection, IHttpClientFactory h
|
||||
/// <inheritdoc/>
|
||||
public async Task OnMessage(KeepRemoteConnection.CommandMessage commandMessage)
|
||||
{
|
||||
if (connection.ApplicationSettings.DisableConsoleControl)
|
||||
{
|
||||
commandMessage.Respond(new CommandResponseMessage(501, "Remote control is disabled.", null));
|
||||
return;
|
||||
}
|
||||
|
||||
using var httpClient = httpClientFactory.CreateClient();
|
||||
var token = jwtTokenProvider.CreateAccessToken("remote-control", jwtTokenProvider.TemporaryFamilyId, TimeSpan.FromMinutes(2));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user