From e1e96d9254eb44eb5f0f5fc426bfbfe317dec5a1 Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Fri, 27 Nov 2020 17:01:59 +0100 Subject: [PATCH] test: Add self-signed certificate for Windows tests --- .github/workflows/go-windows.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go-windows.yml b/.github/workflows/go-windows.yml index 486ec52..976ad1c 100644 --- a/.github/workflows/go-windows.yml +++ b/.github/workflows/go-windows.yml @@ -27,11 +27,19 @@ jobs: New-LocalUser -Name $env:TEST_USER_NAME -Password $pw -Description "GitHub Action Test User" Add-LocalGroupMember -Group Administrators -Member $env:TEST_USER_NAME - & winrm quickconfig -force + # Already enabled + #Enable-PSRemoting -SkipNetworkProfileCheck -Force; + & winrm set winrm/config/service/Auth '@{Basic="true"}' & winrm set winrm/config/service '@{AllowUnencrypted="true"}' & winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="1024"}' - & winrm enumerate winrm/config/listener + + # Read current cert + $certs = Get-ChildItem Cert:\LocalMachine\My + $certs + Export-Certificate -Cert $certs[0] -FilePath C:\temp\cert.pem + + Get-ChildItem WSMan:\LocalHost\Listener Restart-Service winrm @@ -42,7 +50,6 @@ jobs: WINRM_HOST: localhost WINRM_USER: ci-test WINRM_PASSWORD: ${{ secrets.WINDOWS_TEST_USER_RANDOM_PASSWORD }} # only used inside the CI run - WINRM_SKIP_TLS: 1 # TODO: enable when HTTPs listener has been properly configured - WINRM_INSECURE: 1 + WINRM_TLS_CA: 'C:\temp\cert.pem' run: go test -v ./...