4503 Commits

Author SHA1 Message Date
Chris Roberts
f7185bcd02 Force strict dependencies for default gems
When resolving for a plugin while within the installer, force strict
dependencies for all the default gems to prevent the resolver from
generating solutions where it may attempt to upgrade any of them. If
running within bundler, retain the same behavior and ignore them.
2024-01-18 17:24:48 -08:00
Chris Roberts
886aab2ff9 Load rubygem patches 2024-01-12 15:27:31 -08:00
Chris Roberts
606f825eaa Add patches for MakeMakefile
Provides patches for MakeMakefile and modifies the Ruby path provided
when building extensions to allow loading the custom mkmf.rb file.

The patches perform inspection of flag values and quote any Windows
paths found that are not already quoted. This resolves issues where
builds fail due to spaces in compiler and linker flags on Windows.
2024-01-12 15:24:09 -08:00
Chris Roberts
2d5c9c0d12 Patch net-ssh for ecdsa private keys
This patches net-ssh so it will properly handle loading and using ecdsa
private keys. Patching is restricted to tested versions.
2024-01-10 11:52:46 -08:00
Chris Roberts
96f2039bcd Use ssh key type defined by configuration
If key type is defined as :auto, detect best key type to use. If no
acceptable key type is detected as supported by the server, raise an
error. If unable to determine supported key types from the server,
fallback to original behavior of rsa type key.

If key type is defined as custom value, use that type if the server
supports it, or if the supported types cannot be read. Otherwise, raise
an error informing the user that the key type is not supported.
2024-01-10 11:52:46 -08:00
Chris Roberts
b934bd675c Add new key pair types
Adds ECDSA key types (256, 384, and 521) to supported types that can be
generated for key replacement on guest.
2024-01-10 11:33:30 -08:00
Chris Roberts
4e61783008 Fix autoload for Util::Keypair 2024-01-10 11:32:49 -08:00
Chris Roberts
b741d8332b Fix box collection sorting with mixed architecture
When the box collection consists of a mix of entries with architecture
information and without architecture information, ensure the values are
a common type so sorting does not result in an error.
2024-01-03 16:29:30 -08:00
Chris Roberts
3367154f5d Update CPU mapping values
Specifically for Windows hosts, the target CPU string will report as
`x64`, not `x86_64`. Include the value in the mapping to get the
properly value.
2023-10-19 10:48:18 -07:00
Chris Roberts
288f8ba552 Update path check for ssl helper
A path check is done prior to loading the vagrant ssl helper, but it was
only checking for a file with a `.so` suffix so `.bundle` files on macos
would be ignored and the helper not loaded.

Include both paths when checking for the library existence.
2023-10-18 17:44:18 -07:00
Chris Roberts
c8fc8b3ad2 Include newline on end of comment within private key 2023-10-02 15:38:02 -07:00
Chris Roberts
74b4a2b1f5 Adjust installation for unknown default architecture
When the reported architecture is unknown and the provider is listed as
the default architecture, add the box without architecture information
so it is installed without architecture information on the path within
the collection.
2023-09-26 16:20:37 -07:00
Chris Roberts
c8a7989b88 Adjust internal layout to allow downgrading
With the initial layout of `provider/architecture`, after installing a
box with architecture support downgrading Vagrant would result in it
being unable to process the box collection. Swapping the layout to be
`architecture/provider` allows downgrades to still properly process the
box collection.
2023-09-25 15:09:29 -07:00
Chris Roberts
3ea1beca9e Skip box directories without metadata file 2023-09-18 15:41:28 -07:00
Chris Roberts
9ef5c49598 Use api endpoint for expanded urls
When expanding the box url, prefer the API endpoint which is updated to
include provider architecture information. Test the API endpoint and the
legacy endpoint and use which ever is valid, with the API taking
precedence. This allows Vagrant to continue with non Vagrant Cloud
servers that do not implement the API endpoint.
2023-09-15 17:30:32 -07:00
Chris Roberts
51adb12547 Add architecture support for boxes
Introduce support for handling box architecture. Adds a new
`box_architecture` setting that defaults to `:auto` which will perform
automatic detection of the host system, but can be overridden with a
custom value. Can also be set to `nil` which will result in it fetching
the box flagged with the default architecture within the metadata.

