openssl: Add a add-trusted-certificate script

This commit is contained in:
Fredrik Fornwall 2019-09-30 22:49:37 +02:00
parent ff97b8f3dd
commit 400f24d1ad
2 changed files with 27 additions and 0 deletions

View File

@ -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

View File

@ -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
}