This commit is contained in:
2020-06-18 23:34:27 +00:00
parent 1e9c3a83fb
commit 1e1553773c
12 changed files with 85 additions and 71 deletions

View File

@@ -468,7 +468,8 @@ namespace AyaNova.Api.Controllers
var filePath = FileUtil.GetPermanentAttachmentFilePath(dbObj.StoredFileName);
if (!System.IO.File.Exists(filePath))
{
//TODO: this should trigger some kind of notification to the ops people
//TODO: notify OPSNOTIFY
//TODO: notify this should trigger some kind of notification to the ops people
//and a red light on the dashboard
var errText = $"Physical file {dbObj.StoredFileName} not found despite attachment record, this file is missing";

View File

@@ -165,7 +165,7 @@ namespace AyaNova
//log configuration
try
{
var AyaNovaConfig = config.AsEnumerable().Where(z => z.Key.StartsWith("AYANOVA") && z.Key != "AYANOVA_JWT_SECRET").Select(z => z.Key + "=" + z.Value).ToList();
var AyaNovaConfig = config.AsEnumerable().Where(z => z.Key.StartsWith("AYANOVA") && z.Key != "AYANOVA_JWT_SECRET"&& z.Key != "AYANOVA_SET_SUPERUSER_PW").Select(z => z.Key + "=" + z.Value).ToList();
var DiagConfig = string.Join(",", AyaNovaConfig);
DiagConfig = DbUtil.PasswordRedactedConnectionString(DiagConfig);
logger.Info($"Config {DiagConfig}");

View File

@@ -602,8 +602,18 @@ namespace AyaNova
_newLog.LogInformation($"License - [{AyaNova.Core.License.LicenseInfoLogFormat}]");
//Check for SuperUser password override
if (!string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_SET_SUPERUSER_PW))
{
_newLog.LogWarning($"### AYANOVA_SET_SUPERUSER_PW IS PRESENT - RESETTING SUPERUSER PASSWORD NOW... ###");
AyaNova.Biz.UserBiz.ResetSuperUserPassword();
_newLog.LogWarning($"### AYANOVA_SET_SUPERUSER_PW HAS BEEN USED TO RESET SUPER USER PASSWORD YOU CAN REMOVE THIS SETTING NOW ###");
}
//Boot lock for generator
ServerGlobalOpsSettingsCache.BOOTING=false;
ServerGlobalOpsSettingsCache.BOOTING = false;
//Open up the server for visitors
_newLog.LogDebug("Setting server state open");

View File

@@ -249,7 +249,7 @@ namespace AyaNova.Biz
catch (Exception ex)
{
log.LogError(ex, "JobsBiz::ProcessJobsAsync unexpected error during processing");
//TODO:OPSNOTIFY
//TODO: notify OPSNOTIFY
}
finally
{

View File

@@ -42,7 +42,7 @@ namespace AyaNova.Biz
}
//Called by license processor when use downgrades to lesser amount of techs
internal static async Task DeActivateExcessiveTechs(long KeepThisManyActiveTechs, ILogger _log)
internal static async Task DeActivateExcessiveTechs(long KeepThisManyActiveTechs, ILogger _log)
{
var TotalActiveTechs = await ActiveCountAsync();
int CountOfTechsToSetInactive = (int)(TotalActiveTechs - KeepThisManyActiveTechs);
@@ -64,6 +64,18 @@ namespace AyaNova.Biz
}
internal static void ResetSuperUserPassword()
{
using (AyContext ct = ServiceProviderProvider.DBContext)
{
User dbObj = ct.User.FirstOrDefault(z => z.Id == 1);
dbObj.Password = Hasher.hash(dbObj.Salt, ServerBootConfig.AYANOVA_SET_SUPERUSER_PW);
ct.SaveChanges();
//TODO: notify OPSNOTIFY
}
}
internal static UserBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext = null)
{
if (httpContext != null)

View File

@@ -74,7 +74,7 @@ namespace AyaNova.Biz
{
await JobsBiz.LogJobAsync(Guid.Empty, $"Error during data backup \"{Result}\"");
log.LogError($"BACKUP ERROR: {Result}");
//TODO:OPSNOTIFY
//TODO: notify OPSNOTIFY
}
//DO FILE BACKUP IF ATTACHMENTS BACKED UP
@@ -97,7 +97,7 @@ namespace AyaNova.Biz
await JobsBiz.LogJobAsync(Guid.Empty, "Backup failed with errors:");
await JobsBiz.LogJobAsync(Guid.Empty, ExceptionUtil.ExtractAllExceptionMessages(ex));
log.LogError(ex, "Backup failed");
//TODO:OPSNOTIFY
//TODO: notify OPSNOTIFY
throw ex;
}
finally

View File

@@ -51,7 +51,9 @@ namespace AyaNova.Util
internal static string AYANOVA_LOG_LEVEL { get; set; }
internal static bool AYANOVA_LOG_ENABLE_LOGGER_DIAGNOSTIC_LOG { get; set; }
//SECURITY
internal static string AYANOVA_SET_SUPERUSER_PW { get; set; }
/// <summary>
/// Populate the config from the configuration found at boot
@@ -154,11 +156,14 @@ namespace AyaNova.Util
AYANOVA_FOLDER_BACKUP_FILES = config.GetValue<string>("AYANOVA_FOLDER_BACKUP_FILES");
//pgdump backup utility path
AYANOVA_BACKUP_PG_DUMP_PATH = config.GetValue<string>("AYANOVA_BACKUP_PG_DUMP_PATH");
AYANOVA_BACKUP_PG_DUMP_PATH = config.GetValue<string>("AYANOVA_BACKUP_PG_DUMP_PATH");
//backdoor back door password superuser reset
AYANOVA_SET_SUPERUSER_PW = config.GetValue<string>("AYANOVA_SET_SUPERUSER_PW");
#endregion server BASICS
}