mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
uhttpd: update to latest Git HEAD (#8832)
* uhttpd: make organization (O=) of the cert configurable via uci Make the organization (O=) of the cert configurable via uci. If not configured, use a combination of "OpenWrt" and an unique id like it was done before. Signed-off-by: Martin Schiller <ms@dev.tdt.de> * uhttpd: add config option for json_script Add a config option for json_script instead of unconditionally including all json files in /etc/uhttpd in every uhttpd instance. This makes it possible to configure a single instance with an unconditional redirect, which currently renders all other uhttpd instances unusable. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be> Acked-by: Felix Fietkau <nbd@nbd.name> * uhttpd: update to latest Git HEAD 2f8b136 main: fix leaking -p/-s argument values 881fd3b ucode: adjust to latest ucode api 8b2868e file: specify UTF-8 as charset for dirlists, add option to override 3a5bd84 main: add ucode options to help text 16aa142 examples: add ucode handler example 3ceccd0 ucode: add ucode plugin support f0f1406 examples: add example Lua handler script 9e87095 listen: avoid invalid memory access Signed-off-by: Jo-Philipp Wich <jo@mein.io> Co-authored-by: Martin Schiller <ms@dev.tdt.de> Co-authored-by: Stijn Tintel <stijn@linux-ipv6.be> Co-authored-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
1d4d8f5889
commit
0baa3ca219
@ -12,15 +12,15 @@ PKG_RELEASE:=1
|
|||||||
|
|
||||||
PKG_SOURCE_PROTO:=git
|
PKG_SOURCE_PROTO:=git
|
||||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
|
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uhttpd.git
|
||||||
PKG_SOURCE_DATE:=2021-03-21
|
PKG_SOURCE_DATE:=2022-02-07
|
||||||
PKG_SOURCE_VERSION:=15346de8d3ba422002496526ee24c62a3601ab8c
|
PKG_SOURCE_VERSION:=2f8b1360df25bab375ec60bbba2dce8dd796161c
|
||||||
PKG_MIRROR_HASH:=819424d071ed7c8888f9ca66f679907831becc59a67dd4a5ec521d5fba0a3171
|
PKG_MIRROR_HASH:=fe9c57492e4da493e9955994d1af6cf0086305633fa8febef7ab6df10c4798fa
|
||||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||||
PKG_LICENSE:=ISC
|
PKG_LICENSE:=ISC
|
||||||
|
|
||||||
PKG_ASLR_PIE_REGULAR:=1
|
PKG_ASLR_PIE_REGULAR:=1
|
||||||
PKG_BUILD_DEPENDS = ustream-ssl
|
PKG_BUILD_DEPENDS = ustream-ssl
|
||||||
PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua
|
PKG_CONFIG_DEPENDS:= CONFIG_uhttpd_lua CONFIG_uhttpd_ucode
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
include $(INCLUDE_DIR)/cmake.mk
|
include $(INCLUDE_DIR)/cmake.mk
|
||||||
@ -49,8 +49,20 @@ define Package/uhttpd/config
|
|||||||
depends on PACKAGE_uhttpd-mod-lua
|
depends on PACKAGE_uhttpd-mod-lua
|
||||||
bool "Enable Integrated Lua interpreter"
|
bool "Enable Integrated Lua interpreter"
|
||||||
default y
|
default y
|
||||||
|
|
||||||
|
config uhttpd_ucode
|
||||||
|
depends on PACKAGE_uhttpd-mod-ucode
|
||||||
|
bool "Enable Integrated ucode interpreter"
|
||||||
|
default y
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/uhttpd/conffiles
|
||||||
|
/etc/config/uhttpd
|
||||||
|
/etc/uhttpd.crt
|
||||||
|
/etc/uhttpd.key
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
define Package/uhttpd-mod-lua
|
define Package/uhttpd-mod-lua
|
||||||
$(Package/uhttpd/default)
|
$(Package/uhttpd/default)
|
||||||
TITLE+= (Lua plugin)
|
TITLE+= (Lua plugin)
|
||||||
@ -73,12 +85,18 @@ define Package/uhttpd-mod-ubus/description
|
|||||||
session.* namespace and procedures.
|
session.* namespace and procedures.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/uhttpd/conffiles
|
|
||||||
/etc/config/uhttpd
|
define Package/uhttpd-mod-ucode
|
||||||
/etc/uhttpd.crt
|
$(Package/uhttpd/default)
|
||||||
/etc/uhttpd.key
|
TITLE+= (ucode plugin)
|
||||||
|
DEPENDS:=uhttpd +libucode
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/uhttpd-mod-ucode/description
|
||||||
|
The ucode plugin adds a CGI-like ucode runtime interface to uHTTPd.
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(CONFIG_USE_GLIBC),)
|
ifneq ($(CONFIG_USE_GLIBC),)
|
||||||
TARGET_CFLAGS += -D_DEFAULT_SOURCE
|
TARGET_CFLAGS += -D_DEFAULT_SOURCE
|
||||||
endif
|
endif
|
||||||
@ -108,7 +126,13 @@ define Package/uhttpd-mod-ubus/install
|
|||||||
$(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus
|
$(INSTALL_DATA) ./files/ubus.default $(1)/etc/uci-defaults/00_uhttpd_ubus
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/uhttpd-mod-ucode/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/uhttpd_ucode.so $(1)/usr/lib/
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
$(eval $(call BuildPackage,uhttpd))
|
$(eval $(call BuildPackage,uhttpd))
|
||||||
$(eval $(call BuildPackage,uhttpd-mod-lua))
|
$(eval $(call BuildPackage,uhttpd-mod-lua))
|
||||||
$(eval $(call BuildPackage,uhttpd-mod-ubus))
|
$(eval $(call BuildPackage,uhttpd-mod-ubus))
|
||||||
|
$(eval $(call BuildPackage,uhttpd-mod-ucode))
|
||||||
|
@ -57,6 +57,14 @@ config uhttpd main
|
|||||||
# matches have precedence over the CGI prefix.
|
# matches have precedence over the CGI prefix.
|
||||||
list lua_prefix "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua"
|
list lua_prefix "/cgi-bin/luci=/usr/lib/lua/luci/sgi/uhttpd.lua"
|
||||||
|
|
||||||
|
# List of prefix->ucode handler mappings.
|
||||||
|
# Any request to an URL beneath the prefix
|
||||||
|
# will be dispatched to the associated ucode
|
||||||
|
# handler script. Ucode support is disabled when
|
||||||
|
# no handler mappings are specified. Ucode prefix
|
||||||
|
# matches have precedence over the CGI prefix.
|
||||||
|
# list ucode_prefix "/ucode/example=/usr/share/example.uc"
|
||||||
|
|
||||||
# Specify the ubus-rpc prefix and socket path.
|
# Specify the ubus-rpc prefix and socket path.
|
||||||
# option ubus_prefix /ubus
|
# option ubus_prefix /ubus
|
||||||
# option ubus_socket /var/run/ubus/ubus.sock
|
# option ubus_socket /var/run/ubus/ubus.sock
|
||||||
|
@ -35,13 +35,14 @@ generate_keys() {
|
|||||||
local cfg="$1"
|
local cfg="$1"
|
||||||
local key="$2"
|
local key="$2"
|
||||||
local crt="$3"
|
local crt="$3"
|
||||||
local days bits country state location commonname
|
local days bits country state location organization commonname
|
||||||
|
|
||||||
config_get days "$cfg" days
|
config_get days "$cfg" days
|
||||||
config_get bits "$cfg" bits
|
config_get bits "$cfg" bits
|
||||||
config_get country "$cfg" country
|
config_get country "$cfg" country
|
||||||
config_get state "$cfg" state
|
config_get state "$cfg" state
|
||||||
config_get location "$cfg" location
|
config_get location "$cfg" location
|
||||||
|
config_get organization "$cfg" organization
|
||||||
config_get commonname "$cfg" commonname
|
config_get commonname "$cfg" commonname
|
||||||
config_get key_type "$cfg" key_type
|
config_get key_type "$cfg" key_type
|
||||||
config_get ec_curve "$cfg" ec_curve
|
config_get ec_curve "$cfg" ec_curve
|
||||||
@ -56,7 +57,7 @@ generate_keys() {
|
|||||||
[ -n "$GENKEY_CMD" ] && {
|
[ -n "$GENKEY_CMD" ] && {
|
||||||
$GENKEY_CMD \
|
$GENKEY_CMD \
|
||||||
-days ${days:-730} -newkey ${KEY_OPTS} -keyout "${UHTTPD_KEY}.new" -out "${UHTTPD_CERT}.new" \
|
-days ${days:-730} -newkey ${KEY_OPTS} -keyout "${UHTTPD_KEY}.new" -out "${UHTTPD_CERT}.new" \
|
||||||
-subj /C="${country:-ZZ}"/ST="${state:-Somewhere}"/L="${location:-Unknown}"/O="${commonname:-OpenWrt}$UNIQUEID"/CN="${commonname:-OpenWrt}"
|
-subj /C="${country:-ZZ}"/ST="${state:-Somewhere}"/L="${location:-Unknown}"/O="${organization:-OpenWrt$UNIQUEID}"/CN="${commonname:-OpenWrt}"
|
||||||
sync
|
sync
|
||||||
mv "${UHTTPD_KEY}.new" "${UHTTPD_KEY}"
|
mv "${UHTTPD_KEY}.new" "${UHTTPD_KEY}"
|
||||||
mv "${UHTTPD_CERT}.new" "${UHTTPD_CERT}"
|
mv "${UHTTPD_CERT}.new" "${UHTTPD_CERT}"
|
||||||
@ -90,6 +91,18 @@ append_lua_prefix() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
append_ucode_prefix() {
|
||||||
|
local v="$1"
|
||||||
|
local prefix="${v%%=*}"
|
||||||
|
local handler="${v#*=}"
|
||||||
|
|
||||||
|
if [ "$prefix" != "$handler" ] && [ -n "$prefix" ] && [ -f "$handler" ]; then
|
||||||
|
procd_append_param command -o "$prefix" -O "$handler"
|
||||||
|
else
|
||||||
|
echo "Skipping invalid ucode prefix \"$v\"" >&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start_instance()
|
start_instance()
|
||||||
{
|
{
|
||||||
UHTTPD_CERT=""
|
UHTTPD_CERT=""
|
||||||
@ -141,6 +154,9 @@ start_instance()
|
|||||||
append_arg "$cfg" ubus_socket "-U"
|
append_arg "$cfg" ubus_socket "-U"
|
||||||
append_bool "$cfg" ubus_cors "-X" 0
|
append_bool "$cfg" ubus_cors "-X" 0
|
||||||
}
|
}
|
||||||
|
[ -f /usr/lib/uhttpd_ucode.so ] && {
|
||||||
|
config_list_foreach "$cfg" ucode_prefix append_ucode_prefix
|
||||||
|
}
|
||||||
append_arg "$cfg" script_timeout "-t"
|
append_arg "$cfg" script_timeout "-t"
|
||||||
append_arg "$cfg" network_timeout "-T"
|
append_arg "$cfg" network_timeout "-T"
|
||||||
append_arg "$cfg" http_keepalive "-k"
|
append_arg "$cfg" http_keepalive "-k"
|
||||||
@ -195,7 +211,8 @@ start_instance()
|
|||||||
append_bool "$cfg" redirect_https "-q" 0
|
append_bool "$cfg" redirect_https "-q" 0
|
||||||
}
|
}
|
||||||
|
|
||||||
for file in /etc/uhttpd/*.json; do
|
config_get json_script "$cfg" json_script
|
||||||
|
for file in $json_script; do
|
||||||
[ -s "$file" ] && procd_append_param command -H "$file"
|
[ -s "$file" ] && procd_append_param command -H "$file"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user