I saw related questions here, but they don't seem to answer exactly what I need.
We use Powershell scripts to deploy our applications, and information similar to passwords in configuration files for most environments (UAT, etc.) is presented in plain text. This is not a big problem, but when it comes to PREPROD and PROD, it is a big problem. Thus, we had some tokens in the config, such as "{{promt-password}}", which will give the login dialog ( Get-Credential ), and the person performing the deployment can enter the credentials, and the deployment continues .
But that doesn’t help automatic deployment (which means one-click deployment with tools like TeamCity)
Should I switch to asymmetric encryption ( http://msdn.microsoft.com/en-us/library/as0w18af.aspx ), where the password is encrypted using the public key entered in the config, and the private key is saved (as described here http : //msdn.microsoft.com/en-us/library/tswxhw92.aspx ) in the "agent" (like in a virtual machine where TeamCity initiates deployment and has limited access) that performs automatic deployment and can it decrypt the password? Not very strong in cryptography and sttuf, but does it seem like the way to go? Any other suggestions? How do people handle this automatic deployment?
Update:
Ok, I went ahead and implemented it. I wrote a Console application in C # that uses Crypography libraries. The application generates keys:
RSACryptoServiceProvider rsa = GetRsa(containerName); File.WriteAllText("keys.kez",rsa.ToXmlString(true));
I also exit the public key:
File.WriteAllText("public.pke", rsa.ToXmlString(false));
Provide the public key to everyone who needs to encrypt the password, and ask them to enter the password in the config. Place the keys.kez file in any agent that should start the deployment.
c # powershell deployment production-environment configuration
manojlds May 26 '11 at 5:15 a.m. 2011-05-26 05:15
source share