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

Trouble with winrm over ssl on port 5986 #254

Open
dcode opened this issue Jul 26, 2021 · 1 comment
Open

Trouble with winrm over ssl on port 5986 #254

dcode opened this issue Jul 26, 2021 · 1 comment

Comments

@dcode
Copy link
Contributor

dcode commented Jul 26, 2021

I'm trying to run down using WinRM over SSL via vagrant in GCP. No matter what I do, when I run vagrant winrm -c "my_command", the WinRM communicator is set to connect to port 5985. It will try to use SSL if I specify that for the transport, but I can't get it to connect to TCP/5986.

Has anyone gotten this to work? Below I have a custom Win 10 Enterprise Eval, but I've had the same issue with the Google public 2016 server image.

Vagrant.configure("2") do |cfg|
  cfg.vm.box = "google/gce"

  # You can customize any of the winrm settings available in Vagrant
  # however, these are the required ones to work with default public Windows images
  cfg.vm.communicator = "winrm"
  # >>>>> Tried overriding here
  cfg.winrm.port = 5986
  cfg.winrm.transport = "negotiate"
  cfg.winrm.username = "vagrant"
  cfg.winrm.ssl_peer_verification = false

  cfg.vm.define :winbox do |winbox|
    winbox.vm.synced_folder ".", "/vagrant", disabled: true
    winbox.vm.provider :google do |google, override|
      google.google_project_id = "my-project-id"
      google.google_json_key_location = "~/.config/gcloud/my_creds.json"

      google.image_family = "windows-10-21h1-ent-x64"
      google.machine_type = "n2-standard-4"

      google.disk_size = "50"
      google.name = "winbox"

      # WinRM requires TCP/UDP 5985 and 5986 open
      # Add the following rules to Google Firewall Rules and assign the winrm tag
      # tcp:5986; tcp:5985 udp:5986; udp:5985
      # also need http-server and https-server tags set.
      google.tags = ["winrm", "http-server", "https-server"]

      google.on_host_maintenance = "TERMINATE"
      google.zone = "my-zone-1a"
      # >>>>>>>> Tried this too
      override.winrm.port = 5986
      # If you would like to override the default behavior, you can
      # use the following flag
      google.setup_winrm_password = true
    end
  end
end
@R3dy
Copy link

R3dy commented Apr 19, 2022

Try changing

cfg.winrm.transport = "negotiate"

to
cfg.winrm.transport = :ssl

That is working for me

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

2 participants