-
-
Save elcheco/d7eebcaa8bb2b8afb6171a9ce24e923a to your computer and use it in GitHub Desktop.
| #!/bin/bash | |
| OPENSSL_VERSION=$(openssl version) | |
| if [[ $OPENSSL_VERSION == *"OpenSSL 1.1.1m"* ]]; then | |
| sudo DEBIAN_FRONTEND=noninteractive echo 'OpenSSL already compiled to the correct version' ; | |
| else | |
| cd /home/vagrant | |
| mkdir build | |
| mkdir build/openssl | |
| wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz | |
| wget https://www.openssl.org/source/openssl-1.1.1m.tar.gz.sha256 | |
| tar -zxf openssl-1.1.1m.tar.gz --directory build/openssl | |
| cd build/openssl/openssl-1.1.1m/ | |
| ./config --prefix=/opt/openssl --openssldir=/opt/openssl/ssl | |
| make | |
| sudo make install | |
| sudo mv /usr/bin/openssl /usr/bin/openssl.old | |
| sudo mv /usr/bin/c_rehash /usr/bin/c_rehash.old | |
| sudo ln -s /opt/openssl/bin/openssl /usr/bin/openssl | |
| sudo ln -s /opt/openssl/bin/c_rehash /usr/bin/c_rehash | |
| sudo touch /etc/profile.d/openssl.sh | |
| sudo chmod +x /etc/profile.d/openssl.sh | |
| sudo tee -a /etc/profile.d/openssl.sh > /dev/null <<EOT | |
| #!/bin/sh | |
| export LD_LIBRARY_PATH=/opt/openssl/lib:${LD_LIBRARY_PATH} | |
| EOT | |
| echo "Updating configs" | |
| echo "source /etc/profile.d/openssl.sh" | sudo tee -a /etc/bash.bashrc | |
| echo "source /etc/profile.d/openssl.sh" | sudo tee -a /etc/zsh/zprofile | |
| cd /home/vagrant | |
| rm openssl-1.1.1m.tar.gz | |
| rm openssl-1.1.1m.tar.gz.sha256 | |
| fi |
mv: rename /usr/bin/openssl to /usr/bin/openssl.old: Operation not permitted
mv: rename /usr/bin/c_rehash to /usr/bin/c_rehash.old: No such file or directory
ln: /usr/bin/openssl: Operation not permitted
ln: /usr/bin/c_rehash: Operation not permitted
touch: /etc/profile.d/openssl.sh: No such file or directory
chmod: /etc/profile.d/openssl.sh: No such file or directory
tee: /etc/profile.d/openssl.sh: No such file or directory
Updating configs
source /etc/profile.d/openssl.sh
tee: /etc/zsh/zprofile: No such file or directory
source /etc/profile.d/openssl.sh
./install_openssl: line 33: cd: /home/vagrant: No such file or directory
rm: openssl-1.1.1m.tar.gz: No such file or directory
rm: openssl-1.1.1m.tar.gz.sha256: No such file or directory
On which Linux distro are you using it? On Vagrant?
MacOS Monterey
Laravel Homestead - is a pre-build virtual machine using Linux Ubuntu 20.04 for ARM64 - the issue is that OpenSSL doesn't work inside this VM. - i's not code which works on macOS, but in VM running on macOS...
There's a known unresolved bug in OpenSSL 1.1.1f for arm64 processors which is used in the following:
ubuntu-20.04.2-live-server-arm64.iso
ubuntu-20.04.3-live-server-arm64.iso
This makes issues also in the Laravel Homestead ARM64 version:
You get
Segmentation faulterror messages just by calling curl command on the command line, also php-curl, guzzlehttp is affected.This could be fixed by recompiling
opensslhigher then 1.1.1l (probably), but to recompile openssl exited for many users with following erroropenssl: symbol lookup error: openssl: undefined symbol: EVP_md2, version OPENSSL_1_1_0.I found some workaround - add the above script into you
after.shin your homestead directory. Be aware thatafter.shfile have to start with#!/bin/bashand not#!/bin/sh. If youvagrant reload --provisionorvagrant up --provision(or destroy and up) your vagrant, it will compile and set the latestOpenSSL 1.1.1mversion and everything works fine. There will bebuilddirectory in the homestead home directory.