Closed adamc-formlogic closed 1 year ago
I also obtained and reproduced this issue on a machine running Ubuntu 23.04, same basic configuration as above.
I have a working theory about what might be going on. The patch has the following block:
if have_header("openssl/opensslv.h")
append_ldflags(["-lssl", "-lcrypto"])
create_makefile("vagrant_ssl")
else
# If the header file isn't found, just create a dummy
# Makefile and stub the library to make it a noop
File.open("Makefile", "wb") do |f|
f.write(dummy_makefile(__dir__).join("\n"))
end
FileUtils.touch("vagrant_ssl.so")
end
This checks for the presence of the OpenSSL development libraries on the machine, and if they exist, builds the helper; but if they do not exist, it creates a zero-byte file where the helper would go.
The .deb and .rpm packages have this zero-byte file:
$ rpm2cpio ../vagrant-2.3.7-1.x86_64.rpm | cpio -tv | grep vagrant_ssl.so
-rw-r--r-- 1 root root 0 Jun 15 15:14 ./opt/vagrant/embedded/gems/gems/vagrant-2.3.7/ext/vagrant_ssl/vagrant_ssl.so
$ dpkg -c vagrant_2.3.7-1_amd64.deb | grep vagrant_ssl.so
-rw-r--r-- 0/0 0 2023-06-15 15:14 ./opt/vagrant/embedded/gems/gems/vagrant-2.3.7/ext/vagrant_ssl/vagrant_ssl.so
I think the machine that's building the release packages does not itself have the development OpenSSL library installed, so it's taking the "touch an empty file" code path, and that empty file is being included in the packages.
I did try building Vagrant from source enough to get the actual version of this file:
$ cd ext/vagrant_ssl/; ruby extconf.rb; make; ls -l
checking for openssl/opensslv.h... yes
checking for whether -lssl is accepted as LDFLAGS... yes
checking for whether -lcrypto is accepted as LDFLAGS... yes
creating Makefile
compiling vagrant_ssl.c
linking shared-object vagrant_ssl.so
total 56
-rw-r--r-- 1 root root 8639 Jun 20 23:12 Makefile
-rw-rw-r-- 1 ubuntu ubuntu 692 Jun 20 21:50 extconf.rb
-rw-r--r-- 1 root root 3000 Jun 20 23:12 mkmf.log
-rw-rw-r-- 1 ubuntu ubuntu 710 Jun 20 21:50 vagrant_ssl.c
-rw-rw-r-- 1 ubuntu ubuntu 250 Jun 20 21:50 vagrant_ssl.h
-rw-r--r-- 1 root root 7520 Jun 20 23:12 vagrant_ssl.o
-rwxr-xr-x 1 root root 18296 Jun 20 23:12 vagrant_ssl.so
but I was unable to figure out where to put it in the /opt/vagrant
file structure such that it actually got used. (Overwriting the zero-byte file did not do the trick.)
It does seem to get read:
$ strace -f vagrant rdp 2>&1 | grep vagrant_ssl | grep -v ENOENT
[pid 194589] stat("/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so", {st_mode=S_IFREG|0755, st_size=18296, ...}) = 0
[pid 194589] openat(AT_FDCWD, "/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so", O_RDONLY|O_NONBLOCK|O_CLOEXEC) = 5
[pid 194589] readlink("/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so", 0x7ffdc6933f60, 1023) = -1 EINVAL (Invalid argument)
[pid 194589] stat("/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so", {st_mode=S_IFREG|0755, st_size=18296, ...}) = 0
[pid 194589] openat(AT_FDCWD, "/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so", O_RDONLY|O_CLOEXEC) = 5
$ ls -l /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so
-rwxr-xr-x 1 root root 18296 Jun 20 15:38 /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/lib/vagrant/vagrant_ssl.so
but just having it there isn't doing the trick, and I don't understand Ruby load paths well enough to troubleshoot any further.
@adamc-formlogic Thanks for reporting this. Some modifications to the extension and the package build have resolved this.
A dev build with these changes included is available here. If you have any issues with it, please let me know.
Cheers!
Hi ! @chrisroberts
The docs (https://developer.hashicorp.com/vagrant/docs/installation/source) doesn't mention how to compile it for windows, any tips about how to use it using the vagrant
command please ? :)
@hedocode Are you running Vagrant from source?
@chrisroberts Does this fix make it possible to undo the OpenSSL legacy providers work-around?
I am testing the updated package now. It seems to work on Ubuntu 20.04 LTS, on which I also encountered the problem despite the different OpenSSL version. I've moved on to 22.04 (with out removing openSSL legacy providers), and it also appears to get rid of the error.
FWIW, when I opened #13216, I had searched github but this ticket did not seem relevant based on the summary I saw in the search results.
@salderma Yes, this removes the need for attempting to have them loaded via the configuration file. Instead a small extension is used to load them when Vagrant starts up.
@hedocode If you are running from source, you can build the extension by running bundle exec rake compile
. If you are not running from source, this development build contains installers for all platforms which include the modifications.
@hedocode If you are not running from source, this development build contains installers for all platforms which include the modifications.
Thanks a lot ! I'm testing this right now
I tested this and it worked great. Thanks so much for your help and for the quick fix!
When version 2.3.8 will be released?
I can also confirm the dev build fixed the issue. I was using 2.3.7 and was battling with the problem for 2 weeks.
Got the issue, and also confirm this works well with the 2.3.8 for Windows (this development build)
When version 2.3.8 will be released?
I believe it is almost about time to release. I cannot wait for.
Hello,
I am seeing the same behavior as https://github.com/hashicorp/vagrant/issues/13076 still, even though I am running the latest version of Vagrant. I believe I have enabled the legacy OpenSSL provider as described in this issue:
I am able to do other things that require the legacy provider:
But running WinRM things like
vagrant rdp
still fails with theDigest initialization failed: initialization error
message.Debug output
Debug log gist: https://gist.github.com/adamc-formlogic/2c77f6b5bc0b1eeeb6a354f5f0955937
Expected behavior
vagrant rdp
should begin an RDP session to the running Windows VM.Actual behavior
vagrant rdp
failed with the following error:Reproduction information
Vagrant version
Host operating system
Guest operating system
Windows Server 2016
Steps to reproduce
Vagrantfile
belowvagrant up
vagrant rdp
Vagrantfile