Bump tor to 0.4.2.7 v1.5.1 v1.5.1-20200401
authorRISCi_ATOM <bob@bobcall.me>
Tue, 31 Mar 2020 20:17:57 +0000 (16:17 -0400)
committerRISCi_ATOM <bob@bobcall.me>
Tue, 31 Mar 2020 20:17:57 +0000 (16:17 -0400)
Fixes CVE-2020-10592 and init scripts.

package/network/services/tor/Makefile
package/network/services/tor/files/tor.conf [new file with mode: 0644]
package/network/services/tor/files/tor.init

index 7263fe71dc5e6146ad601a3899adbd125d4fc6c5..cad225e01b1c87c350d8ffbfd79c69f4d01e5ef1 100644 (file)
@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tor
-PKG_VERSION:=0.4.2.6
+PKG_VERSION:=0.4.2.7
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=https://dist.torproject.org/ \
        https://archive.torproject.org/tor-package-archive
-PKG_HASH:=0500102433849bbe3231c590973d126c2d2d6b3943b4b9f9962bdb108436e6c4
+PKG_HASH:=06a1d835ddf382f6bca40a62e8fb40b71b2f73d56f0d53523c8bd5caf9b3026d
 PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de> \
                Peter Wagner <tripolar@gmx.at>
 PKG_LICENSE_FILES:=LICENSE
@@ -89,6 +89,7 @@ define Package/tor/conffiles
 /etc/tor/torrc
 /var/lib/tor/fingerprint
 /var/lib/tor/keys/*
+/etc/config/tor
 endef
 
 CONFIGURE_ARGS += \
@@ -124,6 +125,8 @@ define Package/tor/install
        $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
        $(INSTALL_DIR) $(1)/etc/tor
        $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/tor.conf $(1)/etc/config/tor
 endef
 
 define Package/tor-gencert/install
diff --git a/package/network/services/tor/files/tor.conf b/package/network/services/tor/files/tor.conf
new file mode 100644 (file)
index 0000000..32e71e5
--- /dev/null
@@ -0,0 +1,5 @@
+config tor conf
+       option default "/etc/tor/torrc"
+       option generated "/tmp/torrc"
+       #list head_include "/full/path/to/file"
+       #list tail_include "/full/path/to/file"
index 1480e73ebf56744c539ebd67776f846b6b306174..142e2512def11559dcf42df3d47ea40feaaa677e 100644 (file)
@@ -6,18 +6,47 @@ STOP=50
 
 USE_PROCD=1
 
-start_service() {
-       touch /var/run/tor.pid
-       chown tor:tor /var/run/tor.pid
+TORRC_GEN="/tmp/torrc"
+
+handle_conf_file() {
+       local conf_path="$1"
+       if [ -f "$conf_path" ] || [ -d "$conf_path" ]; then
+               echo "%include $conf_path"
+       fi
+}
 
+generate_conf() {
+       local default_conf generated_conf
+
+       config_load tor
+       config_get default_conf conf default "/etc/tor/torrc"
+       config_get generated_conf conf generated "/tmp/torrc"
+       TORRC_GEN="$generated_conf"
+
+       {
+       echo "## This file was automatically generated please do not edit here !"
+       config_list_foreach "conf" head_include handle_conf_file
+       echo "%include $default_conf"
+       config_list_foreach "conf" tail_include handle_conf_file
+       } > "$TORRC_GEN"
+}
+
+reload_service() {
+       procd_send_signal /usr/sbin/tor
+}
+
+start_service() {
        mkdir -m 0700 -p /var/lib/tor
        chown -R tor:tor /var/lib/tor
 
        mkdir -m 0755 -p /var/log/tor
        chown -R tor:tor /var/log/tor
 
+       generate_conf
+
        procd_open_instance
        procd_set_param command /usr/sbin/tor --runasdaemon 0
+       procd_append_param command -f "$TORRC_GEN"
        procd_set_param respawn
        procd_close_instance
 }