mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 00:22:40 +01:00
Enable ultrasafe security support
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
using System.ComponentModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Tgstation.Server.Api.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Types of <see cref="ErrorMessage"/>s that the API may return.
|
||||
/// </summary>
|
||||
/// <remarks>Entries marked with the <see cref="System.ObsoleteAttribute"/> are no longer in use but kept for reference.</remarks>
|
||||
/// <remarks>Entries marked with the <see cref="ObsoleteAttribute"/> are no longer in use but kept for reference.</remarks>
|
||||
public enum ErrorCode : uint
|
||||
{
|
||||
/// <summary>
|
||||
@@ -257,7 +258,8 @@ namespace Tgstation.Server.Api.Models
|
||||
/// <summary>
|
||||
/// <see cref="DreamDaemonSecurity.Ultrasafe"/> was used where it is not supported.
|
||||
/// </summary>
|
||||
[Description("This version of TGS does not support the ultrasafe DreamDaemon configuration!")]
|
||||
[Description("Deprecated error code.")]
|
||||
[Obsolete("With DMAPI-5.0.0, ultrasafe security is now supported.", true)]
|
||||
InvalidSecurityLevel,
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -471,9 +471,6 @@ namespace Tgstation.Server.Host.Components.Deployment
|
||||
if (progressReporter == null)
|
||||
throw new ArgumentNullException(nameof(progressReporter));
|
||||
|
||||
if (dreamMakerSettings.ApiValidationSecurityLevel == DreamDaemonSecurity.Ultrasafe)
|
||||
throw new ArgumentOutOfRangeException(nameof(dreamMakerSettings), dreamMakerSettings, "Cannot compile with ultrasafe security!");
|
||||
|
||||
logger.LogTrace("Begin Compile");
|
||||
|
||||
lock (this)
|
||||
|
||||
@@ -186,9 +186,6 @@ namespace Tgstation.Server.Host.Controllers
|
||||
if (model.SecondaryPort == 0)
|
||||
throw new InvalidOperationException("Secondary port cannot be 0!");
|
||||
|
||||
if (model.SecurityLevel == DreamDaemonSecurity.Ultrasafe)
|
||||
return BadRequest(new ErrorMessage(ErrorCode.InvalidSecurityLevel));
|
||||
|
||||
// alias for changing DD settings
|
||||
var current = await DatabaseContext.Instances.Where(x => x.Id == Instance.Id).Select(x => x.DreamDaemonSettings).FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -153,9 +153,6 @@ namespace Tgstation.Server.Host.Controllers
|
||||
if (model.ApiValidationPort == 0)
|
||||
throw new InvalidOperationException("ApiValidationPort cannot be 0!");
|
||||
|
||||
if (model.ApiValidationSecurityLevel == DreamDaemonSecurity.Ultrasafe)
|
||||
return BadRequest(new ErrorMessage(ErrorCode.InvalidSecurityLevel));
|
||||
|
||||
var hostModel = await DatabaseContext.DreamMakerSettings.Where(x => x.InstanceId == Instance.Id).FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (hostModel == null)
|
||||
return StatusCode((int)HttpStatusCode.Gone);
|
||||
|
||||
@@ -230,7 +230,7 @@ namespace Tgstation.Server.Host.Controllers
|
||||
AutoStart = false,
|
||||
PrimaryPort = 1337,
|
||||
SecondaryPort = 1338,
|
||||
SecurityLevel = DreamDaemonSecurity.Safe,
|
||||
SecurityLevel = DreamDaemonSecurity.Ultrasafe,
|
||||
SoftRestart = false,
|
||||
SoftShutdown = false,
|
||||
StartupTimeout = 20
|
||||
@@ -238,7 +238,7 @@ namespace Tgstation.Server.Host.Controllers
|
||||
DreamMakerSettings = new DreamMakerSettings
|
||||
{
|
||||
ApiValidationPort = 1339,
|
||||
ApiValidationSecurityLevel = DreamDaemonSecurity.Safe
|
||||
ApiValidationSecurityLevel = DreamDaemonSecurity.Ultrasafe
|
||||
},
|
||||
Name = model.Name,
|
||||
Online = false,
|
||||
|
||||
Reference in New Issue
Block a user