Box collection has been modified to allow existing boxes already
downloaded and unpacked to still function as expected when architecture
information is not available.
2023-09-14 16:15:03 -07:00
Chris Roberts
7824c2dad2 Note when ssl helper was not found 2023-09-14 16:15:02 -07:00
Chris Roberts
eb5aaed72d
Merge pull request #13259 from chrisroberts/remove-exps
Remove experimental checks
2023-09-11 17:31:58 -07:00
Chris Roberts
910290f40a
Merge pull request #13252 from mattlqx/sparse
use the -S flag with bsdtar for sparse extraction of boxes
2023-09-08 16:17:34 -07:00
Chris Roberts
513be177d3 Remove experimental checks
Removes experimental checks on existing experimental features.
2023-09-08 14:15:34 -07:00
Chris Roberts
e958c6183a Adds initial HCP config support
Adds initial basic support for HCP based configuration in vagrant-go.
The initalization process has been updated to remove Vagrantfile parsing
from the client, moving it to the runner using init jobs for the basis
and the project (if there is one). Detection is done on the file based
on extension for Ruby based parsing or HCP based parsing.

Current HCP parsing is extremely simple and currently just a base to
build off. Config components will be able to implement an `Init`
function to handle receiving configuration data from a non-native source
file. This will be extended to include a default approach for injecting
defined data in the future.

Some cleanup was done in the state around validations. Some logging
adjustments were applied on the Ruby side for better behavior
consistency.

VirtualBox provider now caches locale detection to prevent multiple
checks every time the driver is initialized.
2023-09-07 17:26:10 -07:00
Matt Kulka
f5e0c12bb9
use the -S flag with bsdtar for sparse extraction of boxes 2023-08-24 13:09:18 -07:00
Chris Roberts
a7135c000b Apply license adjustments and fixes
Add configuration file for automated license modifications, remove
automated licese modifications from specific locations, and update the
license set in the gem specification.
2023-08-10 17:05:19 -07:00
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
Chris Roberts
e0dbbcc04c Use all insecure private key paths
When constructing the ssh information, use all available insecure key
paths for authentication.
2023-06-26 15:46:15 -07:00
Chris Roberts
380afe5fac Define directory and paths for insecure private keys
Within the environment, add a new directory value which points to the
directory containing the valid insecure private keys. A new default
private key paths value contains an array of all the insecure private
keys which are available for initial authentication.
2023-06-26 15:43:25 -07:00
Chris Roberts
67562588c9 Add ed25519 keypair support
Introduce keypair support for ed25519. Default keypair type when
generating without specifying type is rsa to maintain existing behavior.
2023-06-26 15:06:36 -07:00
Chris Roberts
d83bfc0d40 Perform best effort ssl revocation check on Windows
When performing a request via curl on Windows using schannel, ssl
certificate revocation checks does not handle verification failures
gracefully when an error is encountered that is unrelated to the actual
revocation of a certificate.

A new option is available to perform best effort revocation checks on
curl, so this is enabled by default on the Windows platform. A new
config option (`box_download_disable_ssl_revoke_best_effort`) has also
been added which can be optionally enabled to restore previous behavior
which results in a hard error if any error is encountered.
2023-06-20 16:37:00 -07:00
Chris Roberts
f42269c584 Generated proto updates 2023-06-05 14:18:06 -07:00
Chris Roberts
627a5193ef
Merge pull request #13179 from chrisroberts/ssh-deprecated-types
Enable deprecated key type and host key algorithm
2023-06-02 17:09:52 -07:00
Chris Roberts
415b006ebd Add helper for loading OpenSSL providers
On OpenSSL 3, engines have been deprecated being replaced by providers.
The Ruby openssl library supported loading specific engines, but there
is no replacement currently using providers. The winrm communicator
specifically relies on a MD4 which OpenSSL has marked as legacy and no
longer loads by default.

