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

Octopus install fails with System.Security.Cryptography.CryptographicException #30

Open
robdmoore opened this issue Apr 14, 2015 · 5 comments

Comments

@robdmoore
Copy link
Member

Reported by @mneelakanta via MRCollective/AzureWebFarm#21

This issue was supposed to be fixed in 1.2.0. We are currently using 1.2.0.11 and have encountered this issue a few times over the last 2 months...

Any ideas?

2015-04-14 05:17:12.6632      1 FATAL  Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Octopus.Platform.Deployment.Configuration.IKeyValueStore, Octopus.Platform.Deployment.Configuration.ICommunicationsConfiguration, Octopus.Shared.Security.ICertificateGenerator)' on type 'TentacleConfiguration'. ---> Key not valid for use in specified state.
 (See inner exception for details.) ---> System.Security.Cryptography.CryptographicException: Key not valid for use in specified state.
   at System.Security.Cryptography.ProtectedData.Unprotect(Byte[] encryptedData, Byte[] optionalEntropy, DataProtectionScope scope)
   at Octopus.Shared.Configuration.AbstractKeyValueStore.Get[TData](String name, TData defaultValue, Nullable`1 protectionScope) in y:\work\refs\heads\master\source\Octopus.Shared\Configuration\AbstractKeyValueStore.cs:line 37
   at Octopus.Shared.Configuration.TentacleConfiguration..ctor(IKeyValueStore settings, ICommunicationsConfiguration communicationsConfiguration, ICertificateGenerator certificateGenerator) in y:\work\refs\heads\master\source\Octopus.Shared\Configuration\TentacleConfiguration.cs:line 27
   at lambda_method(Closure , Object[] )
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.GetOrCreateAndShare(Guid id, Func`1 creator)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Features.LazyDependencies.LazyRegistrationSource.<>c__DisplayClass5`1.<>c__DisplayClass7.<CreateLazyRegistration>b__4()
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.LazyInitValue()
   at Octopus.Tentacle.Commands.NewCertificateCommand.Start() in y:\work\refs\heads\master\source\Octopus.Tentacle\Commands\NewCertificateCommand.cs:line 59
   at Octopus.Shared.Startup.AbstractCommand.Octopus.Shared.Startup.ICommand.Start(String[] commandLineArguments, ICommandRuntime commandRuntime, OptionSet commonOptions) in y:\work\refs\heads\master\source\Octopus.Shared\Startup\AbstractCommand.cs:line 55
   at Octopus.Shared.Startup.ConsoleHost.Run(Action`1 start, Action shutdown) in y:\work\refs\heads\master\source\Octopus.Shared\Startup\ConsoleHost.cs:line 36
@robdmoore
Copy link
Member Author

So 1.2.0.11 should definitely have fixed the problem.

When you upgraded did you do an in-place upgrade or provision new servers and vip swap?

@mneelakanta
Copy link

It was a in-place upgrade...

@robdmoore
Copy link
Member Author

I suspect that might be your problem. The stuff that the original bug left behind might still be there. I'd recommend starting with some fresh servers, doing a vip swap and then reporting back if there is still a problem.

Something to note: when you vip swap and spin down the servers it will remove them from octopus unless the new servers have a different name (maybe use the tentacle machine suffix config option?). In the past I've restarted the nodes after I deleted the staging slot and that brought the servers down one by one so the site didn't go down, but in doing so re-registered them with octopus.

@daniefvh
Copy link

I also this have this issue very frequently.

System.Exception: Non-zero exit code returned (100). Stdout: Octopus Deploy: Tentacle version 2.6.5.1010

-------------------------------------------------------------------------------
Error: An exception was thrown while invoking the constructor 'Void .ctor(Octopus.Platform.Deployment.Configuration.IKeyValueStore, Octopus.Platform.Deployment.Configuration.ICommunicationsConfiguration, Octopus.Shared.Security.ICertificateGenerator)' on type 'TentacleConfiguration'. ---> Key not valid for use in specified state.
 (See inner exception for details.)
-------------------------------------------------------------------------------
Full error details are available in the log files.
See: http://g.octopushq.com/LogFiles
 StdErr: 
   at AzureWebFarm.OctopusDeploy.Infrastructure.ProcessRunner.Run(String executable, String arguments)

we have done numerous redeployments of these servers. The one thing we haven't freshly redeployed is the Octopus Server, could that be the culprit?

See version of Tentacle above is way after 1.2.0.11 and our server version is Octopus Deploy 2.6.0.778

EDIT:
I just did this a couple of times and it seemed to do it when I was Reimaging. Deleting the deployment and installing it from the a new package upload seemed to work. I also, updated the suffix for each attempt, not sure if that helped me.

@robdmoore
Copy link
Member Author

@daniefvh to clarify - the 1.2.0.11 version above was referencing the version of AzureWebFarm.OctopusDeploy - not the version of the installed tentacle.

You can tell what version of AzureWebFarm.OctopusDeploy you are on by looking at your packages.config file.

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

No branches or pull requests

3 participants