Skip to content

Commit

Permalink
Improve SSL instructions in report page.
Browse files Browse the repository at this point in the history
  • Loading branch information
gav- committed May 18, 2016
1 parent 05839cf commit 88fcb96
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### 4.0.3 (Released 2016-05-18) ###
- Improve SSL instructions in report page.

### 4.0.2 (Released 2016-04-21) ###
- Detect and allow for Apache versions with buggy rewrite causing redirection
failure during configuration.
Expand Down
12 changes: 5 additions & 7 deletions RESTfm.ini.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,15 @@ $config['settings'] = array (
'SSLOnly' => FALSE,

// Enforce strict SSL certificate checking when RESTfm is connecting to
// FileMaker Server Web Publishing Engine. Disabling this is a security
// risk, and should not be used on a production server. It may be useful
// to disable this during development on systems using self-signed SSL
// certificates or the FMI certificate bundled with FileMaker Server.
// FileMaker Server Web Publishing Engine.
// Check http://www.restfm.com/restfm-manual/install/ssl-troubleshooting
// for further details.
'strictSSLCertsFMS' => TRUE,

// Enforce strict SSL certificate checking for RESTfm connecting to
// itself when executing the report page (report.php).
// Disabling this may hide the fact that access to RESTfm over SSL is
// insecure. It may be useful to disable this during development on systems
// using self-signed SSL certificates.
// Check http://www.restfm.com/restfm-manual/install/ssl-troubleshooting
// for further details.
'strictSSLCertsReport' => TRUE,

// Respond 403 Forbidden on 401 Unauthorized.
Expand Down
45 changes: 30 additions & 15 deletions lib/RESTfm/Diagnostics.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,16 @@ public function test_webserverRedirect($reportItem) {
$reportItem->status = ReportItem::ERROR;
$reportItem->details .= 'cURL failed with error: ' . curl_errno($ch) . ': ' . curl_error($ch) . "\n";
if (curl_errno($ch) == 60) { // SSL certificate problem: self signed certificate
$reportItem->details .= 'On development (not production) systems it is possible to disable this check' ."\n";
$reportItem->details .= 'by setting "strictSSLCertsReport" to FALSE in ' . RESTfmConfig::CONFIG_INI ."\n";
$reportItem->details .= "\n";
$reportItem->details .= 'The host\'s SSL certificate has failed a verification check. This may be' . "\n";
$reportItem->details .= 'due to the certificate being invalid, or PHP\'s CA root certificates' . "\n";
$reportItem->details .= 'being out of date.' . "\n";
$reportItem->details .= "\n";
$reportItem->details .= 'Please consult ' .
'<a target="_blank" href="http://www.restfm.com/restfm-manual/install/ssl-troubleshooting">SSL Troubleshooting</a>' .
' in the RESTfm manual for further details.' . "\n";
$reportItem->details .= "\n";
$reportItem->details .= 'It is possible to disable this check by setting "strictSSLCertsReport" to FALSE in ' . RESTfmConfig::CONFIG_INI ."\n";
}
} elseif ( strpos($result, 'RESTfm is not configured') ) {
$reportItem->status = ReportItem::ERROR;
Expand Down Expand Up @@ -344,10 +352,9 @@ public function test_filemakerAPI($reportItem) {
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
if (RESTfmConfig::getVar('settings', 'strictSSLCertsReport') === FALSE) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
}
// SSL certificates were checked in an earlier test.
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE);
curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE);
curl_setopt($ch, CURLOPT_USERAGENT, 'RESTfm Diagnostics');
Expand All @@ -368,6 +375,7 @@ public function test_filemakerAPI($reportItem) {

public function test_filemakerConnect($reportItem) {
$reportItem->name = 'FileMaker Server connection test';
$reportItem->details = '';

if ($this->_isSSLOnlyAndNotHTTPS()) {
$reportItem->status = ReportItem::WARN;
Expand All @@ -377,7 +385,7 @@ public function test_filemakerConnect($reportItem) {

if ($this->_report->filemakerAPI->status != ReportItem::OK) {
$reportItem->status = ReportItem::ERROR;
$reportItem->details = 'Cannot test, FileMaker PHP API not found.' . "\n";
$reportItem->details .= 'Cannot test, FileMaker PHP API not found.' . "\n";
return;
}

Expand Down Expand Up @@ -406,8 +414,16 @@ public function test_filemakerConnect($reportItem) {
$reportItem->status = ReportItem::ERROR;
$reportItem->details .= 'cURL failed with error: ' . curl_errno($ch) . ': ' . curl_error($ch) . "\n";
if (curl_errno($ch) == 60) { // SSL certificate problem: self signed certificate in certificate chain
$reportItem->details .= 'On development (not production) systems it is possible to disable this check' ."\n";
$reportItem->details .= 'by setting "strictSSLCertsFMS" to FALSE in ' . RESTfmConfig::CONFIG_INI ."\n";
$reportItem->details .= "\n";
$reportItem->details .= 'The host\'s SSL certificate has failed a verification check. This may be' . "\n";
$reportItem->details .= 'due to the certificate being invalid, or PHP\'s CA root certificates' . "\n";
$reportItem->details .= 'being out of date.' . "\n";
$reportItem->details .= "\n";
$reportItem->details .= 'Please consult ' .
'<a target="_blank" href="http://www.restfm.com/restfm-manual/install/ssl-troubleshooting">SSL Troubleshooting</a>' .
' in the RESTfm manual for further details.' . "\n";
$reportItem->details .= "\n";
$reportItem->details .= 'It is possible to disable this check by setting "strictSSLCertsFMS" to FALSE in ' . RESTfmConfig::CONFIG_INI ."\n";
}
} elseif (stripos($result, 'FileMaker') === FALSE) {
$reportItem->status = ReportItem::ERROR;
Expand All @@ -425,12 +441,11 @@ public function test_filemakerConnect($reportItem) {

$FM = new FileMaker();
$FM->setProperty('hostspec', $hostspec);
if (RESTfmConfig::getVar('settings', 'strictSSLCertsFMS') === FALSE) {
$FM->setProperty('curlOptions', array(
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => FALSE,
));
}
// SSL certificates were checked in an earlier test.
$FM->setProperty('curlOptions', array(
CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_SSL_VERIFYHOST => FALSE,
));

$fileMakerResult = $FM->listDatabases();
$unauthorised = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion lib/RESTfm/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Version static class to hold release version.
*/
class Version {
private static $_release = '4.0.2';
private static $_release = '4.0.3';
private static $_revision = '%%REVISION%%';
private static $_protocol = '5'; // Bump this when REST API changes.

Expand Down

0 comments on commit 88fcb96

Please sign in to comment.