SSL certificate error when activating Unity via command line

When I attempt to activate a Unity installation via command line, I get an error (sometimes, not always) which makes it sound like the SSL cert in use at https://core.cloud.unity3d.com/api/login is self-signed.

I’m doing this to wrap test automation around my product’s setup documentation - I want to be able to test that it works from a clean machine, but without all the toil of doing that by hand every two weeks as we do a release.

I’m using Unity 5.5.2f1 via chocolatey.org’s excellent package manager, on Windows 10 Enterprise (since there’s an evaluation ISO available). I’ve built the VM via packer, and am then using vagrant to start it then run through my setup guide commands.

The (powershell) command line (secrets are supplied via the environment variables):

Start-Process "c:\program files\unity\editor\Unity.exe" "-quit -batchmode -nographics -serial `"$($env:UNITY_SERIAL)`" -username `"$($env:UNITY_USERNAME)`" -password `"$($env:UNITY_PASSWORD)`" -logFile `"c:\setup-qa\unity-activate.log`"" -wait -verbose

The logfile content:

BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...
(Filename: C:/buildslave/unity/build/Editor/Platform/Windows/WinEditorMain.cpp Line: 837)
DisplayProgressbar: Unity license
SSL certificate problem: unable to get local issuer certificate while processing request "https://core.cloud.unity3d.com/api/login", HTTP error code 0
.Cancelling DisplayDialog: Updating license failed Failed to update license within 60 seconds. Exiting.
This should not be called in batch mode.
(Filename: C:/buildslave/unity/build/Editor/Platform/Windows/EditorUtility.cpp Line: 1252)

Note that when I do this at an interactive command line, this works fine (unless my license key has had too many activations, though I’ve learned now how to release them from the website, and from the command line) most of the time.

Is it possible that some of the machines behind the load balancer have a self-signed cert…? I haven’t been able to come up with any other reasonable explanations, and am now a bit stumped.

Can you help to check if the process run as a user that have admin permission?

Thanks.

@ thanks for replying. It’s running from an administrator account, but not in an elevated prompt. UAC is disabled.

I’d be surprised if it needs elevation since

  • I’ve seen what I’m attempting work, sometimes, and fail sometimes, with no changes to my scripts or environment - that suggests some dependency out of my control
  • Unity seems to keep data it needs correctly within the user profile’s AppData tree…? Or are there registry edits going on as well?

(However, I’d love to be surprised and find it’s an error at my side!)

PS C:\Users\vagrant> Get-ItemProperty -path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\ -name Enabl
eLUA

EnableLUA    : 0
PSPath       : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policie
               s\System\
PSParentPath : Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policie
               s
PSChildName  : System
PSDrive      : HKLM
PSProvider   : Microsoft.PowerShell.Core\Registry

I’ve noticed, also, that if I apply Windows Updates after the first activation failure, then after their reboot, activation does not fail with the self-signed certificate error. It either succeeds, or fails with a 400 Bad Request telling me I’m at my activation limit for this serial (which is correct; at this point I am).

By the way - the 3 day limit on using the website to release the activations is killer for iterating on this :frowning:

What is the content of 400 error? Can you share us from it Editor.log?

The 400 informed me that I had activated that serial number too many times - totally legit, explicable error.

The key thing was that it wasn’t a self-signed-cert error.

If you’d like me to zip up my scripts (there’s nothing proprietary in them, and the VM is based on an MS evaluation ISO), then I can do that? I don’t want to share them publicly, however.

I’ve uploaded them via the bug reporter - case 911541.

The log you shared seems on a Mac instead of Windows.
And the error in the log shows error:

No sufficient permissions while processing request “https://core.cloud.unity3d.com/api/login”, HTTP error code 401

That mean username/password error. Could it be you have some strange character in password that need to be escape?

Thanks.

My password has {, }, and < characters inside it. However, if it were a shell expansion issue, that doesn’t explain why the same credentials work the second time they are attempted…?

Here’s a log from a Windows run of the scripts I added to the bug report:

    default: Running: script: activate unity
==> default: Running Unity so that it can create/download the CACerts.pem that it needs for activation.
==> default: Killing Unity after allowing it some time to do magical internal things (tm)
==> default: VERBOSE: Performing the operation "Stop-Process" on target "Unity (2192)".
==> default: Run Unity synchronously to return any activated license; shouldn't be one, but ensures clean slate.
==> default: UNITY_SERIAL: <redacted>
==> default: UNITY_USERNAME: <redacted>
==> default: Attempting to activate Unity license.
==> default: Result of activation attempt:
==> default: BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...
==> default:
==> default: (Filename: C:/buildslave/unity/build/Editor/Platform/Windows/WinEditorMain.cpp Line: 837)
==> default: DisplayProgressbar: Unity license
==> default: SSL certificate problem: unable to get local issuer certificate while processing request "https://core.cloud.unity3d.com/api/login", HTTP error code 0
==> default: .Cancelling DisplayDialog: Updating license failed Failed to update license within 60 seconds. Exiting.
==> default: This should not be called in batch mode.
==> default:
==> default: (Filename: C:/buildslave/unity/build/Editor/Platform/Windows/EditorUtility.cpp Line: 1252)
==> default: First activation attempt failed, trying again in case connectivity was the issue.
==> default: Result of activation attempt 2:
==> default: BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...
==> default:
==> default: (Filename: C:/buildslave/unity/build/Editor/Platform/Windows/WinEditorMain.cpp Line: 837)
==> default: DisplayProgressbar: Unity license
==> default: SSL certificate problem: unable to get local issuer certificate while processing request "https://core.cloud.unity3d.com/api/login", HTTP error code 0
==> default: .Cancelling DisplayDialog: Updating license failed Failed to update license within 60 seconds. Exiting.
==> default: This should not be called in batch mode.
==> default:
==> default: (Filename: C:/buildslave/unity/build/Editor/Platform/Windows/EditorUtility.cpp Line: 1252)

And here’s a Windows log from the second attempt - I did not reboot before this second attempt.

    default: Running: script: activate unity
==> default: Running Unity so that it can create/download the CACerts.pem that it needs for activation.
==> default: Killing Unity after allowing it some time to do magical internal things (tm)
==> default: VERBOSE: Performing the operation "Stop-Process" on target "Unity (1352)".
==> default: Run Unity synchronously to return any activated license; shouldn't be one, but ensures clean slate.
==> default: UNITY_SERIAL: <redacted>
==> default: UNITY_USERNAME: <redacted>
==> default: Attempting to activate Unity license.
==> default: Result of activation attempt:
==> default: BatchMode: Unity has not been activated with a valid License. Could be a new activation or renewal...
==> default:
==> default: (Filename: C:/buildslave/unity/build/Editor/Platform/Windows/WinEditorMain.cpp Line: 837)
==> default: DisplayProgressbar: Unity license
==> default: User <redacted> logged in successfully
==> default: LICENSE SYSTEM [2017522 11:15:12] Starting license activation with account <redacted>
==> default: LICENSE SYSTEM [2017522 11:15:12] Opening https://license.unity3d.com/update/poll?cmd=9&tx_id=7acdcb75b1e8f8f44ba61c1507396f31&(serial removed)
==> default: LICENSE SYSTEM [2017522 11:15:12] Posting <?xml version="1.0" encoding="UTF-8"?><root><SystemInfo><IsoCode>en</IsoCode><UserName>vagrant</UserName><OperatingSystem>Windows 10  (10.0.0) 64bit</OperatingSystem><OperatingSystemNumeric>1000</OperatingSystemNumeric><ProcessorType>Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz</ProcessorType><ProcessorSpeed>2494</ProcessorSpeed><ProcessorCount>1</ProcessorCount><ProcessorCores>1</ProcessorCores><PhysicalMemoryMB>2048</PhysicalMemoryMB><ComputerName>VAGRANT-10</ComputerName><ComputerModel>VirtualBox (innotek GmbH)</ComputerModel><UnityVersion>5.5.2f1</UnityVersion></SystemInfo><License id="Terms"><MachineID Value="lZ5xLjS1S2bIJeKEW9Q6hGLp+r8=" /><MachineBindings><Binding Key="1" Value="00329-20000-00001-AA934" /><Binding Key="2" Value="BVb887f8f4e-816e42" /><Binding Key="4" Value="MA==" /><Binding Key="5" Value="08:00:27:40:22:9c" /></MachineBindings><UnityVersion Value="5.5.2f1" /></License></root>
==> default: LICENSE SYSTEM [2017522 11:15:13] Received https://license.unity3d.com/update/poll?cmd=9&tx_id=7acdcb75b1e8f8f44ba61c1507396f31&(serial removed)
==> default: LICENSE SYSTEM [2017522 11:15:13] Headers:
==> default:     HTTP/1.1 200 OK
==> default:     Server: nginx/1.2.1
==> default:     Date: Mon, 22 May 2017 10:15:13 GMT
==> default:     Content-Type: application/xml; charset=utf-8
==> default:     Content-Length: 173
==> default:     Connection: keep-alive
==> default:     Status: 200 OK
==> default:     X-Frame-Options: SAMEORIGIN
==> default:     X-XSS-Protection: 1; mode=block
==> default:     X-Content-Type-Options: nosniff
==> default:     X-RX: 4588ca04a5eb9728835e7bc9802cac1be1d6d53a
==> default:     ETag: W/"5989a943365d5f18674d662021c4edeb"
==> default:     Cache-Control: max-age=0, private, must-revalidate
==> default:     Set-Cookie: _activation_session=ODg0eDB1T3ZNeW1XNDhsUVk2RzhqV3ZVRXEzcVdsRjRNd2g4R2taTXdQSThvclh1VTFYeEsrWXVrNFFhR2VFb0EySE9DemNrUVcwdll4WlN1RHhiRkJ5QitiN2R3NXo1SWg4ZE91cFVkdlYrd2s5a01FWHd0RmZkcmQ2QW80SzJYdnF5OXdxQmFuTk5ReVkyWWI3OFJRPT0tLXhZVGJJbVdyalpsVmU4ckpGeGRiZ0E9PQ%3D%3D--5ba29d810ebd5b07f7bdc3d7efda6888081f56f3; path=/; secure; HttpOnly
==> default:     X-Request-Id: f30f7619-10b5-4077-b15d-e6d0e10efecf
==> default:     X-Runtime: 0.401822
==> default:     Accept-Ranges: bytes
==> default:     X-Varnish: 2714570054
==> default:     Age: 0
==> default:     Via: 1.1 varnish
==> default:     Set-Cookie: SERVERID=varnish01; path=/
==> default:
==> default: LICENSE SYSTEM [2017522 11:15:14] Opening https://activation.unity3d.com/license.fcgi?CMD=9&TX=7acdcb75b1e8f8f44ba61c1507396f31&RX=4588ca04a5eb9728835e7bc9802cac1be1d6d53a
==> default: LICENSE SYSTEM [2017522 11:15:14] Posting <?xml version="1.0" encoding="UTF-8"?><root><SystemInfo><IsoCode>en</IsoCode><UserName>vagrant</UserName><OperatingSystem>Windows 10  (10.0.0) 64bit</OperatingSystem><OperatingSystemNumeric>1000</OperatingSystemNumeric><ProcessorType>Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz</ProcessorType><ProcessorSpeed>2494</ProcessorSpeed><ProcessorCount>1</ProcessorCount><ProcessorCores>1</ProcessorCores><PhysicalMemoryMB>2048</PhysicalMemoryMB><ComputerName>VAGRANT-10</ComputerName><ComputerModel>VirtualBox (innotek GmbH)</ComputerModel><UnityVersion>5.5.2f1</UnityVersion></SystemInfo><License id="Terms"><MachineID Value="lZ5xLjS1S2bIJeKEW9Q6hGLp+r8=" /><MachineBindings><Binding Key="1" Value="00329-20000-00001-AA934" /><Binding Key="2" Value="BVb887f8f4e-816e42" /><Binding Key="4" Value="MA==" /><Binding Key="5" Value="08:00:27:40:22:9c" /></MachineBindings><UnityVersion Value="5.5.2f1" /></License></root>
==> default: LICENSE SYSTEM [2017522 11:15:14] Received https://activation.unity3d.com/license.fcgi?CMD=9&TX=7acdcb75b1e8f8f44ba61c1507396f31&RX=4588ca04a5eb9728835e7bc9802cac1be1d6d53a
==> default: LICENSE SYSTEM [2017522 11:15:14] Headers:
==> default:     HTTP/1.1 200 OK
==> default:     Server: nginx/1.2.1
==> default:     Date: Mon, 22 May 2017 10:15:14 GMT
==> default:     Content-Type: text/xml; charset=ISO-8859-1
==> default:     Content-Length: 2270
==> default:     Connection: keep-alive
==> default:     Accept-Ranges: bytes
==> default:     X-Varnish: 2714570295
==> default:     Age: 0
==> default:     Via: 1.1 varnish
==> default:     Set-Cookie: SERVERID=varnish01; path=/
==> default:
==> default: LICENSE SYSTEM [2017522 11:15:14] License activated successfully with user: <redacted>
==> default: LICENSE SYSTEM [2017522 11:15:14] Next license update check is after 2017-05-23T10:15:14
==> default: Built from '5.5/release' branch; Version is '5.5.2f1 (3829d7f588f3) revision 3680727'; Using compiler version '160040219'
==> default: OS: 'Windows 10  (10.0.0) 64bit' Language: 'en' Physical Memory: 2048 MB
==> default: BatchMode: 1, IsHumanControllingUs: 0, StartBugReporterOnCrash: 0, Is64bit: 1, IsPro: 1
==> default: Initialize mono

Hi Peter,

Those logs are from difference scenario,

  1. In the log you attached in the bug 911541, it has message:
No sufficient permissions while processing request "https://core.cloud.unity3d.com/api/login", HTTP error code 401

That’s why I want to check with you if there are password escape issue.

  1. In the log you attached in this mail thread, it has message:
==> default: DisplayProgressbar: Unity license
==> default: SSL certificate problem: unable to get local issuer certificate while processing request "https://core.cloud.unity3d.com/api/login", HTTP error code 0

This should caused by the pem issue. I don’t know why the second time works but I believe the second time the certificate pem file should be created.

In our implementation, the pem file will be generated everytime when Unity started, so that you don’t need to create job:

Write-Output "Running Unity so that it can create/download the CACerts.pem that it needs for activation."
$unityProcess = Start-Process "c:\program files\unity\editor\Unity.exe" -passthru -verbose

If we check the log, we can see:

2017-05-16 13:58:08.885 Unity[54921:290378] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.
...270213 bytes written to /Users/peter/Library/Unity/Certificates/CACerts.pem

We can do some check with the generated pem file. It could be that windows machine do not have required certificate.