The extension included loads the legacy provider as well as the default
provider. The legacy provider includes MD4, thus allowing winrm to
function again.
2023-05-25 15:36:55 -07:00
Chris Roberts
0a20379b1a Enable deprecated key type and host key algorithm
Recent versions of OpenSSH remove support of ssh-rsa key types and host
key algorithms from the default conection configuration. Set options to
enable them and provide a configuration option which can disable them if
required.
2023-05-22 17:09:47 -07:00
Chris Roberts
1f26256680 Release file lock before file deletion
When unlocking the file mutex utility always unlock the file prior to
deletion to ensure the file can be properly deleted.
2023-05-17 11:13:10 -07:00
Chris Roberts
b77fb6ab4c
Merge pull request #13031 from chrisroberts/redux-eol-macos
Isolate protobuf message loading to server mode
2023-03-15 15:05:44 -07:00
Sophia Castellarin
72dab76707
Merge pull request #13057 from soapy1/box-race-condition
Add a file mutex when downloading box files.
2023-02-22 15:02:13 -08:00
sophia
4551b8b2ad Use file locks to avoid file existance checking race conditions 2023-02-22 14:28:00 -08:00
lyderX05
a7d87498ed Requested Changes Updated on Fixes
Fixes the issue of Vagrant is unable to execute Get-WindowsOptionalFeature Command changes 2

Fixes #11932
2023-02-16 14:28:21 -08:00
lyderX05
88c5e17c5c Fixes the issue of Vagrant is unable to execute Get-WindowsOptionalFeature Command changes 2
Fixes #11932
2023-02-16 14:28:21 -08:00
lyderX05
b0a4109845 Fixes the issue of Vagrant is unable to execute Get-WindowsOptionalFeature Command.
Fixes #11932
2023-02-16 14:28:21 -08:00
sophia
f153996b2d Add tests for mutex util module 2023-01-13 14:08:27 -08:00
sophia
b91a5d5576 Add file mutex util module 2023-01-13 12:00:46 -08:00
sophia
817fbdd2d1 Add information about lock file path 2023-01-12 16:34:45 -08:00
sophia
bc03f21758 Add a file mutex when downloading box files.
Box's are global to Vagrant. Multiple Vagrant process can all
access the box directory for both downloading and extracting boxes.
A file mutex will ensure that mulitple Vagrant process will not
trample eachother if they are trying to download the same box.
2023-01-12 15:30:06 -08:00
sophia
7661eba89a Environment home dir is also not accessible if EROFS error occurs 2023-01-03 16:01:20 -08:00
Chris Roberts
672a408dbc Isolate protobuf message loading to server mode
Prevent protobuf loading when not in server mode. This allows proper
loading on platforms which don't have support for the protobuf
libraries.
2022-12-16 16:21:06 -08:00
Chris Roberts
e2165917e5 Always load protos regardless of server mode 2022-12-08 11:42:51 -08:00
Chris Roberts
1cd6ac3b31 Isolate loading dependencies for serve command
Only load the dependencies needed for the serve command if the serve
command is being run. This allows Vagrant to properly load on platforms
where some of the dependency libraries may not be available due to
incompatibilities or being EOL.
2022-12-07 15:35:00 -08:00
Chris Roberts
cbddfbd028 Handle missing machine folder value
If the value of the machine folder can not be found in the
system properties, report a user friendly error message and
include relevant information in the logs for debugging.
2022-11-14 10:45:10 -08:00
Chris Roberts
c75e05d4b1
Merge pull request #12913 from nist/File.exists
Replace deprecated File.exists? with File.exist?.
2022-11-08 15:07:21 -08:00
Chris Roberts
40a90fd9b4 Remove net-ssh patches 2022-11-08 13:59:32 -08:00