Example #1
0
        public async Task <List <IAlert> > GetSystemAlertsAsync()
        {
            List <SystemSecurityAlert> alerts = await _authDbContext.SystemSecurityAlerts.ToListAsync();

            List <IAlert> alertList = new List <IAlert>();

            foreach (SystemSecurityAlert alert in alerts)
            {
                switch (alert.AlertType)
                {
                case AlertTypeEnum.UnencryptedLdapBindAlert:
                    LdapUnencryptedConnectionAlert ldapUnencryptedConnectionAlert = new LdapUnencryptedConnectionAlert(alert.KeyValueStore);
                    ldapUnencryptedConnectionAlert.Id = alert.Id;
                    alertList.Add(ldapUnencryptedConnectionAlert);
                    break;

                case AlertTypeEnum.BruteforceIpAddressAlert:
                    BruteforceIpAddressAlert bruteforceIpAddressAlert = new BruteforceIpAddressAlert(alert.KeyValueStore);
                    bruteforceIpAddressAlert.Id = alert.Id;
                    alertList.Add(bruteforceIpAddressAlert);
                    break;
                }
            }

            return(alertList);
        }
Example #2
0
 private async Task IssueAlertIfIpIsNowBlocked(IPAddress ipAddress)
 {
     if (await IsIpBlockedAsync(ipAddress))
     {
         BruteforceIpAddressAlert alert = new BruteforceIpAddressAlert(ipAddress);
         await _alertManager.AddAlertAsync(alert);
     }
 }