Sitecore Boost User functionality
The murder
Recently, we were contacted by a customer who had been faced with an additional license cost by Sitecore due to excessive use of the Boost User functionality.
For those of you who have never encountered this behavior, the documentation for this functionality can be found here:
However, the customer asked us (as their partner agency) to check or challenge this boost behavior.
They wanted to know who and how often (in a more granular metric than a day) this boost had been used.
The investigation
At first I though this was going to be something quite simple. As Sitecore is apparently able to detect the boost actions as they were performed I assumed that they should be able to also track the IP, Username, date and any other related information.
But as it goes... never make assumptions :) Sitecore told us that they can only see the time and occurrences summarized into a single day. This is probably to GDPR, and whether or not they store more than this was impossible for me to tell, but the screenshot can be found below:
The manhunt
- Create a custom BoostUsersControllerclass (the rest
of the code can be found in the BoostUsersControllersource class
in Sitecore.Client.LicenseOptions.dll):
using Sitecore.Diagnostics;
namespace Sitecore.Support.Client.LicenseOptions.Controllers
{
public class BoostUsersController : Controller
{
[HttpGet]
public void RedirectToBoost()
{
if (!Context.User.IsAuthenticated)
{
base.Response.StatusCode = 401;
}
else
{
string username = Context.GetUserName();
Log.Info("Boost used by: " + username, this);
base.Response.Redirect(GetBoostUrl(), endResponse: true);
}
}
protected string GetBoostUrl()
{ ... }
}
}
- Create InitializeRedirectToBoostRouteclass
namespace Sitecore.Support.Mvc.Pipelines.Initialize
{
internal class InitializeRedirectToBoostRoute
{
public virtual void Process(PipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
this.RegisterRoutes(RouteTable.Routes, args);
}
protected virtual void RegisterRoutes(RouteCollection routes, PipelineArgs args)
{
string[] namespaces = new string[] { "Sitecore.Support.Client.LicenseOptions.Controllers" };
routes.MapRoute("RouteName", "api/sitecore/BoostUsers/{action}", new
{
controller = "BoostUsers",
action = "RedirectToBoost",
id = UrlParameter.Optional
}, namespaces);
}
}
}
- Compile the above classes and copy the .dll file to the \bin folder.
- Create a patch file for your custom processor in
the <initialize>pipeline.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="Sitecore.Support.Mvc.Pipelines.Initialize.InitializeRedirectToBoostRoute, AssemblyName" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Initialize.InitializeCommandRoute, Sitecore.Speak.Client']"/>
</initialize>
</pipelines>
</sitecore>
</configuration>
The kill / The capture
Line 11538: 2022-12-20 13:37:28 10.75.9.150 GET /api/sitecore/BoostUsers/RedirectToBoost
- 443 sitecore\USERNAME 111.222.3.444 Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/108.0.0.0+Safari/537.36
https://cm-CUSTOMER.reference.be/sitecore/client/Applications/LicenseOptions/StartPage 352 0 0
249
Which, unmistakenly, told us that USERNAME (you know who you are!) was the culprit!
So, lesson learned:
- Always check your logs
- Immediately open up a Support ticket, they can really help
- ALWAYS check ALL your logs
- Read blogs like this.
Comments
Post a Comment