2

I am having problems authenticating to SalesForce using the Drupal SalesForce Suite module https://www.drupal.org/project/salesforce

Error opening socket ssl://ap2.salesforce.com:443

I am running Drupal using DevDesktop 2 (Built: Nov 22 2015 12:34:41) on my local MacOSX machine with PHP 5.6 with SSL turned on. On a Ubuntu server I can get the salesforce module to authenticate without an issue using the exact same settings as what I have on the Mac.

When I run this additional test on the Mac I get a similar error:

fsockopen('ssl://google.com',443,$errno,$errstr) ? print("UP") : print("DOWN:".$errstr);

Warning: fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in test.php on line 2

Warning: fsockopen(): Failed to enable crypto in test.php on line 2

Warning: fsockopen(): unable to connect to ssl://google.com:443 (Unknown error) in test.php on line 2 DOWN:

When I view phpinfo() I can see that the setting for "Openssl default config" is /Users/acquia/csbworkdir/dmitrybezer/libopenssl/install/ssl/openssl.cnf

This version of Dev Desktop is supposed to support SSL for local development. From the DevDesktop documentation: https://docs.acquia.com/dev-desktop/sites#https

Using HTTPS (SSL) with local sites The Local site URL link for local websites provides a Use https check box. When you select the Use https check box, Acquia Dev Desktop serves your site using the HTTPS protocol and uses a self-signed SSL certificate to simulate secure traffic. This enables you to develop and test secure websites locally without requiring you to duplicate the SSL certificates you use on your production site.

Has anyone encountered this before and how do we get DevDesktop to point to the self-signed SSL certificate that is mentioned?

  • Welcome to Drupal Answers! You are simply stating facts, without asking any explicit question. Stack Exchange doesn't work well with implicit questions. Also, since fsockopen() is a PHP function, any question about it is off-topic for us: Drupal doesn't change the way the function is used. – kiamlaluno Jun 17 '16 at 6:24
1

After looking around I found kenorb's reply on a similar issue: https://drupal.stackexchange.com/a/149456/62500

and after poking around the DevDesktop installed files on my Mac I managed to solve it.

The problem is the certificate file does not exist at the default location.

print_r(openssl_get_cert_locations());

Returns

Array ( 
    [default_cert_file] => /Users/acquia/csbworkdir/dmitrybezer/libopenssl/install/ssl/cert.pem 
    [default_cert_file_env] => SSL_CERT_FILE 
    [default_cert_dir] => /Users/acquia/csbworkdir/dmitrybezer/libopenssl/install/ssl/certs 
    [default_cert_dir_env] => SSL_CERT_DIR 
    [default_private_dir] => /Users/acquia/csbworkdir/dmitrybezer/libopenssl/install/ssl/private 
    [default_default_cert_area] => /Users/acquia/csbworkdir/dmitrybezer/libopenssl/install/ssl 
    [ini_cafile] => [ini_capath] => ) 

So it is looking for cert.pem in the non existent directory "/Users/acquia/csbworkdir/dmitrybezer/libopenssl/install/ssl/"

To solve this, edit /Applications/[Dev desktop folder]/php5_6/bin/php.ini

and add these lines:

[openssl]
openssl.cafile="/Applications/[Dev desktop folder]/common/cert/cacert.pem"
openssl.capath="/Applications/[Dev desktop folder]/common/cert/"

where is [Dev desktop folder] is the name of your Dev Desktop folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.