5

I have a Habitat Solution for Sitecore 9.0 Update 1. Trying to run auto Sync "05-Sync-Unicorn". when I ran this task, getting below warning in the log file:

[Unicorn-Auth] CHAP authentication attempt rejected due to mismatching HMAC code. 11084 11:33:01 WARN [Unicorn-Auth] MAC (should match client): ccdcd92727b448eeb32931d551e9ebf8|3AEAA615C3A3A2F382B2184A0596A34E2682E976DAA11C4647AEDA68B00C268C|RAPIDSITECORE.DEV.LOCAL/UNICORN.ASPX?VERB=SYNC&CONFIGURATION= 11084 11:33:01 WARN [Unicorn-Auth] HMAC expected: YG4Mpl3puG10YDiPYOE41Al4+LwaBEGs4+yecKRv8kAP3S7T1fUl3TyToB8hGOSQ93x9DfacWhE97juAV/JCaA== 11084 11:33:01 WARN [Unicorn-Auth] HMAC provided by client: MicroCHAP.SignatureResult

Item is not getting created in CMS.

Please can someone help me here.

2
  • Have you set the sharedsecret on both sides? Mar 16, 2018 at 8:21
  • was the configuration successful? and the error is coming when you sync? Apr 10, 2018 at 7:56

2 Answers 2

3

I know this is an ancient post and you've hopefully resolved the issue. I just want to put the answer on record, since it just happened to me as well.

TL;DR

Your version of MicroCHAP.dll and the Unicorn.psm1 script don't match each other.

Explanation

Habitat integrates with Unicorn (or Unicorn integrates with Habitat, if you prefer) via some javascript that then calls some PowerShell scripting that then calls some more PowerShell scripting.

You find this in the /scripts folder at the root of the Habitat repository.

Inside this folder, the actual bulk of the work happens in the /scripts/Unicorn/Unicorn.psm1 file.

And now we're getting to it. This file was changed between the initial releases of Habitat and later ones. I don't know exactly when, but I guess between Unicorn 3 and Unicorn 4.

And if you try and run the Habitat Sync Unicorn command using the old version of the script, the parameters will be wrong and the challenge will fail.

Solution

Make sure this script is updated to match your Habitat version. And make sure you also use the correct version of MicroCHAP.dll that comes with it.

For reference, this is the path to the file in the Sitecore Habitat repository. A RAW view. Copy all this into your local file, and the problem goes away. (At time of this writing. Unicorn 4.0.4, MicroCHAP 1.2.2)

Unicorn.psm1 on Sitecore Habitat

1

I had the same issue and I found the issue was in my MAC value not matching the client. I recommend trying this:

  1. Add -DebugSecurity switch to Sync.ps1 command as follows:

    # SYNC ALL CONFIGURATIONS

    Sync-Unicorn -ControlPanelUrl $url -SharedSecret $secret -DebugSecurity true

  2. Run .\build.ps1 -Target "Post-Deploy" to simply jump to sync process instead of a full build and deploy. This should give you console message as follows:

Sync-Unicorn: Preparing authorization for https://sitecore93sc.dev.local//unicorn.aspx?verb=Sync&configuration=true&skipTransparentConfigs=0 Sync-Unicorn: Received challenge from remote server: fcf178f3348f4bca9c19f8f623ace61f

Sync-Unicorn: MAC 'fcf178f3348f4bca9c19f8f623ace61f|749CABBC85EAD20CE55E2C6066F1BE375D2115696C8A8B24DB6ED1FD60613086|SITECORE93SC.DEV.LOCAL//UNICORN.ASPX?VERB=SYNC&CONFIGURATION=TRUE&SKIPTRANSPARENTCONFIGS=0'

Sync-Unicorn: HMAC 'Pj7zKSbwHIeErT2b/oMVTaAW628mzSODTP+qx7rHS7yhHxpnplX5OcXRwRoVHHS4yeUaYwdRZ75Q+kCrvirj/Q=='

Sync-Unicorn: If you get authorization failures compare the values above to the Sitecore logs.

The debug messages actually turned me towards '//' in the MAC value that was being injected because "InstanceUrl": "https://sitecore93sc.dev.local/" has a trailing '/' in cake-config.json.

Sometimes it's the little things that matter :).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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