开发者

Use Powershell with CruiseControl.Net for secure password storage?

开发者 https://www.devze.com 2023-03-01 10:19 出处:网络
The CruiseControl.Net tfs integration requires a username and password for a user with rather high privileges to be stored in the configuration files. I\'m not very fond of that, and have tried to thi

The CruiseControl.Net tfs integration requires a username and password for a user with rather high privileges to be stored in the configuration files. I'm not very fond of that, and have tried to think of ways to have the password stored开发者_开发问答 securely and yet maintain fully automated builds.

Powershell has good support for this with the ConvertTo-SecureStringand ConvertFrom-SecureString commands, and something like this would handle the encryption:

"password-string" | ConvertTo-SecureString -AsPlainText -Force | Out-File pwd.dat

And this could handle decryption:

$user = "mydomain\myuser"
$pwd = Get-Content pwd.dat | ConvertFrom-SecureString
$cred = New-Object System.Management.Automation.PSCredential($user, $pwd)

CruiseControl.Net has a <powershell> task that can be used for running powershell scripts, but I'm unsure whether this can be made to return anyhting. I'm wondering if anyone has any ideas on how to implement secure passwords with CruiseControl.Net? Using Powershell isn't necessary, I'm just figuring it would be neat.


Found a workaround at least: if you omit the <user>,<password> and <domain> parameters, CruiseControl will use the credentials for the user running the service.

The more general question, whether it is possble to catch output remains to be tested. I guess it could be possible to set an environment variable using [system]::SetEnvironmentVariable(name,value), but I haven't tested this.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号