mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-07-17 11:03:14 +01:00
Set ACL info in configure script
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.AccessControl;
|
||||
using System.Threading;
|
||||
|
||||
using var process = new Process();
|
||||
@@ -57,14 +58,27 @@ foreach (var installLogFile in Directory.EnumerateFiles(installDir, "*.log"))
|
||||
File.Delete(installLogFile);
|
||||
|
||||
if (uninstall)
|
||||
{
|
||||
Directory.Delete(
|
||||
Path.Combine(installDir, "lib"),
|
||||
true);
|
||||
}
|
||||
|
||||
if ((shortcut || (interactive && !uninstall)) && process.ExitCode == 0)
|
||||
{
|
||||
// try and lockdown the appsettings file
|
||||
var fileInfo = new FileInfo("appsettings.Production.yml");
|
||||
|
||||
//get security access
|
||||
FileSecurity fs = fileInfo.GetAccessControl();
|
||||
|
||||
//remove inherited access
|
||||
fs.SetAccessRuleProtection(true, false);
|
||||
|
||||
// Explicitly grant admins and SYSTEM
|
||||
fs.AddAccessRule(new FileSystemAccessRule("Administrators", FileSystemRights.FullControl, AccessControlType.Allow));
|
||||
fs.AddAccessRule(new FileSystemAccessRule("SYSTEM", FileSystemRights.Read, AccessControlType.Allow));
|
||||
|
||||
fileInfo.SetAccessControl(fs);
|
||||
|
||||
var startServer = interactive;
|
||||
if (shortcut)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user