Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/archive.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Herpai <wigyori@uid0.hu>2017-01-31 16:07:22 +0300
committerGitHub <noreply@github.com>2017-01-31 16:07:22 +0300
commitb6fa1db9b32c4a8f0c3bb76695923ae9788a1c7b (patch)
tree0d7bfe00e6560d87046467e075ec781d055c61b0
parent4e53a6e9c560b54361f9ed3639e8d12f9ab8939d (diff)
parent6ec32832d25335355d205c4601d4a8ca5dfd6808 (diff)
Merge pull request #351 from hnyman/uhttpd-cert
uhttpd: enable certificate creation with OpenSSL
-rw-r--r--package/network/services/uhttpd/Makefile2
-rwxr-xr-xpackage/network/services/uhttpd/files/uhttpd.init12
2 files changed, 10 insertions, 4 deletions
diff --git a/package/network/services/uhttpd/Makefile b/package/network/services/uhttpd/Makefile
index b7238567a8..f633843fd2 100644
--- a/package/network/services/uhttpd/Makefile
+++ b/package/network/services/uhttpd/Makefile
@@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=uhttpd
-PKG_VERSION:=2015-11-08
+PKG_VERSION:=2016-10-05
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE_PROTO:=git
diff --git a/package/network/services/uhttpd/files/uhttpd.init b/package/network/services/uhttpd/files/uhttpd.init
index d411d2aaf5..336f885be9 100755
--- a/package/network/services/uhttpd/files/uhttpd.init
+++ b/package/network/services/uhttpd/files/uhttpd.init
@@ -7,6 +7,7 @@ USE_PROCD=1
UHTTPD_BIN="/usr/sbin/uhttpd"
PX5G_BIN="/usr/sbin/px5g"
+OPENSSL_BIN="/usr/bin/openssl"
append_arg() {
local cfg="$1"
@@ -43,10 +44,15 @@ generate_keys() {
config_get location "$cfg" location
config_get commonname "$cfg" commonname
- [ -x "$PX5G_BIN" ] && {
- $PX5G_BIN selfsigned -der \
+ # Prefer px5g for certificate generation (existence evaluated last)
+ local GENKEY_CMD=""
+ local UNIQUEID=$(dd if=/dev/urandom bs=1 count=4 | hexdump -e '1/1 "%02x"')
+ [ -x "$OPENSSL_BIN" ] && GENKEY_CMD="$OPENSSL_BIN req -x509 -outform der -nodes"
+ [ -x "$PX5G_BIN" ] && GENKEY_CMD="$PX5G_BIN selfsigned -der"
+ [ -n "$GENKEY_CMD" ] && {
+ $GENKEY_CMD \
-days ${days:-730} -newkey rsa:${bits:-2048} -keyout "${UHTTPD_KEY}.new" -out "${UHTTPD_CERT}.new" \
- -subj /C="${country:-DE}"/ST="${state:-Saxony}"/L="${location:-Leipzig}"/CN="${commonname:-OpenWrt}"
+ -subj /C="${country:-DE}"/ST="${state:-Saxony}"/L="${location:-Leipzig}"/O="${commonname:-Openwrt}$UNIQUEID"/CN="${commonname:-OpenWrt}"
sync
mv "${UHTTPD_KEY}.new" "${UHTTPD_KEY}"
mv "${UHTTPD_CERT}.new" "${UHTTPD_CERT}"