From 82e330017aa96c4002a677026d8dc1599db5f449 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Mon, 30 Sep 2019 22:49:37 +0200 Subject: [PATCH] openssl: Add a add-trusted-certificate script --- packages/openssl/add-trusted-certificate | 20 ++++++++++++++++++++ packages/openssl/build.sh | 7 +++++++ 2 files changed, 27 insertions(+) create mode 100755 packages/openssl/add-trusted-certificate diff --git a/packages/openssl/add-trusted-certificate b/packages/openssl/add-trusted-certificate new file mode 100755 index 000000000..f4f8f7734 --- /dev/null +++ b/packages/openssl/add-trusted-certificate @@ -0,0 +1,20 @@ +#!/bin/sh +set -e -u + +if [ $# != 1 ] || [ "$1" = "-h" ]; then + >&2 echo "usage: add-trusted-certificate FILE" + >&2 echo "where FILE is a .pem, .crt, .cer, or .crl file" + exit 1 +fi + +CERTIFICATE_TO_ADD="$1" +if [ ! -f "$CERTIFICATE_TO_ADD" ]; then + >&2 "Error: Not a readable file: '$CERTIFICATE_TO_ADD'" + exit 1 +fi + +CERT_DIR=@TERMUX_PREFIX@/etc/tls/certs/ +mkdir -p $CERT_DIR +echo "Copying $CERTIFICATE_TO_ADD to $CERT_DIR" +cp "$CERTIFICATE_TO_ADD" $CERT_DIR +openssl rehash -v $CERT_DIR diff --git a/packages/openssl/build.sh b/packages/openssl/build.sh index 16e4f65e3..d8562197d 100644 --- a/packages/openssl/build.sh +++ b/packages/openssl/build.sh @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Library implementing the SSL and TLS protocols as well a TERMUX_PKG_LICENSE="BSD" TERMUX_PKG_DEPENDS="ca-certificates" TERMUX_PKG_VERSION=1.1.1d +TERMUX_PKG_REVISION=1 TERMUX_PKG_SHA256=1e3a91bc1f9dfce01af26026f856e064eab4c8ee0a8f457b5ae30b40b8b711f2 TERMUX_PKG_SRCURL=https://www.openssl.org/source/openssl-${TERMUX_PKG_VERSION/\~/-}.tar.gz TERMUX_PKG_CONFFILES="etc/tls/openssl.cnf" @@ -53,5 +54,11 @@ termux_step_make_install() { make -j 1 install_sw MANDIR=$TERMUX_PREFIX/share/man MANSUFFIX=.ssl mkdir -p $TERMUX_PREFIX/etc/tls/ + cp apps/openssl.cnf $TERMUX_PREFIX/etc/tls/openssl.cnf + + sed "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" \ + $TERMUX_PKG_BUILDER_DIR/add-trusted-certificate \ + > $TERMUX_PREFIX/bin/add-trusted-certificate + chmod 700 $TERMUX_PREFIX/bin/add-trusted-certificate }