diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-05-27 22:20:46 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-05-28 20:28:01 +0200 |
commit | 3cf23fc4eefde870de2c80c0dae5a3f48d676c1f (patch) | |
tree | e599098fa31dbd7ca9073999625cb97dc9673026 /main | |
parent | 9a73206807ec84b890d271b0078a560c13238e15 (diff) | |
download | aports-3cf23fc4eefde870de2c80c0dae5a3f48d676c1f.tar.bz2 aports-3cf23fc4eefde870de2c80c0dae5a3f48d676c1f.tar.xz |
main/libressl: add options -verify_{hostname,email,ip} to s_client
Diffstat (limited to 'main')
-rw-r--r-- | main/libressl/APKBUILD | 8 | ||||
-rw-r--r-- | main/libressl/X509_VERIFY_PARAM_set1_host.patch | 13 | ||||
-rw-r--r-- | main/libressl/s_client-add-options-verify_.patch | 90 |
3 files changed, 109 insertions, 2 deletions
diff --git a/main/libressl/APKBUILD b/main/libressl/APKBUILD index cf7de450e6..ae2c1eb845 100644 --- a/main/libressl/APKBUILD +++ b/main/libressl/APKBUILD @@ -9,7 +9,7 @@ pkgname=libressl pkgver=2.6.4 _namever=${pkgname}${pkgver%.*} -pkgrel=0 +pkgrel=1 pkgdesc="Version of the TLS/crypto stack forked from OpenSSL" url="http://www.libressl.org/" arch="all" @@ -24,6 +24,8 @@ subpackages="$pkgname-dbg $_namever-libcrypto:_libs $_namever-libssl:_libs source="http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/$pkgname-$pkgver.tar.gz starttls-ldap.patch ssl-libcompat.patch + s_client-add-options-verify_.patch + X509_VERIFY_PARAM_set1_host.patch " builddir="$srcdir/$pkgname-$pkgver" @@ -76,4 +78,6 @@ _libs() { sha512sums="181761da573ff392aaee17dd3dde416d7cbb299ab3e07b49c97e279ceb3f619e78d1dc9ec4c59b0af024f0a8270ff31fe37f8282d0392be34c3143c9647cd246 libressl-2.6.4.tar.gz 07e523ae321b4a6a4afbac7acf4bd30e887b8e18ab2801ca42ba48af130b1cb43d56e70d1039b248c6251623b57c1c638db59105e6fbf4e6175be50d67a0473d starttls-ldap.patch -ef8150843f5aae577a859198439673591764fb3ab1da03436607328962f084356fd7f793484c3ad5f2294bd9e8dad15644c311b0da811acbc83eed4b71c0145a ssl-libcompat.patch" +ef8150843f5aae577a859198439673591764fb3ab1da03436607328962f084356fd7f793484c3ad5f2294bd9e8dad15644c311b0da811acbc83eed4b71c0145a ssl-libcompat.patch +140d29a4747368ba4b6a35ab32688abe448fc8746ee0d653f0916371f0259d14fdeaa5c8d37ac04bea91be9a50d9907b36440ab628afe6c4594a6922c951d27d s_client-add-options-verify_.patch +651f87623c74fa7fb8a4ec8185123df7339b4d717a106cadc26e2f0d1c6ba831a80a0bbed6777c887819f0239c2d62893b8557cb30f270171296d05d4f414851 X509_VERIFY_PARAM_set1_host.patch" diff --git a/main/libressl/X509_VERIFY_PARAM_set1_host.patch b/main/libressl/X509_VERIFY_PARAM_set1_host.patch new file mode 100644 index 0000000000..b0e0b8d462 --- /dev/null +++ b/main/libressl/X509_VERIFY_PARAM_set1_host.patch @@ -0,0 +1,13 @@ +diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c +index 3482227..a14177f 100644 +--- a/crypto/x509/x509_vpm.c ++++ b/crypto/x509/x509_vpm.c +@@ -130,6 +130,8 @@ int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, + { + char *copy; + ++ if (name != NULL && namelen == 0) ++ namelen = strlen(name); + /* + * Refuse names with embedded NUL bytes. + * XXX: Do we need to push an error onto the error stack? diff --git a/main/libressl/s_client-add-options-verify_.patch b/main/libressl/s_client-add-options-verify_.patch new file mode 100644 index 0000000000..85cd8092f3 --- /dev/null +++ b/main/libressl/s_client-add-options-verify_.patch @@ -0,0 +1,90 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Sun, 27 May 2018 22:08:00 +0200 +Subject: [PATCH] s_client: Add options -verify_{hostname,ip} + +This code is ported from OpenSSL 1.0.2o. We need it for Busybox wget. + +Symbols X509_VERIFY_PARAM_set1_host and X509_VERIFY_PARAM_set1_ip_asc +are exposed since LibreSSL 2.7.0, so we had to backport it too. + +--- a/apps/openssl/apps.c ++++ b/apps/openssl/apps.c +@@ -1855,6 +1855,8 @@ + char **oldargs = *pargs; + char *arg = **pargs, *argn = (*pargs)[1]; + time_t at_time = 0; ++ char *hostname = NULL; ++ char *ipasc = NULL; + const char *errstr = NULL; + + if (!strcmp(arg, "-policy")) { +@@ -1915,6 +1918,16 @@ + at_time = (time_t) timestamp; + } + (*pargs)++; ++ } else if (strcmp(arg, "-verify_hostname") == 0) { ++ if (!argn) ++ *badarg = 1; ++ hostname = argn; ++ (*pargs)++; ++ } else if (strcmp(arg, "-verify_ip") == 0) { ++ if (!argn) ++ *badarg = 1; ++ ipasc = argn; ++ (*pargs)++; + } else if (!strcmp(arg, "-ignore_critical")) + flags |= X509_V_FLAG_IGNORE_CRITICAL; + else if (!strcmp(arg, "-issuer_checks")) +@@ -1969,6 +1987,12 @@ + + if (at_time) + X509_VERIFY_PARAM_set_time(*pm, at_time); ++ ++ if (hostname && !X509_VERIFY_PARAM_set1_host(*pm, hostname, 0)) ++ *badarg = 1; ++ ++ if (ipasc && !X509_VERIFY_PARAM_set1_ip_asc(*pm, ipasc)) ++ *badarg = 1; + + end: + (*pargs)++; +--- a/apps/openssl/s_client.c ++++ b/apps/openssl/s_client.c +@@ -200,8 +200,11 @@ + BIO_printf(bio_err, " -port port - use -connect instead\n"); + BIO_printf(bio_err, " -connect host:port - who to connect to (default is %s:%s)\n", SSL_HOST_NAME, PORT_STR); + BIO_printf(bio_err, " -proxy host:port - connect to http proxy\n"); ++ BIO_printf(bio_err, " -verify_hostname host - check peer certificate matches \"host\"\n"); ++ BIO_printf(bio_err, " -verify_ip ipaddr - check peer certificate matches \"ipaddr\"\n"); + + BIO_printf(bio_err, " -verify arg - turn on peer certificate verification\n"); ++ BIO_printf(bio_err, " -verify_return_error - return verification errors\n"); + BIO_printf(bio_err, " -cert arg - certificate file to use, PEM format assumed\n"); + BIO_printf(bio_err, " -certform arg - certificate format (PEM or DER) PEM default\n"); + BIO_printf(bio_err, " -key arg - Private key file to use, in cert file if\n"); +--- a/crypto/crypto.sym ++++ b/crypto/crypto.sym +@@ -2816,6 +2816,8 @@ + X509_VERIFY_PARAM_set_time + X509_VERIFY_PARAM_set_trust + X509_VERIFY_PARAM_table_cleanup ++X509_VERIFY_PARAM_set1_host ++X509_VERIFY_PARAM_set1_ip_asc + X509_add1_ext_i2d + X509_add1_reject_object + X509_add1_trust_object + +--- a/include/openssl/x509_vfy.h ++++ b/include/openssl/x509_vfy.h +@@ -542,7 +542,10 @@ + int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param, + STACK_OF(ASN1_OBJECT) *policies); + int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param); +- ++int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param, const char *name, ++ size_t namelen); ++int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param, const char *ipasc); ++ + int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param); + const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name); + void X509_VERIFY_PARAM_table_cleanup(void); |