Fix ssl options check

This commit is contained in:
DariusIII
2018-03-04 16:48:08 +01:00
parent 547c3a3fb1
commit 796799499b
4 changed files with 36 additions and 27 deletions
+15 -15
View File
@@ -400,7 +400,7 @@ class Utility
*/
public static function streamSslContextOptions($forceIgnore = false): array
{
if (empty(NN_SSL_CAFILE) && empty(NN_SSL_CAPATH)) {
if (config('nntmux_ssl.ssl_cafile') === '' && config('nntmux_ssl.ssl_capath') === '') {
$options = [
'verify_peer' => false,
'verify_peer_name' => false,
@@ -408,15 +408,15 @@ class Utility
];
} else {
$options = [
'verify_peer' => $forceIgnore ? false : (bool) NN_SSL_VERIFY_PEER,
'verify_peer_name' => $forceIgnore ? false : (bool) NN_SSL_VERIFY_HOST,
'allow_self_signed' => $forceIgnore ? true : (bool) NN_SSL_ALLOW_SELF_SIGNED,
'verify_peer' => $forceIgnore ? false : config('nntmux_ssl.ssl_verify_peer'),
'verify_peer_name' => $forceIgnore ? false : config('nntmux_ssl.ssl_verify_host'),
'allow_self_signed' => $forceIgnore ? true : config('nntmux_ssl.ssl_allow_self_signed'),
];
if (! empty(NN_SSL_CAFILE)) {
$options['cafile'] = NN_SSL_CAFILE;
if (config('nntmux_ssl.ssl_cafile') !== '') {
$options['cafile'] = config('nntmux_ssl.ssl_cafile');
}
if (! empty(NN_SSL_CAPATH)) {
$options['capath'] = NN_SSL_CAPATH;
if (config('nntmux_ssl.ssl_capath') !== '') {
$options['capath'] = config('nntmux_ssl.ssl_capath');
}
}
// If we set the transport to tls and the server falls back to ssl,
@@ -438,16 +438,16 @@ class Utility
public static function curlSslContextOptions($verify = true): array
{
$options = [];
if ($verify && NN_SSL_VERIFY_HOST && (! empty(NN_SSL_CAFILE) || ! empty(NN_SSL_CAPATH))) {
if ($verify && config('nntmux_ssl.ssl_verify_host') && (! empty(config('nntmux_ssl.ssl_cafile')) || ! empty(config('nntmux_ssl.ssl_capath')))) {
$options += [
CURLOPT_SSL_VERIFYPEER => (bool) NN_SSL_VERIFY_PEER,
CURLOPT_SSL_VERIFYHOST => NN_SSL_VERIFY_HOST ? 2 : 0,
CURLOPT_SSL_VERIFYPEER => (bool) config('nntmux_ssl.ssl_verify_peer'),
CURLOPT_SSL_VERIFYHOST => config('nntmux_ssl.ssl_verify_host') ? 2 : 0,
];
if (! empty(NN_SSL_CAFILE)) {
$options += [CURLOPT_CAINFO => NN_SSL_CAFILE];
if (! empty(config('nntmux_ssl.ssl_cafile'))) {
$options += [CURLOPT_CAINFO => config('nntmux_ssl.ssl_cafile')];
}
if (! empty(NN_SSL_CAPATH)) {
$options += [CURLOPT_CAPATH => NN_SSL_CAPATH];
if (! empty(config('nntmux_ssl.ssl_capath'))) {
$options += [CURLOPT_CAPATH => config('nntmux_ssl.ssl_capath')];
}
} else {
$options += [
+1
View File
@@ -1,4 +1,5 @@
2018-03-04 DariusIII
* Fix: Fix ssl options check
* Fix: Fix new user registration once again
2018-03-03 DariusIII
* Chg: Upgrade nntmux configuration method
+12 -12
View File
@@ -1,16 +1,16 @@
<?php
return [
'items_per_page' => 50,
'items_per_cover_page' => 20,
'max_pager_results' => 125000,
'flood_check' => false,
'flood_wait_time' => 5,
'flood_max_requests_per_second' => 5,
'echocli' => true,
'rename_par2' => true,
'rename_music_mediainfo' => true,
'cache_expiry_short' => 300,
'cache_expiry_medium' => 600,
'cache_expiry_long' => 900,
'items_per_page' => 50,
'items_per_cover_page' => 20,
'max_pager_results' => 125000,
'flood_check' => false,
'flood_wait_time' => 5,
'flood_max_requests_per_second' => 5,
'echocli' => true,
'rename_par2' => true,
'rename_music_mediainfo' => true,
'cache_expiry_short' => 300,
'cache_expiry_medium' => 600,
'cache_expiry_long' => 900,
];
+8
View File
@@ -0,0 +1,8 @@
<?php
return [
'ssl_cafile' => '',
'ssl_capath' => '',
'ssl_verify_peer' => false,
'ssl_verify_host' => false,
'ssl_allow_self_signed' => true,
];