Updated tor to 0.4.0.5 and added torsocks
authorRISCi_ATOM <bob@bobcall.me>
Mon, 22 Jul 2019 17:04:01 +0000 (13:04 -0400)
committerRISCi_ATOM <bob@bobcall.me>
Mon, 22 Jul 2019 17:04:01 +0000 (13:04 -0400)
package/network/services/tor/Makefile
package/network/services/tor/files/tor.init
package/network/services/tor/patches/001-torrc.patch
package/network/services/torsocks/Makefile [new file with mode: 0644]

index 4afdd0d2e5faf97c5f08aace149219c79bec0398..752dd66111d76b6c2d60785d8b3f5473c9e8e095 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008-2016 OpenWrt.org
+# Copyright (C) 2008-2019 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,18 +8,21 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=tor
-PKG_VERSION:=0.3.4.8
+PKG_VERSION:=0.4.0.5
 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:=826a4cb2c099a29c7cf91516ffffcfcb5aace7533b8853a8c8bddcfe2bfb1023
+PKG_HASH:=b5a2cbf0dcd3f1df2675dbd5ec10bbe6f8ae995c41b68cebe2bc95bffc90696e
 PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de> \
                Peter Wagner <tripolar@gmx.at>
 PKG_LICENSE_FILES:=LICENSE
+PKG_CPE_ID:=cpe:/a:torproject:tor
 
 PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+PKG_BUILD_PARALLEL:=1
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -68,7 +71,7 @@ endef
 
 define Package/tor-resolve/description
 $(call Package/tor/Default/description)
- Resolve a hostname to an IP address via tor 
+ Resolve a hostname to an IP address via tor
 endef
 
 define Package/tor-geoip
@@ -90,25 +93,25 @@ endef
 
 CONFIGURE_ARGS += \
        --with-libevent-dir="$(STAGING_DIR)/usr" \
-       --with-ssl-dir="$(STAGING_DIR)/usr" \
        --with-openssl-dir="$(STAGING_DIR)/usr" \
        --with-zlib-dir="$(STAGING_DIR)/usr" \
        --disable-asciidoc \
        --disable-seccomp \
        --disable-libscrypt \
        --disable-unittests \
-       --disable-largefile \
        --disable-lzma \
+       --disable-zstd \
        --with-tor-user=tor \
        --with-tor-group=tor
 
-EXTRA_CFLAGS += -std=gnu99
+TARGET_CFLAGS += -ffunction-sections -fdata-sections -flto
+TARGET_LDFLAGS += -Wl,--gc-sections -flto
 
 ifneq ($(CONFIG_SSP_SUPPORT),y)
        CONFIGURE_ARGS += \
                --disable-gcc-hardening
 else
-       EXTRA_CFLAGS += -fPIC
+       EXTRA_CFLAGS += $(FPIC)
 endif
 
 CONFIGURE_VARS += \
@@ -117,7 +120,6 @@ CONFIGURE_VARS += \
 define Package/tor/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
-       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/torify $(1)/usr/sbin/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
        $(INSTALL_DIR) $(1)/etc/tor
@@ -136,8 +138,10 @@ endef
 
 define Package/tor-geoip/install
        $(INSTALL_DIR) $(1)/usr/share/tor
-       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
-       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 $(1)/usr/share/tor/
+       $(INSTALL_DATA) \
+         $(PKG_INSTALL_DIR)/usr/share/tor/geoip \
+         $(PKG_INSTALL_DIR)/usr/share/tor/geoip6 \
+       $(1)/usr/share/tor/
 endef
 
 $(eval $(call BuildPackage,tor))
index 6974057d45d83e6901502fb5ec9e064b96a86501..ee0818d9d13afce182f8290b6aeb690d1164ed10 100644 (file)
@@ -7,19 +7,15 @@ STOP=50
 USE_PROCD=1
 
 start_service() {
-       [ -f /var/run/tor.pid ] || {
-               touch /var/run/tor.pid
-               chown tor:tor /var/run/tor.pid
-       }
-       [ -d /var/lib/tor ] || {
-               mkdir -m 0755 -p /var/lib/tor
-               chmod 0700 /var/lib/tor
-               chown tor:tor /var/lib/tor
-       }
-       [ -d /var/log/tor ] || {
-               mkdir -m 0755 -p /var/log/tor
-               chown tor:tor /var/log/tor
-       }
+       touch /var/run/tor.pid
+       chown tor:tor /var/run/tor.pid
+
+       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
+
        procd_open_instance
        procd_set_param command /usr/sbin/tor --runasdaemon 0
        procd_close_instance
index 2aed4b02d12978bf934333a623d79c4dd295b849..16cae0402fbbf8712b03dceb1b586a42c4fe2f76 100644 (file)
@@ -18,7 +18,7 @@
  
  ## The port on which Tor will listen for local connections from Tor
  ## controller applications, as documented in control-spec.txt.
-@@ -233,3 +233,4 @@
+@@ -238,3 +238,4 @@
  #%include /etc/torrc.d/
  #%include /etc/torrc.custom
  
diff --git a/package/network/services/torsocks/Makefile b/package/network/services/torsocks/Makefile
new file mode 100644 (file)
index 0000000..7cd1323
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2017-2019 CZ.NIC, z. s. p. o. (https://www.nic.cz/)
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=torsocks
+PKG_VERSION:=2.3.0
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=https://people.torproject.org/~dgoulet/torsocks/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_HASH:=b9f1b981d6b3fd4e1820de1eee325f8a7038c84765d5a6cd9af12571d5cc3622
+
+PKG_MAINTAINER:=Jan Pavlinec <jan.pavlinec@nic.cz>
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/torsocks
+       SECTION:=net
+       CATEGORY:=Network
+       SUBMENU:=IP Addresses and Names
+       TITLE:=torsocks
+       URL:=https://trac.torproject.org/projects/tor/wiki/doc/torsocks
+       DEPENDS:=+tor
+endef
+
+define Package/torsocks/description
+ Torsocks allows you to use most applications in a safe way with Tor.
+ It ensures that DNS requests are handled safely and explicitly rejects any traffic other than TCP from the application you're using.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default)
+ifeq ($(CONFIG_USE_UCLIBC),y)
+       find $(PKG_BUILD_DIR) -name 'Makefile' -exec sed -i 's|--param ssp-buffer-size=1 -fstack-protector-all||' \{\} \+
+endif
+endef
+
+define Package/conffiles
+/etc/tor/torsocks.conf
+endef
+
+define Package/torsocks/install
+       $(INSTALL_DIR) $(1)/etc/tor/
+       $(CP) $(PKG_INSTALL_DIR)/etc/tor/torsocks.conf $(1)/etc/tor/
+       $(INSTALL_DIR) $(1)/usr/lib/torsocks
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/torsocks/libtorsocks.so* $(1)/usr/lib/torsocks/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/torsocks $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,torsocks))