Skip to content

Commit c4e0da4

Browse files
committed
Add additional verification for OpenSSL environment variable.
1 parent 735fcc6 commit c4e0da4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

NWN.Anvil/src/main/AnvilCore.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace Anvil
2020
/// </summary>
2121
public sealed partial class AnvilCore
2222
{
23+
private const string ExpectedOpenSslEnvironmentValue = "1.1";
2324
private const int ExpectedOpenSslVersion = 269488463;
2425

2526
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
@@ -131,6 +132,14 @@ private void CheckOpenSslVersion()
131132
}
132133

133134
Log.Info("Checking OpenSSL version. If the server crashes, see this page for troubleshooting: https://github.com/nwn-dotnet/Anvil/wiki/Troubleshooting-OpenSSL-Issues");
135+
136+
if (EnvironmentConfig.OpenSslVersionOverride != ExpectedOpenSslEnvironmentValue)
137+
{
138+
const string message = "Environment variable 'DOTNET_OPENSSL_VERSION_OVERRIDE' is not set. Please see the OpenSSL troubleshooting page for more info.";
139+
Log.Fatal(message);
140+
throw new Exception(message);
141+
}
142+
134143
LogManager.Flush();
135144

136145
long version = SafeEvpPKeyHandle.OpenSslVersion;

0 commit comments

Comments
 (0)