Przeglądaj źródła

dnscrypt-proxy: add package with config files, version 1.4.0

Damiano Renfer 10 lat temu
rodzic
commit
3fc82c470a

+ 121
- 0
net/dnscrypt-proxy/Makefile Wyświetl plik

@@ -0,0 +1,121 @@
1
+#
2
+# Copyright (C) 2009-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=dnscrypt-proxy
11
+PKG_VERSION:=1.4.0
12
+PKG_RELEASE:=1
13
+
14
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16
+PKG_SOURCE_URL:=http://download.dnscrypt.org/dnscrypt-proxy
17
+PKG_MD5SUM:=c31d14d8de2123e9f2ddf26216577841
18
+PKG_CAT:=zcat
19
+
20
+PKG_FIXUP:=autoreconf
21
+PKG_INSTALL:=1
22
+
23
+PKG_MAINTAINER:=Damiano Renfer <damiano.renfer@gmail.com>
24
+PKG_LICENSE:=ISC
25
+
26
+include $(INCLUDE_DIR)/package.mk
27
+
28
+define Package/dnscrypt-proxy/Default
29
+  SECTION:=net
30
+  CATEGORY:=Network
31
+  SUBMENU:=IP Addresses and Names
32
+  DEPENDS:=+libsodium
33
+  URL:=http://dnscrypt.org/
34
+  MAINTAINER:=Damiano Renfer <damiano.renfer@gmail.com>
35
+endef
36
+
37
+define Package/dnscrypt-proxy
38
+  $(call Package/dnscrypt-proxy/Default)
39
+  TITLE:=A tool for securing communications between a client and a DNS resolver
40
+endef
41
+
42
+define Package/dnscrypt-proxy/description
43
+  dnscrypt-proxy provides local service which can be used directly as your
44
+  local resolver or as a DNS forwarder, encrypting and authenticating requests
45
+  using the DNSCrypt protocol and passing them to an upstream server.
46
+  The DNSCrypt protocol uses high-speed high-security elliptic-curve cryptography
47
+  and is very similar to DNSCurve, but focuses on securing communications between
48
+  a client and its first-level resolver.
49
+endef
50
+
51
+define Package/hostip
52
+  $(call Package/dnscrypt-proxy/Default)
53
+  TITLE:=Resolver to IPv4 or IPv6 addresses
54
+endef
55
+
56
+define Package/hostip/description
57
+  The DNSCrypt proxy ships with a simple tool named hostip that resolves a name
58
+  to IPv4 or IPv6 addresses.
59
+endef
60
+
61
+define Build/Configure
62
+	$(call Build/Configure/Default, \
63
+	--prefix=/usr \
64
+	--disable-ssp \
65
+	)
66
+endef
67
+
68
+TARGET_CFLAGS += \
69
+	-fomit-frame-pointer \
70
+	-fdata-sections \
71
+	-ffunction-sections
72
+
73
+TARGET_LDFLAGS += \
74
+	-Wl,-gc-sections
75
+
76
+MAKE_FLAGS += \
77
+	CFLAGS="$(TARGET_CFLAGS)" \
78
+	LDFLAGS="$(TARGET_LDFLAGS)"
79
+
80
+define Package/dnscrypt-proxy/install
81
+	$(INSTALL_DIR) $(1)/usr/sbin
82
+	$(CP) $(PKG_INSTALL_DIR)/usr/sbin/dnscrypt-proxy $(1)/usr/sbin/
83
+	$(INSTALL_DIR) $(1)/usr/share/dnscrypt-proxy
84
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv $(1)/usr/share/dnscrypt-proxy/
85
+	$(INSTALL_DIR) $(1)/etc/init.d
86
+	$(INSTALL_BIN) ./files/dnscrypt-proxy.init $(1)/etc/init.d/dnscrypt-proxy
87
+	$(INSTALL_DIR) $(1)/etc/config
88
+	$(INSTALL_CONF) ./files/dnscrypt-proxy.config $(1)/etc/config/dnscrypt-proxy
89
+endef
90
+
91
+define Package/dnscrypt-proxy/postinst
92
+#!/bin/sh
93
+# check if we are on real system
94
+if [ -z "$${IPKG_INSTROOT}" ]; then
95
+        echo "Enabling rc.d symlink for dnscrypt-proxy"
96
+        /etc/init.d/dnscrypt-proxy enable
97
+fi
98
+exit 0
99
+endef
100
+
101
+define Package/dnscrypt-proxy/prerm
102
+#!/bin/sh
103
+# check if we are on real system
104
+if [ -z "$${IPKG_INSTROOT}" ]; then
105
+        echo "Removing rc.d symlink for dnscrypt-proxy"
106
+        /etc/init.d/dnscrypt-proxy disable
107
+fi
108
+exit 0
109
+endef
110
+
111
+define Package/dnscrypt-proxy/conffiles
112
+  /etc/config/dnscrypt-proxy
113
+endef
114
+
115
+define Package/hostip/install
116
+	$(INSTALL_DIR) $(1)/usr/bin
117
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/hostip $(1)/usr/bin/
118
+endef
119
+
120
+$(eval $(call BuildPackage,dnscrypt-proxy))
121
+$(eval $(call BuildPackage,hostip))

+ 5
- 0
net/dnscrypt-proxy/files/dnscrypt-proxy.config Wyświetl plik

@@ -0,0 +1,5 @@
1
+config dnscrypt-proxy
2
+	option address '127.0.0.1'
3
+	option port '5353'
4
+	# option resolver 'opendns'
5
+	# option resolvers_list '/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv'

+ 27
- 0
net/dnscrypt-proxy/files/dnscrypt-proxy.init Wyświetl plik

@@ -0,0 +1,27 @@
1
+#!/bin/sh /etc/rc.common
2
+
3
+START=50
4
+
5
+start_instance () {
6
+	local section="$1"
7
+	config_get address         "$section" 'address'
8
+	config_get port            "$section" 'port'
9
+	config_get resolver        "$section" 'resolver'
10
+	config_get resolvers_list  "$section" 'resolvers_list'
11
+
12
+	service_start /usr/sbin/dnscrypt-proxy -d \
13
+		-a ${address}:${port} \
14
+		-u nobody \
15
+		-L ${resolvers_list:-'/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv'} \
16
+		-R ${resolver:-'opendns'}
17
+}
18
+
19
+start() {
20
+	config_load 'dnscrypt-proxy'
21
+	config_foreach start_instance 'dnscrypt-proxy'
22
+}
23
+
24
+stop() {
25
+	service_stop /usr/sbin/dnscrypt-proxy
26
+}
27
+