Compare commits
2 Commits
main
...
2.4.1.dev+
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23566d642b | ||
|
|
5630c0bca3 |
6
.github/workflows/codeql.yml
vendored
6
.github/workflows/codeql.yml
vendored
@ -13,11 +13,9 @@ name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
branches: [ "2.4.1.dev+000171-55ec0d43_release" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
schedule:
|
||||
- cron: '20 19 * * 0'
|
||||
branches: [ "2.4.1.dev+000171-55ec0d43_release" ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
|
||||
39
.github/workflows/criticality_score.yml
vendored
39
.github/workflows/criticality_score.yml
vendored
@ -1,39 +0,0 @@
|
||||
name: "criticality score"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
github_auth_token:
|
||||
description: 'github auth token'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Installing go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
- name: Installing criticality score
|
||||
run: |
|
||||
go install github.com/ossf/criticality_score/cmd/criticality_score@latest
|
||||
|
||||
- name: Generate criticality score
|
||||
run: |
|
||||
export GITHUB_TOKEN=$INPUT_TOKEN
|
||||
criticality_score -depsdev-disable -format json https://github.com/${{ github.repository }}
|
||||
env:
|
||||
INPUT_TOKEN: ${{ github.event.inputs.github_auth_token }}
|
||||
2
.github/workflows/go-spectest-skipped.yml
vendored
2
.github/workflows/go-spectest-skipped.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: ['3.0', '3.1', '3.2', '3.3']
|
||||
ruby: ['3.0', '3.1', '3.2']
|
||||
name: Vagrant acceptance tests (Ruby ${{ matrix.ruby }})
|
||||
steps:
|
||||
- name: Stubbed for skip
|
||||
|
||||
2
.github/workflows/go-spectest.yml
vendored
2
.github/workflows/go-spectest.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: ['3.0', '3.1', '3.2', '3.3']
|
||||
ruby: ['3.0', '3.1', '3.2']
|
||||
name: Vagrant acceptance tests (Ruby ${{ matrix.ruby }})
|
||||
steps:
|
||||
- name: Code Checkout
|
||||
|
||||
2
.github/workflows/go-testing-skipped.yml
vendored
2
.github/workflows/go-testing-skipped.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: ['3.0', '3.1', '3.2', '3.3']
|
||||
ruby: ['3.0', '3.1', '3.2']
|
||||
name: Vagrant unit tests on Go (Ruby ${{ matrix.ruby }})
|
||||
steps:
|
||||
- name: Stubbed for skip
|
||||
|
||||
2
.github/workflows/go-testing.yml
vendored
2
.github/workflows/go-testing.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: ['3.0', '3.1', '3.2', '3.3']
|
||||
ruby: ['3.0', '3.1', '3.2']
|
||||
name: Vagrant unit tests on Go (Ruby ${{ matrix.ruby }})
|
||||
steps:
|
||||
- name: Code Checkout
|
||||
|
||||
34
.github/workflows/microsoft-sbom.yml
vendored
34
.github/workflows/microsoft-sbom.yml
vendored
@ -1,34 +0,0 @@
|
||||
name: "Microsft SBOM"
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Installing SBOM
|
||||
run: |
|
||||
curl -Lo $RUNNER_TEMP/sbom-tool https://github.com/microsoft/sbom-tool/releases/latest/download/sbom-tool-linux-x64
|
||||
chmod +x $RUNNER_TEMP/sbom-tool
|
||||
|
||||
- name: Generate SBOM
|
||||
run: |
|
||||
mkdir SBOMOUTPUT
|
||||
$RUNNER_TEMP/sbom-tool generate -b SBOMOUTPUT/ -bc . -pn ${{ github.repository }} -pv alpha -ps wipro -nsb https://github.com/hashicorp/vagrant
|
||||
|
||||
- name: Upload SBOM artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: sbom
|
||||
path: SBOMOUTPUT/_manifest/spdx_2.2/manifest.spdx.json
|
||||
5
.github/workflows/scorecard.yml
vendored
5
.github/workflows/scorecard.yml
vendored
@ -9,8 +9,9 @@ on:
|
||||
branch_protection_rule:
|
||||
# To guarantee Maintained check is occasionally updated. See
|
||||
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
|
||||
schedule:
|
||||
- cron: '36 19 * * 6'
|
||||
|
||||
push:
|
||||
branches: [ "2.4.1.dev+000171-55ec0d43_release" ]
|
||||
|
||||
# Declare default permissions as read only.
|
||||
permissions: read-all
|
||||
|
||||
2
.github/workflows/testing-skipped.yml
vendored
2
.github/workflows/testing-skipped.yml
vendored
@ -19,7 +19,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: [ '3.0', '3.1', '3.2', '3.3' ]
|
||||
ruby: [ '3.0', '3.1', '3.2' ]
|
||||
name: Vagrant unit tests on Ruby ${{ matrix.ruby }}
|
||||
steps:
|
||||
- name: Stubbed for skip
|
||||
|
||||
2
.github/workflows/testing.yml
vendored
2
.github/workflows/testing.yml
vendored
@ -32,7 +32,7 @@ jobs:
|
||||
continue-on-error: true
|
||||
strategy:
|
||||
matrix:
|
||||
ruby: [ '3.0', '3.1', '3.2', '3.3' ]
|
||||
ruby: [ '3.0', '3.1', '3.2' ]
|
||||
name: Vagrant unit tests on Ruby ${{ matrix.ruby }}
|
||||
steps:
|
||||
- name: Code Checkout
|
||||
|
||||
17
CHANGELOG.md
17
CHANGELOG.md
@ -1,25 +1,10 @@
|
||||
## 2.4.2.dev (UNRELEASED)
|
||||
|
||||
FEATURES:
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- provider/docker: Prevent error if network configuration data is missing [GH-13337]
|
||||
|
||||
VAGRANT-GO:
|
||||
|
||||
## 2.4.1 (January 19, 2024)
|
||||
## 2.4.1.dev (UNRELEASED)
|
||||
|
||||
FEATURES:
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
- communicator/ssh: Support ECDSA type keys for insecure key replacement [GH-13327]
|
||||
- communicator/ssh: Inspect guest for supported key types [GH-13334]
|
||||
- core: Update Ruby constraint to allow Ruby 3.3 [GH-13335]
|
||||
- core/bundler: Force strict dependencies for default gems [GH-13336]
|
||||
- provisioner/ansible: Support pip installation for RHEL >= 8 [GH-13326]
|
||||
- util/keypair: Add support for ECDSA keys [GH-13327]
|
||||
|
||||
|
||||
32
LICENSE
32
LICENSE
@ -4,40 +4,40 @@ License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
|
||||
Parameters
|
||||
|
||||
Licensor: HashiCorp, Inc.
|
||||
Licensed Work: Vagrant 2.4.2.dev or later. The Licensed Work is (c) %YEAR% HashiCorp, Inc.
|
||||
Licensed Work: Vagrant 2.4.1.dev or later. The Licensed Work is (c) 2024 HashiCorp, Inc.
|
||||
Additional Use Grant: You may make production use of the Licensed Work, provided
|
||||
Your use does not include offering the Licensed Work to third
|
||||
parties on a hosted or embedded basis in order to compete with
|
||||
HashiCorp’s paid version(s) of the Licensed Work. For purposes
|
||||
parties on a hosted or embedded basis in order to compete with
|
||||
HashiCorp's paid version(s) of the Licensed Work. For purposes
|
||||
of this license:
|
||||
|
||||
A "competitive offering" is a Product that is offered to third
|
||||
parties on a paid basis, including through paid support
|
||||
arrangements, that significantly overlaps with the capabilities
|
||||
parties on a paid basis, including through paid support
|
||||
arrangements, that significantly overlaps with the capabilities
|
||||
of HashiCorp's paid version(s) of the Licensed Work. If Your
|
||||
Product is not a competitive offering when You first make it
|
||||
Product is not a competitive offering when You first make it
|
||||
generally available, it will not become a competitive offering
|
||||
later due to HashiCorp releasing a new version of the Licensed
|
||||
Work with additional capabilities. In addition, Products that
|
||||
later due to HashiCorp releasing a new version of the Licensed
|
||||
Work with additional capabilities. In addition, Products that
|
||||
are not provided on a paid basis are not competitive.
|
||||
|
||||
"Product" means software that is offered to end users to manage
|
||||
in their own environments or offered as a service on a hosted
|
||||
in their own environments or offered as a service on a hosted
|
||||
basis.
|
||||
|
||||
"Embedded" means including the source code or executable code
|
||||
from the Licensed Work in a competitive offering. "Embedded"
|
||||
also means packaging the competitive offering in such a way
|
||||
that the Licensed Work must be accessed or downloaded for the
|
||||
also means packaging the competitive offering in such a way
|
||||
that the Licensed Work must be accessed or downloaded for the
|
||||
competitive offering to operate.
|
||||
|
||||
Hosting or using the Licensed Work(s) for internal purposes
|
||||
within an organization is not considered a competitive
|
||||
offering. HashiCorp considers your organization to include all
|
||||
Hosting or using the Licensed Work(s) for internal purposes
|
||||
within an organization is not considered a competitive
|
||||
offering. HashiCorp considers your organization to include all
|
||||
of your affiliates under common control.
|
||||
|
||||
For binding interpretive guidance on using HashiCorp products
|
||||
under the Business Source License, please visit our FAQ.
|
||||
For binding interpretive guidance on using HashiCorp products
|
||||
under the Business Source License, please visit our FAQ.
|
||||
(https://www.hashicorp.com/license-faq)
|
||||
Change Date: Four years from the date the Licensed Work is published.
|
||||
Change License: MPL 2.0
|
||||
|
||||
@ -523,20 +523,10 @@ module Vagrant
|
||||
if Vagrant.strict_dependency_enforcement
|
||||
@logger.debug("Enabling strict dependency enforcement")
|
||||
plugin_deps += vagrant_internal_specs.map do |spec|
|
||||
# NOTE: When working within bundler, skip any system plugins and
|
||||
# default gems. However, when not within bundler (in the installer)
|
||||
# include them as strict dependencies to prevent the resolver from
|
||||
# attempting to create a solution with a newer version. The request
|
||||
# set does allow for resolving conservatively but it can't be set
|
||||
# from the public API (requires an instance variable set on the resolver
|
||||
# instance) so strict dependencies are used instead.
|
||||
if Vagrant.in_bundler?
|
||||
next if system_plugins.include?(spec.name)
|
||||
# # If this spec is for a default plugin included in
|
||||
# # the ruby stdlib, ignore it
|
||||
next if spec.default_gem?
|
||||
end
|
||||
|
||||
next if system_plugins.include?(spec.name)
|
||||
# If this spec is for a default plugin included in
|
||||
# the ruby stdlib, ignore it
|
||||
next if spec.default_gem?
|
||||
# If we are not running within the installer and
|
||||
# we are not within a bundler environment then we
|
||||
# only want activated specs
|
||||
|
||||
@ -838,59 +838,26 @@ module VagrantPlugins
|
||||
end
|
||||
|
||||
def supported_key_types
|
||||
return @supported_key_types if @supported_key_types
|
||||
|
||||
if @connection.nil?
|
||||
raise Vagrant::Errors::SSHNotReady
|
||||
end
|
||||
|
||||
list = ""
|
||||
result = sudo("sshd -T | grep key", {error_check: false}) do |type, data|
|
||||
list << data
|
||||
server_data = @connection.
|
||||
transport&.
|
||||
algorithms&.
|
||||
instance_variable_get(:@server_data)
|
||||
if server_data.nil?
|
||||
@logger.warn("No server data available for key type support check")
|
||||
raise ServerDataError, "no data available"
|
||||
end
|
||||
if !server_data.is_a?(Hash)
|
||||
@logger.warn("Server data is not expected type (expecting Hash, got #{server_data.class})")
|
||||
raise ServerDataError, "unexpected type encountered (expecting Hash, got #{server_data.class})"
|
||||
end
|
||||
|
||||
# If the command failed, attempt to extract some supported
|
||||
# key information from within net-ssh
|
||||
if result != 0
|
||||
server_data = @connection.
|
||||
transport&.
|
||||
algorithms&.
|
||||
instance_variable_get(:@server_data)
|
||||
if server_data.nil?
|
||||
@logger.warn("No server data available for key type support check")
|
||||
raise ServerDataError, "no data available"
|
||||
end
|
||||
if !server_data.is_a?(Hash)
|
||||
@logger.warn("Server data is not expected type (expecting Hash, got #{server_data.class})")
|
||||
raise ServerDataError, "unexpected type encountered (expecting Hash, got #{server_data.class})"
|
||||
end
|
||||
@logger.debug("server supported key type list: #{server_data[:host_key]}")
|
||||
|
||||
@logger.debug("server supported key type list (extracted from connection server info using host key): #{server_data[:host_key]}")
|
||||
return @supported_key_types = server_data[:host_key]
|
||||
end
|
||||
|
||||
# Convert the options into a Hash for easy access
|
||||
opts = Hash[*list.split("\n").map{|line| line.split(" ", 2)}.flatten]
|
||||
|
||||
# Define the option names to check for in preferred order
|
||||
# NOTE: pubkeyacceptedkeytypes has been renamed to pubkeyacceptedalgorithms
|
||||
# ref: https://github.com/openssh/openssh-portable/commit/ee9c0da8035b3168e8e57c1dedc2d1b0daf00eec
|
||||
["pubkeyacceptedalgorithms", "pubkeyacceptedkeytypes", "hostkeyalgorithms"].each do |opt_name|
|
||||
next if !opts.key?(opt_name)
|
||||
|
||||
@supported_key_types = opts[opt_name].split(",")
|
||||
@logger.debug("server supported key type list (using #{opt_name}): #{@supported_key_types}")
|
||||
|
||||
return @supported_key_types
|
||||
end
|
||||
|
||||
# Still here means unable to determine key types
|
||||
# so log what information was returned and toss
|
||||
# and error
|
||||
@logger.warn("failed to determine supported key types from remote inspection")
|
||||
@logger.debug("data returned for supported key types remote inspection: #{list.inspect}")
|
||||
|
||||
raise ServerDataError, "no data available"
|
||||
server_data[:host_key]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -348,7 +348,7 @@ module VagrantPlugins
|
||||
|
||||
network_info = inspect_network(all_networks)
|
||||
network_info.each do |network|
|
||||
config = Array(network["IPAM"]["Config"])
|
||||
config = network["IPAM"]["Config"]
|
||||
if (config.size > 0 &&
|
||||
config.first["Subnet"] == subnet_string)
|
||||
@logger.debug("Found existing network #{network["Name"]} already configured with #{subnet_string}")
|
||||
|
||||
@ -69,8 +69,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
let(:command_stderr_data) { '' }
|
||||
# Mock for net-ssh scp
|
||||
let(:scp) { double("scp") }
|
||||
# Value returned from remote ssh supported key check
|
||||
let(:sudo_supported_key_list) { "pubkeyacceptedalgorithms ssh-rsa" }
|
||||
|
||||
|
||||
# Setup for commands using the net-ssh connection. This can be reused where needed
|
||||
# by providing to `before`
|
||||
@ -94,16 +93,13 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
and_yield(nil, exit_data)
|
||||
# Return mocked net-ssh connection during setup
|
||||
allow(communicator).to receive(:retryable).and_return(connection)
|
||||
# Stub in a response for supported key types check
|
||||
allow(communicator).to receive(:sudo).with("sshd -T | grep key", any_args).
|
||||
and_yield(:stdout, sudo_supported_key_list).and_return(0)
|
||||
end
|
||||
|
||||
before do
|
||||
allow(host).to receive(:capability?).and_return(false)
|
||||
end
|
||||
|
||||
describe "#wait_for_ready" do
|
||||
describe ".wait_for_ready" do
|
||||
before(&connection_setup)
|
||||
context "with no static config (default scenario)" do
|
||||
context "when ssh_info requires a multiple tries before it is ready" do
|
||||
@ -166,7 +162,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#reset!" do
|
||||
describe "reset!" do
|
||||
let(:connection) { double("connection") }
|
||||
|
||||
before do
|
||||
@ -186,7 +182,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#ready?" do
|
||||
describe ".ready?" do
|
||||
before(&connection_setup)
|
||||
it "returns true if shell test is successful" do
|
||||
expect(communicator.ready?).to be(true)
|
||||
@ -252,6 +248,8 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
let(:path_joiner){ double("path_joiner") }
|
||||
let(:algorithms) { double(:algorithms) }
|
||||
let(:transport) { double(:transport, algorithms: algorithms) }
|
||||
let(:valid_key_types) { [] }
|
||||
let(:server_data) { { host_key: valid_key_types} }
|
||||
|
||||
before do
|
||||
allow(Vagrant::Util::Keypair).to receive(:create).
|
||||
@ -266,6 +264,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
allow(guest).to receive(:capability).with(:insert_public_key)
|
||||
allow(guest).to receive(:capability).with(:remove_public_key)
|
||||
allow(connection).to receive(:transport).and_return(transport)
|
||||
allow(algorithms).to receive(:instance_variable_get).with(:@server_data).and_return(server_data)
|
||||
allow(communicator).to receive(:supported_key_types).and_raise(described_class.const_get(:ServerDataError))
|
||||
end
|
||||
|
||||
@ -298,7 +297,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
|
||||
context "with server algorithm support data" do
|
||||
before do
|
||||
allow(communicator).to receive(:supported_key_types).and_return(valid_key_types)
|
||||
allow(communicator).to receive(:supported_key_types).and_call_original
|
||||
end
|
||||
|
||||
context "when rsa is the only match" do
|
||||
@ -372,7 +371,8 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
|
||||
context "when an error is encountered getting server data" do
|
||||
before do
|
||||
expect(communicator).to receive(:supported_key_types).and_raise(StandardError)
|
||||
expect(communicator).to receive(:supported_key_types).and_call_original
|
||||
expect(connection).to receive(:transport).and_raise(StandardError)
|
||||
end
|
||||
|
||||
it "should default to rsa key" do
|
||||
@ -385,7 +385,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#execute" do
|
||||
describe ".execute" do
|
||||
before(&connection_setup)
|
||||
it "runs valid command and returns successful status code" do
|
||||
expect(command_channel).to receive(:send_data).with(/ls \/\n/)
|
||||
@ -579,7 +579,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#test" do
|
||||
describe ".test" do
|
||||
before(&connection_setup)
|
||||
context "with exit code as zero" do
|
||||
it "returns true" do
|
||||
@ -598,7 +598,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#upload" do
|
||||
describe ".upload" do
|
||||
before do
|
||||
expect(communicator).to receive(:scp_connect).and_yield(scp)
|
||||
allow(communicator).to receive(:create_remote_directory)
|
||||
@ -704,7 +704,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#download" do
|
||||
describe ".download" do
|
||||
before do
|
||||
expect(communicator).to receive(:scp_connect).and_yield(scp)
|
||||
end
|
||||
@ -715,7 +715,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#connect" do
|
||||
describe ".connect" do
|
||||
|
||||
it "cannot be called directly" do
|
||||
expect{ communicator.connect }.to raise_error(NoMethodError)
|
||||
@ -1030,7 +1030,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#insecure_key?" do
|
||||
describe ".insecure_key?" do
|
||||
let(:key_data) { "" }
|
||||
let(:key_file) {
|
||||
if !@key_file
|
||||
@ -1069,7 +1069,7 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#generate_environment_export" do
|
||||
describe ".generate_environment_export" do
|
||||
it "should generate bourne shell compatible export" do
|
||||
expect(communicator.send(:generate_environment_export, "TEST", "value")).to eq("export TEST=\"value\"\n")
|
||||
end
|
||||
@ -1082,129 +1082,4 @@ describe VagrantPlugins::CommunicatorSSH::Communicator do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#supported_key_types" do
|
||||
let(:sudo_result) { 0 }
|
||||
let(:sudo_data) { "" }
|
||||
let(:server_data_error) { VagrantPlugins::CommunicatorSSH::Communicator::ServerDataError }
|
||||
let(:transport) { double("transport", algorithms: algorithms) }
|
||||
let(:algorithms) { double("algorithms") }
|
||||
|
||||
before do
|
||||
allow(communicator).to receive(:ready?).and_return(true)
|
||||
expect(communicator).to receive(:sudo).
|
||||
with("sshd -T | grep key", any_args).
|
||||
and_yield(:stdout, sudo_data).
|
||||
and_return(sudo_result)
|
||||
# The @connection value is checked to determine if supported key types
|
||||
# can be checked. To facilitate this, set it to a non-nil value
|
||||
communicator.instance_variable_set(:@connection, connection)
|
||||
allow(connection).to receive(:transport).and_return(transport)
|
||||
end
|
||||
|
||||
it "should raise an error when no data is returned" do
|
||||
expect { communicator.send(:supported_key_types) }.to raise_error(server_data_error)
|
||||
end
|
||||
|
||||
context "when sudo command is unsuccessful" do
|
||||
let(:sudo_result) { 1 }
|
||||
|
||||
it "should inspect the net-ssh connection" do
|
||||
expect(algorithms).to receive(:instance_variable_get).
|
||||
with(:@server_data).and_return({})
|
||||
communicator.send(:supported_key_types)
|
||||
end
|
||||
end
|
||||
|
||||
context "when data includes pubkeyacceptedalgorithms" do
|
||||
let(:sudo_data) do
|
||||
"pubkeyauthentication yes
|
||||
gssapikeyexchange no
|
||||
gssapistorecredentialsonrekey no
|
||||
trustedusercakeys none
|
||||
revokedkeys none
|
||||
authorizedkeyscommand none
|
||||
authorizedkeyscommanduser none
|
||||
hostkeyagent none
|
||||
hostbasedacceptedkeytypes ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
hostkeyalgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
pubkeyacceptedalgorithms rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
authorizedkeysfile .ssh/authorized_keys
|
||||
hostkey /etc/ssh/ssh_host_rsa_key
|
||||
rekeylimit 0 0"
|
||||
end
|
||||
|
||||
it "should return expected values" do
|
||||
expect(communicator.send(:supported_key_types)).to eq(["rsa-sha2-512", "rsa-sha2-256", "ssh-rsa"])
|
||||
end
|
||||
end
|
||||
|
||||
context "when data includes pubkeyacceptedkeytypes" do
|
||||
let(:sudo_data) do
|
||||
"pubkeyauthentication yes
|
||||
gssapikeyexchange no
|
||||
gssapistorecredentialsonrekey no
|
||||
trustedusercakeys none
|
||||
revokedkeys none
|
||||
authorizedkeyscommand none
|
||||
authorizedkeyscommanduser none
|
||||
hostkeyagent none
|
||||
hostbasedacceptedkeytypes ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
hostkeyalgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
pubkeyacceptedkeytypes rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
authorizedkeysfile .ssh/authorized_keys
|
||||
hostkey /etc/ssh/ssh_host_rsa_key
|
||||
rekeylimit 0 0"
|
||||
end
|
||||
|
||||
it "should return expected values" do
|
||||
expect(communicator.send(:supported_key_types)).
|
||||
to eq(["rsa-sha2-512", "rsa-sha2-256", "ssh-rsa"])
|
||||
end
|
||||
end
|
||||
|
||||
context "when data does not include pubkeyacceptedalgorithms or pubkeyacceptedkeytypes" do
|
||||
let(:sudo_data) do
|
||||
"pubkeyauthentication yes
|
||||
gssapikeyexchange no
|
||||
gssapistorecredentialsonrekey no
|
||||
trustedusercakeys none
|
||||
revokedkeys none
|
||||
authorizedkeyscommand none
|
||||
authorizedkeyscommanduser none
|
||||
hostkeyagent none
|
||||
hostbasedacceptedkeytypes ecdsa-sha2-nistp521,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
hostkeyalgorithms ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
|
||||
authorizedkeysfile .ssh/authorized_keys
|
||||
hostkey /etc/ssh/ssh_host_rsa_key
|
||||
rekeylimit 0 0"
|
||||
end
|
||||
|
||||
it "should use hostkeyalgorithms" do
|
||||
expect(communicator.send(:supported_key_types)).
|
||||
to eq(["ssh-ed25519", "rsa-sha2-512", "rsa-sha2-256", "ssh-rsa"])
|
||||
end
|
||||
end
|
||||
|
||||
context "when data does not include defined config options" do
|
||||
let(:sudo_data) do
|
||||
"pubkeyauthentication yes
|
||||
gssapikeyexchange no
|
||||
gssapistorecredentialsonrekey no
|
||||
trustedusercakeys none
|
||||
revokedkeys none
|
||||
authorizedkeyscommand none
|
||||
authorizedkeyscommanduser none
|
||||
hostkeyagent none
|
||||
authorizedkeysfile .ssh/authorized_keys
|
||||
hostkey /etc/ssh/ssh_host_rsa_key
|
||||
rekeylimit 0 0"
|
||||
end
|
||||
|
||||
it "should raise error" do
|
||||
expect { communicator.send(:supported_key_types) }.
|
||||
to raise_error(server_data_error)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -667,68 +667,21 @@ describe VagrantPlugins::DockerProvider::Driver do
|
||||
let(:subnet_string) { "172.20.0.0/16" }
|
||||
let(:network_names) { ["vagrant_network_172.20.0.0/16", "bridge", "null" ] }
|
||||
|
||||
before do
|
||||
it "returns network name if defined" do
|
||||
allow(subject).to receive(:list_network_names).and_return(network_names)
|
||||
allow(subject).to receive(:inspect_network).and_return(JSON.load(docker_network_struct))
|
||||
end
|
||||
|
||||
it "returns network name if defined" do
|
||||
network_name = subject.network_defined?(subnet_string)
|
||||
expect(network_name).to eq("vagrant_network_172.20.0.0/16")
|
||||
end
|
||||
|
||||
it "returns nil name if not defined" do
|
||||
allow(subject).to receive(:list_network_names).and_return(network_names)
|
||||
allow(subject).to receive(:inspect_network).and_return(JSON.load(docker_network_struct))
|
||||
|
||||
network_name = subject.network_defined?("120.20.0.0/24")
|
||||
expect(network_name).to eq(nil)
|
||||
end
|
||||
|
||||
context "when config information is missing" do
|
||||
let(:docker_network_struct) do
|
||||
[
|
||||
{
|
||||
"Name": "bridge",
|
||||
"Id": "ae74f6cc18bbcde86326937797070b814cc71bfc4a6d8e3e8cf3b2cc5c7f4a7d",
|
||||
"Created": "2019-03-20T14:10:06.313314662-07:00",
|
||||
"Scope": "local",
|
||||
"Driver": "bridge",
|
||||
"EnableIPv6": false,
|
||||
"IPAM": {
|
||||
"Driver": "default",
|
||||
"Options": nil,
|
||||
},
|
||||
"Internal": false,
|
||||
"Attachable": false,
|
||||
"Ingress": false,
|
||||
"ConfigFrom": {
|
||||
"Network": ""
|
||||
},
|
||||
"ConfigOnly": false,
|
||||
"Containers": {
|
||||
"a1ee9b12bcea8268495b1f43e8d1285df1925b7174a695075f6140adb9415d87": {
|
||||
"Name": "vagrant-sandbox_docker-1_1553116237",
|
||||
"EndpointID": "fc1b0ed6e4f700cf88bb26a98a0722655191542e90df3e3492461f4d1f3c0cae",
|
||||
"MacAddress": "02:42:ac:11:00:02",
|
||||
"IPv4Address": "172.17.0.2/16",
|
||||
"IPv6Address": ""
|
||||
},
|
||||
"Options": {
|
||||
"com.docker.network.bridge.default_bridge": "true",
|
||||
"com.docker.network.bridge.enable_icc": "true",
|
||||
"com.docker.network.bridge.enable_ip_masquerade": "true",
|
||||
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
|
||||
"com.docker.network.bridge.name": "docker0",
|
||||
"com.docker.network.driver.mtu": "1500"
|
||||
},
|
||||
"Labels": {}
|
||||
},
|
||||
}
|
||||
].to_json
|
||||
end
|
||||
|
||||
it "should not raise an error" do
|
||||
expect { subject.network_defined?(subnet_string) }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#network_containing_address' do
|
||||
|
||||
@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
||||
s.summary = "Build and distribute virtualized development environments."
|
||||
s.description = "Vagrant is a tool for building and distributing virtualized development environments."
|
||||
|
||||
s.required_ruby_version = ">= 3.0", "< 3.4"
|
||||
s.required_ruby_version = ">= 3.0", "< 3.3"
|
||||
s.required_rubygems_version = ">= 1.3.6"
|
||||
|
||||
s.add_dependency "bcrypt_pbkdf", "~> 1.1"
|
||||
@ -34,7 +34,7 @@ Gem::Specification.new do |s|
|
||||
s.add_dependency "rexml", "~> 3.2"
|
||||
s.add_dependency "rgl", "~> 0.5.10"
|
||||
s.add_dependency "rubyzip", "~> 2.3.2"
|
||||
s.add_dependency "vagrant_cloud", "~> 3.1.1"
|
||||
s.add_dependency "vagrant_cloud", "~> 3.1.0"
|
||||
s.add_dependency "wdm", "~> 0.1.1"
|
||||
s.add_dependency "winrm", ">= 2.3.6", "< 3.0"
|
||||
s.add_dependency "winrm-elevated", ">= 1.2.3", "< 2.0"
|
||||
|
||||
@ -1 +1 @@
|
||||
2.4.2.dev
|
||||
2.4.1.dev
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
{
|
||||
"VERSION": "2.4.1",
|
||||
"VERSION": "2.4.0",
|
||||
"VMWARE_UTILITY_VERSION": "1.0.22"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user