File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ public function run()
3838 require_once (__DIR__ . '/../core/init.php ' );
3939
4040 // Confirm that process is running as same user that web process uses, otherwise all sorts of permission
41- // problems may happen and checks cannot be guaranteed to make sense.
41+ // problems may happen and checks cannot be guaranteed to make sense. Note that this purposely ignores
42+ // self-signed or invalid SSL certificates.
4243 $ token = bin2hex (random_bytes (32 ));
4344 $ tmpFile = "/tmp/ob_cli_ {$ token }" ;
4445 touch ($ tmpFile );
@@ -49,6 +50,8 @@ public function run()
4950 CURLOPT_RETURNTRANSFER => true ,
5051 CURLOPT_NOBODY => true ,
5152 CURLOPT_TIMEOUT => 5 ,
53+ CURLOPT_SSL_VERIFYPEER => false ,
54+ CURLOPT_SSL_VERIFYHOST => false ,
5255 ]);
5356 curl_exec ($ ch );
5457 $ statusCode = curl_getinfo ($ ch , CURLINFO_HTTP_CODE );
Original file line number Diff line number Diff line change @@ -411,4 +411,24 @@ public function database_version()
411411
412412 return ['Database Version ' , 'Database version found: ' . $ dbver ['value ' ] . '. ' ,0 ];
413413 }
414+
415+ public function certificate_valid ()
416+ {
417+ $ ch = curl_init (OB_SITE );
418+ curl_setopt_array ($ ch , [
419+ CURLOPT_RETURNTRANSFER => true ,
420+ CURLOPT_SSL_VERIFYPEER => true ,
421+ CURLOPT_NOBODY => true ,
422+ ]);
423+ if (curl_exec ($ ch ) === false ) {
424+ $ errorCode = curl_errno ($ ch );
425+ $ errorMessage = curl_error ($ ch );
426+
427+ if ($ errorCode === CURLE_SSL_CACERT || $ errorCode === CURLE_SSL_PEER_CERTIFICATE ) {
428+ return ['SSL Certificate ' , $ errorMessage , 1 ];
429+ }
430+ }
431+
432+ return ['SSL Certificate ' , 'SSL certificate valid. ' , 0 ];
433+ }
414434}
You can’t perform that action at this time.
0 commit comments