PROBLEM
There is no option to choose if we trust or not to self signed certificates with encrypted connection with MSSQL server.
If your server is self signed you get an error from both sqlsrv and odbc drivers. It breaks all site.
SOLUTION 1 (easy and primitive, but works :) )
Use TrustServerCertificate flag with connection string. It is located in sqlsrv/src/Driver/Database/sqlsrv/Connection.php
$pdo = new \PDO($dsn."TrustServerCertificate = true", $connection_options['username'], $connection_options['password'], $connection_options['pdo']);
Patch included.
SOLUTION 2
Consider new variable in connections settings which will allow you to manage trustness of certificate
ex.:
$databases['external']['default'] = [
'database' => 'my_database',
'username' => 'my_user',
'password' => 'my_password',
'port' => '1433',
'prefix' => '',
'host' => 'my.special.host.of.mssql.server',
'namespace' => 'Drupal\\sqlsrv\\Driver\\Database\sqlsrv',
'autoload' => 'modules/contrib/sqlsrv/src/Driver/Database/sqlsrv',
'driver' => 'sqlsrv',
'TrustServerCertificate' => true
];
| Comment | File | Size | Author |
|---|---|---|---|
| sqlsrv-TrustServerCertificate.patch | 722 bytes | sebaz |
Comments