Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced error reporting + client IP forwarding #8

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

msaladna
Copy link
Contributor

@msaladna msaladna commented Jan 8, 2021

This commit brings two changes, the first of which is intended to disinter the root cause of a site creation failure. Second allows auth sharing for other areas, such as rampart:unban that, when called, would allow a client to unblock their IP address within Blesta.

  • Abort operation whenever an error is raised. Prior, only a fatal would halt execution which requires traversal to ascertain root cause that is outside the responsibilities of any module. Now, errors encountered during site management immediately bubble up

  • Pass client IP address to ApisCP for auth logging. Requires additional configuration in [core] => http_trusted_forward in panel

@@ -62,6 +62,11 @@ public function apiRequest($function, array $params = [], $session_id = null)
// Create SOAP connection
ini_set('default_socket_timeout', 5000);

$headers = [
'Abort-On: error',
'X-Forwarded-For: ' . $this->getFromContainer('requestor')->ip_address
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing is our friend. This method is only defined in classes the use the Container trait. So at the top of the file add
use Blesta\Core\Util\Common\Traits\Container;
And at the top of the class add
use Container;

There are many classes in Blesta that already load this trait (models, controllers, and classes that extend Plugin, Module, and Gateway) but this file is not one of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing is our friend.

Mea culpa. Updated.

…d halt execution which requires traversal to ascertain root cause that is outside the responsibilities of any module. Now, errors encountered during site management immediately bubble up

Pass client IP address to ApisCP for auth logging. Requires additional configuration in [core] => http_trusted_forward in panel
Copy link
Member

@JReissmueller JReissmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, cheers :)

@JReissmueller JReissmueller merged commit 8d61838 into blesta:master Jan 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants