Skip to content

Instantly share code, notes, and snippets.

@CvH
Forked from bmaupin/build-openssl.sh
Last active January 25, 2023 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CvH/470a70678dc5b537a477b7daf881d526 to your computer and use it in GitHub Desktop.
Save CvH/470a70678dc5b537a477b7daf881d526 to your computer and use it in GitHub Desktop.
Build openssl (with SSLv2/3 support for security testing)
#!/bin/bash
# OpenSSL version from https://openssl.org/source/
openssl_version=3.0.7
# Install build dependencies
apt -y install build-essential
# Build OpenSSL
cd /root
wget https://openssl.org/source/openssl-${openssl_version}.tar.gz
tar xf "openssl-$openssl_version.tar.gz"
cd "openssl-$openssl_version"
./config --prefix="$(pwd)/local" --openssldir=/usr/lib/ssl enable-ssl2 enable-ssl3 no-shared
make depend
make
make -i install
cp local/bin/openssl /usr/bin/
# To test:
# $ openssl s_client -connect google.com:443 -ssl2
# 139675635414688:error:1407F0E5:SSL routines:ssl2_write:ssl handshake failure:s2_pkt.c:412:
# $ openssl s_client -connect google.com:443 -ssl3
# 140647504119456:error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number:s3_pkt.c:365:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment