Jump to content

Decryption Error After Call Processpayment() From Cron


Anton Qcl

Recommended Posts

Hello,

 

Blesta version: 3.0.9/3.1.1

Actions: try to execute cron with tasks with function ProcessPayment().

 

I have custom plugin for two cron-tasks. It worked correct till yesterday. But now, when I'm trying to execute cron, I'm getting next error:



Error: Decryption error #0 [internal function]: UnknownException::setErrorHandler(1024, 'Decryption erro...', '/var/www/vhosts...', 2034, Array)
#1 /var/www/vhosts/my.blesta.site/public_html/vendors/phpseclib/Crypt/RSA.php(2034): user_error('Decryption erro...', 1024)
#2 /var/www/vhosts/my.blesta.site/public_html/vendors/phpseclib/Crypt/RSA.php(2515): Crypt_RSA->_rsaes_oaep_decrypt('.}??lb????a???h...')
#3 /var/www/vhosts/my.blesta.site/public_html/app/models/accounts.php(950): Crypt_RSA->decrypt('.}??lb????a???h...')
#4 /var/www/vhosts/my.blesta.site/public_html/app/models/accounts.php(162): Accounts->accountDecrypt('Ln0JsWximMSIzGG...', NULL)
#5 /var/www/vhosts/my.blesta.site/public_html/components/gateway_payments/gateway_payments.php(395): Accounts->getCc('15', true, NULL, NULL)
#6 /var/www/vhosts/my.blesta.site/public_html/app/models/voipswitch.php(829): GatewayPayments->processPayment('22', 'cc', 10, 'CAD', NULL, '15')
#7 /var/www/vhosts/my.blesta.site/public_html/plugins/vs_cron/vs_cron_plugin.php(211): Voipswitch->topUp('71', '15', '10', 'both')
#8 /var/www/vhosts/my.blesta.site/public_html/plugins/vs_cron/vs_cron_plugin.php(125): VsCronPlugin->autotransfer()
#9 /var/www/vhosts/my.blesta.site/public_html/app/controllers/cron.php(1756): VsCronPlugin->cron('vs_autotransfer')
#10 [internal function]: Cron->pluginTasks('3395b9698c531ca...')
#11 /var/www/vhosts/my.blesta.site/public_html/app/controllers/cron.php(132): call_user_func_array(Array, Array)
#12 /var/www/vhosts/my.blesta.site/public_html/app/controllers/cron.php(94): Cron->all('3395b9698c531ca...')
#13 /var/www/vhosts/my.blesta.site/public_html/lib/dispatcher.php(121): Cron->index()
#14 /var/www/vhosts/my.blesta.site/public_html/index.php(21): Dispatcher::dispatch('/cron/?cron_key...')
#15 {main}All tasks have been completed.

Also, I did not have possibility to enter to the administrative interface yesterday because Blesta told me "update your key". Reissue of the license did not help and I've changed version from 3.0.9 to 3.1.1 - it solved this problem.

Link to comment
Share on other sites

This will only occur if the RSA string could not be decrypted because either:

 

1. The data is corrupt (stored improperly).

2. Your RSA key, or key pair, is corrupt. This can occur if you have modified the Blesta.system_key config setting in /config/blesta.php, or if you modified the private_key or public_key settings in company_settings table.

 

Since this is related to a custom plugin, the issue is likely a result of something that plugin did. Obviously, we can't help you with debugging custom plugins.

Link to comment
Share on other sites

1. The data is corrupt (stored improperly).

2. Your RSA key, or key pair, is corrupt. This can occur if you have modified the Blesta.system_key config setting in /config/blesta.php, or if you modified the private_key or public_key settings in company_settings table.

In this case, problem would be in the another places of system but same function, called from another place (not from plugin) works correct. Also, in this case, problem would be on the other blesta-sites with this plugin but there is no problem.

 

 

I commented strings with checking in the file /vendors/phpseclib/Crypt/RSA.php for experiment and ran cron. I got next error:

Error: Trying to get property of non-object
#0 /var/www/vhosts/my.blesta.site/public_html/components/gateway_payments/gateway_payments.php(525): UnknownException::setErrorHandler(8, 'Trying to get p...', '/var/www/vhosts...', 525, Array)
#1 /var/www/vhosts/my.blesta.site/public_html/app/models/voipswitch.php(829): GatewayPayments->processPayment('22', 'cc', 10, 'CAD', NULL, '15')
#2 /var/www/vhosts/my.blesta.site/public_html/plugins/vs_cron/vs_cron_plugin.php(211): Voipswitch->topUp('71', '15', '10', 'both')
#3 /var/www/vhosts/my.blesta.site/public_html/plugins/vs_cron/vs_cron_plugin.php(125): VsCronPlugin->autotransfer() 
#4 /var/www/vhosts/my.blesta.site/public_html/app/controllers/cron.php(1756): VsCronPlugin->cron('vs_autotransfer')
#5 [internal function]: Cron->pluginTasks('740dfc9a3bf00c7...')
#6 /var/www/vhosts/my.blesta.site/public_html/app/controllers/cron.php(132): call_user_func_array(Array, Array)
#7 /var/www/vhosts/my.blesta.site/public_html/app/controllers/cron.php(94): Cron->all('740dfc9a3bf00c7...')
#8 /var/www/vhosts/my.blesta.site/public_html/lib/dispatcher.php(121): Cron->index() 
#9 /var/www/vhosts/my.blesta.site/public_html/index.php(21): Dispatcher::dispatch('/cron/?cron_key...') 
#10 {main} 

Ok, I uncommented strings of checking.

I opened file /components/gateway_payments/gateway_payments.php on the row 525:

'company' => $this->Companies->get($client->company_id)

I thought only some users have a problem and the user (who have service 71 which in the error) is in that group. I tried to call function Voipswitch->topUp (it calls function GatewayPayments->processPayment, etc) for this user and my license became invalid (I was transferred to the page "https://my.blesta.site/admin/license/" with text "License invalid", field for enter license key and button for submit).

 

I think problem occurs when system can not get some company settings.

But crushing of function GatewayPayments->processPayment and corruption of license should not happen.

 

Please, check it and help me solve this problem.

Link to comment
Share on other sites

You will only receive a license invalid message if you attempt to access Blesta from a hostname, IP, or install path that is not registered for your license, or if the local license data has expired.

 

You can force a revalidation by accessing /admin/license/. If that fails to work, you are likely accessing Blesta at a location not registered for you license. The solution then is to reissue your license.

 

 

If when the cron runs the license becomes invalid it is likely because the system can not determine the hostname for your installation. The hostname is derived from the $_SERVER['SERVER_NAME'] global variable. And, in the event that value is unavailable (which is usually the case when run via cron), the hostname is determined using the gethostbyaddr which requires that the server have the capability of performing DNS checks, and the IP address is a routable IP (i.e. NOT a local IP address). In this case, you may see an invalid hostname or IP address listed under your account for that license.

Link to comment
Share on other sites

You can force a revalidation by accessing /admin/license/. If that fails to work, you are likely accessing Blesta at a location not registered for you license. The solution then is to reissue your license.

 

 

 

It fails to work. And reissue fails to work.

Could it be that the system doesn't request account.blesta.com because system doesn't got some parameters?

I can't check it because I don't have access to /app/models/license.php

I have two other copies of Blesta on the same server - updating license key occurs correct. Getting of free trial for pure site occurs correct. Telnet to account.blesta.com:443 occurs correct.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...