2016-11-03 2 views
0

나는이 오류가 발생하는 Windows 2012 서버를 부트 스트랩하려고하면 찾습니다. 도메인 도메인을 가진 요리사 부트 스트랩

knife bootstrap windows winrm 192.0.2.0 -N foobar -x vagrant -P vagrant -r "role[foo]" -E dev -V

Waiting for remote response before bootstrap.ERROR: Failed to authenticate to 192.0.2.0 as vagrant 
Response: WinRM::WinRMAuthorizationError 
Hint: Make sure to prefix domain usernames with the correct domain name. 
Hint: Local user names should be prefixed with computer name or IP address. 
EXAMPLE: my_domain\user_namer 

해결 방법은

192.0.2.0\vagrant

knife bootstrap windows winrm 192.0.2.0 -N foobar -x 192.0.2.0\vagrant -P vagrant -r "role[foo]" -E dev -V 

내에서 WinRM 구성이 포장으로 생성되는 사용자 이름의 일부로 IP 주소를 포함하는 것입니다.

# https://github.com/mwrock/packer-templates/blob/b46ec4e1c3eafcaa64042f32ceab7de2d3789dba/scripts/package.ps1#L28-L45 

netsh advfirewall firewall add rule name="WinRM-HTTP" dir=in localport=5985 protocol=TCP action=allow 

[email protected]{Force=$true} 
try { 
$command=Get-Command Enable-PSRemoting 
    if($command.Parameters.Keys -contains "skipnetworkprofilecheck"){ 
     $enableArgs.skipnetworkprofilecheck=$true 
    } 
} 
catch { 
    $global:error.RemoveAt(0) 
} 
Enable-PSRemoting @enableArgs 
winrm set winrm/config/client/auth '@{Basic="true"}' 
winrm set winrm/config/service/auth '@{Basic="true"}' 
winrm set winrm/config/service '@{AllowUnencrypted="true"}' 

왜 난 단지 많은 시행 착오 후

답변

0

으로 부트 스트랩 수, 나는 Enable-PSRemoting을 발견했고 나는 그들이 있었다 가정처럼 winrm quickconfig은 해당 명령이 없습니다.

다음 두 줄을 winrm 설치에 추가하면 문제가 해결됩니다. 이제 부트 스트랩에서 IP 주소를 이름으로 사용하지 않아도됩니다. 기본 인증 및 암호화되지 않은 WinRM을 허용

winrm quickconfig -q 
winrm quickconfig -transport:http 

전체 설정을

netsh advfirewall firewall add rule name="WinRM-HTTP" dir=in localport=5985 protocol=TCP action=allow 
winrm quickconfig -q 
winrm quickconfig -transport:http 
[email protected]{Force=$true} 
try { 
$command=Get-Command Enable-PSRemoting 
    if($command.Parameters.Keys -contains "skipnetworkprofilecheck"){ 
     $enableArgs.skipnetworkprofilecheck=$true 
    } 
} 
catch { 
    $global:error.RemoveAt(0) 
} 
Enable-PSRemoting @enableArgs 
#Enable-WSManCredSSP -Force -Role Server #TODO What does this do, do I need it? 
winrm set winrm/config/client/auth '@{Basic="true"}' 
winrm set winrm/config/service/auth '@{Basic="true"}' 
winrm set winrm/config/service '@{AllowUnencrypted="true"}' 

참고 용도로 사용하기에는 안전하지 않습니다.

관련 문제