Skip to content

Commit 515d82c

Browse files
SQLCheck upgrades
Warn when ERRORLOG shows mac connections exceeded.
1 parent 697b3c0 commit 515d82c

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed
0 Bytes
Binary file not shown.

SQLCheck/SQLCheck/Collectors.cs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -933,31 +933,13 @@ public static void CollectProtocolOrder(DataSet ds)
933933
if (prot != null)
934934
{
935935
string[] po = (string[])prot;
936-
// RegStrings is before the annotation
937936
ProtocolOrder["RegistryList"] = string.Join(",", po);
938937
}
939938

940939
// From HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002 ! Functions REG_SZ, comma-delimited
941940

942-
prot = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002", "Functions", null);
941+
ProtocolOrder["PolicyList"] = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Cryptography\Configuration\SSL\00010002", "Functions", "");
943942

944-
if (prot != null)
945-
{
946-
string[] po = (string[])prot;
947-
// RegStrings is before the annotation
948-
ProtocolOrder["PolicyList"] = string.Join(",", po);
949-
950-
// Warn if the Protocol List has entries that arent in the ReistryList
951-
if (po.Length > 0)
952-
{
953-
string[] RegStrings = ProtocolOrder.GetString("RegistryList").Trim().Split(',');
954-
string[] PolStrings = ProtocolOrder.GetString("PolicyList").Trim().Split(',');
955-
var comp = new StringIgnoreCaseComparer();
956-
var ExtraStrings = PolStrings.Except(RegStrings, comp);
957-
ExtraStrings.ToList().ForEach(s => ProtocolOrder.LogWarning($"Cipher Suite '{s}' appears in the Protocol List but not in the Registry List."));
958-
}
959-
}
960-
961943
// Warn if the Protocol List has entries that arent in the ReistryList
962944
if (ProtocolOrder.GetString("PolicyList").Trim().Length > 0)
963945
{
@@ -2098,7 +2080,14 @@ public static void CollectCertificate(DataSet ds)
20982080
if (cert.NotBefore > DateTime.Now) msg += ", Future cert";
20992081
Certificate["NotAfter"] = cert.NotAfter.ToString();
21002082
if (cert.NotAfter < DateTime.Now) msg += ", Expired cert";
2101-
Certificate["KeySize"] = cert.PublicKey.Key.KeySize.ToString();
2083+
try
2084+
{
2085+
Certificate["KeySize"] = cert.PublicKey.Key.KeySize.ToString();
2086+
}
2087+
catch (NotSupportedException)
2088+
{
2089+
msg += ", Unsupported key type";
2090+
}
21022091
Certificate["SignatureAlgorithm"] = cert.SignatureAlgorithm.FriendlyName;
21032092

21042093
if (cert.PublicKey.Key.GetType().ToString() == "System.Security.Cryptography.RSACryptoServiceProvider")
@@ -3117,6 +3106,20 @@ public static void ProcessSQLErrorlog_File(DataRow SQLServer) // must come prio
31173106
searchText = "was successfully loaded for encryption.";
31183107
SQLServer["Certificate"] = SmartString.GetStringLine(el, searchText, true); // temporary holding place
31193108

3109+
line = SmartString.GetStringLine(el, "user connections has already been reached.");
3110+
if (line != "")
3111+
{
3112+
string userConnectionLimit = SmartString.GetBetween(line, "number of '", "'");
3113+
if (userConnectionLimit == "32767")
3114+
{
3115+
SQLServer.LogWarning("SQL Server has recently reached the connection limit of 32767 connections.");
3116+
}
3117+
else
3118+
{
3119+
SQLServer.LogWarning($"SQL Server has recently reached the connection limit of {userConnectionLimit} connections. This is lower than the 32767 upper limit.");
3120+
}
3121+
}
3122+
31203123
bool alwaysOn = SmartString.GetStringLine(el, "Always On Availability Groups:") != "";
31213124
SQLServer["AlwaysOn"] = alwaysOn;
31223125

SQLCheck/SQLCheck/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.1305.0")]
36-
[assembly: AssemblyFileVersion("1.0.1305.0")]
35+
[assembly: AssemblyVersion("1.0.1309.0")]
36+
[assembly: AssemblyFileVersion("1.0.1309.0")]

0 commit comments

Comments
 (0)