mirror of
https://github.com/openwrt/packages.git
synced 2026-02-04 12:06:29 +08:00
coredns: replace wgsd-coredns to full 1.13.2
- Add coredns package 1.13.2 - Make wgsd-coredns package transitional to coredns with wgsd plugin enabled - Make coredns plugin list configurable, disable heavy plugins by default and add wgsd plugin - Place the service into ujail - Add netbox plugin Co-authored-by: Tianling Shen <cnsztl@gmail.com> Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
This commit is contained in:
committed by
George Sapkin
parent
6b370bd511
commit
3554c264f5
79
net/coredns/Config.in
Normal file
79
net/coredns/Config.in
Normal file
@@ -0,0 +1,79 @@
|
||||
if PACKAGE_coredns
|
||||
|
||||
config COREDNS_PLUGIN_GEOIP
|
||||
bool "GeoIP plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_TLS
|
||||
bool "TLS plugin"
|
||||
default y
|
||||
|
||||
config COREDNS_PLUGIN_QUIC
|
||||
bool "QUIC plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_ROUTE53
|
||||
bool "Route53 plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_AZURE
|
||||
bool "Azure plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_CLOUDDNS
|
||||
bool "CloudDNS plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_K8S_EXTERNAL
|
||||
bool "k8s_external plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_KUBERNETES
|
||||
bool "Kubernetes plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_ETCD
|
||||
bool "Etcd plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_GRPC
|
||||
bool "gRPC plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_ON
|
||||
bool "On event plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_NOMAD
|
||||
bool "Nomad plugin"
|
||||
default n
|
||||
|
||||
config COREDNS_PLUGIN_WGSD
|
||||
bool "WireGuard Service Discovery plugin"
|
||||
default y if PACKAGE_wgsd-coredns
|
||||
select COREDNS_REQUIRE_GO_GET
|
||||
help
|
||||
wgsd is a CoreDNS plugin that serves WireGuard peer information via DNS-SD (RFC6763) semantics.
|
||||
This enables use cases such as:
|
||||
|
||||
- Building a mesh of WireGuard peers from a central registry
|
||||
- Dynamic discovery of WireGuard Endpoint addressing (both IP address and port number)
|
||||
- NAT-to-NAT WireGuard connectivity where UDP hole punching is supported.
|
||||
|
||||
config COREDNS_PLUGIN_NETBOX
|
||||
bool "Netbox plugin"
|
||||
default n
|
||||
select COREDNS_REQUIRE_GO_GET
|
||||
|
||||
config COREDNS_PLUGIN_FANOUT
|
||||
bool "Fanout plugin"
|
||||
default n
|
||||
select COREDNS_REQUIRE_GO_GET
|
||||
|
||||
config COREDNS_REQUIRE_GO_GET
|
||||
bool
|
||||
default n
|
||||
help
|
||||
Custom plugins require `go get ./...` to pull dependencies.
|
||||
|
||||
endif
|
||||
110
net/coredns/Makefile
Normal file
110
net/coredns/Makefile
Normal file
@@ -0,0 +1,110 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=coredns
|
||||
PKG_VERSION:=1.13.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/coredns/coredns.git
|
||||
PKG_MIRROR_HASH:=096918cf04ed344d7c8e8763d82d01684a5cb647566a21608d0b034de565eec6
|
||||
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
PKG_MAINTAINER:=Vladimir Ermakov <vooon341@gmail.com>
|
||||
|
||||
PKG_BUILD_DEPENDS:=golang/host
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
|
||||
GO_PKG:=github.com/coredns/coredns
|
||||
GO_PKG_EXCLUDES:=test
|
||||
GO_PKG_LDFLAGS_X:= \
|
||||
github.com/coredns/coredns/coremain.GitCommit=v$(PKG_VERSION) \
|
||||
github.com/coredns/coredns/coremain.gitTag=v$(PKG_VERSION)
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../../lang/golang/golang-package.mk
|
||||
|
||||
define Package/coredns
|
||||
SECTION:=net
|
||||
CATEGORY:=Network
|
||||
SUBMENU:=IP Addresses and Names
|
||||
TITLE:=CoreDNS
|
||||
URL:=https://coredns.io
|
||||
DEPENDS:=$(GO_ARCH_DEPENDS) +COREDNS_PLUGIN_WGSD:kmod-wireguard
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/coredns/description
|
||||
CoreDNS is a fast and flexible DNS server.
|
||||
The key word here is flexible: with CoreDNS you are able to do what you want
|
||||
with your DNS data by utilizing plugins.
|
||||
endef
|
||||
|
||||
define Package/coredns/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
define Package/coredns/conffiles
|
||||
/etc/config/coredns
|
||||
/etc/Corefile
|
||||
/etc/coredns/
|
||||
endef
|
||||
|
||||
define configure-plugin
|
||||
$(SED) '/^$(2):/d' "$(PKG_BUILD_DIR)/plugin.cfg"
|
||||
ifeq ($(1),y)
|
||||
echo "$(2):$(3)" >> "$(PKG_BUILD_DIR)/plugin.cfg"
|
||||
endif
|
||||
endef
|
||||
|
||||
define Build/Configure
|
||||
$(call GoPackage/Build/Configure,$(1))
|
||||
|
||||
# NOTE: allow to disable unneded heavy plugin
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_GEOIP),geoip,geoip)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_TLS),tls,tls)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_QUIC),quic,quic)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_ROUTE53),route53,route53)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_AZURE),azure,azure)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_CLOUDDNS),clouddns,clouddns)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_K8S_EXTERNAL),k8s_external,k8s_external)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_KUBERNETES),kubernetes,kubernetes)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_ETCD),etcd,etcd)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_GRPC),grpc,grpc)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_ON),on,github.com/coredns/caddy/onevent)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_NOMAD),nomad,nomad)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_WGSD),wgsd,github.com/jwhited/wgsd)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_NETBOX),netbox,github.com/oz123/coredns-netbox-plugin)
|
||||
$(call configure-plugin,$(CONFIG_COREDNS_PLUGIN_FANOUT),fanout,github.com/networkservicemesh/fanout)
|
||||
|
||||
cd $(PKG_BUILD_DIR); \
|
||||
$(GO_GENERAL_BUILD_CONFIG_VARS) \
|
||||
$(GO_PKG_BUILD_CONFIG_VARS) \
|
||||
go generate coredns.go
|
||||
|
||||
# NOTE: custom plugins needs go get to pull new dependencies
|
||||
ifeq ($(CONFIG_COREDNS_REQUIRE_GO_GET),y)
|
||||
cd $(PKG_BUILD_DIR); \
|
||||
$(GO_GENERAL_BUILD_CONFIG_VARS) \
|
||||
$(GO_PKG_BUILD_CONFIG_VARS) \
|
||||
go get ./...
|
||||
endif
|
||||
|
||||
endef
|
||||
|
||||
define Package/coredns/install
|
||||
$(call GoPackage/Package/Install/Bin,$(1))
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/
|
||||
$(INSTALL_CONF) $(CURDIR)/files/Corefile $(1)/etc/Corefile
|
||||
$(INSTALL_DIR) $(1)/etc/config/
|
||||
$(INSTALL_CONF) $(CURDIR)/files/coredns.conf $(1)/etc/config/coredns
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(CURDIR)/files/coredns.init $(1)/etc/init.d/coredns
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/coredns/zones/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,coredns))
|
||||
5
net/coredns/files/Corefile
Normal file
5
net/coredns/files/Corefile
Normal file
@@ -0,0 +1,5 @@
|
||||
.:5353 {
|
||||
log
|
||||
#whoami
|
||||
#wgsd coredns.lan. vpn_wg
|
||||
}
|
||||
3
net/coredns/files/coredns.conf
Normal file
3
net/coredns/files/coredns.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
config daemon 'daemon'
|
||||
option config /etc/Corefile
|
||||
list ro_mount /etc/coredns/zones
|
||||
29
net/coredns/files/coredns.init
Normal file
29
net/coredns/files/coredns.init
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/bin/coredns
|
||||
CONF=coredns
|
||||
|
||||
start_service() {
|
||||
local corefile
|
||||
|
||||
config_load "$CONF"
|
||||
config_get corefile daemon config /etc/Corefile
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_add_jail coredns log procfs sysfs
|
||||
procd_add_jail_mount /etc/TZ
|
||||
procd_add_jail_mount /etc/ssl/certs
|
||||
procd_add_jail_mount "$corefile"
|
||||
config_list_foreach daemon ro_mount procd_add_jail_mount
|
||||
|
||||
procd_set_param command "$PROG" -conf "$corefile"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wgsd
|
||||
PKG_VERSION:=0.3.6
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/jwhited/wgsd/tar.gz/v$(PKG_VERSION)?
|
||||
@@ -17,7 +17,7 @@ PKG_BUILD_PARALLEL:=1
|
||||
PKG_BUILD_FLAGS:=no-mips16
|
||||
|
||||
GO_PKG:=github.com/jwhited/wgsd
|
||||
GO_PKG_EXCLUDES:=test
|
||||
GO_PKG_EXCLUDES:=cmd/coredns
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include ../../lang/golang/golang-package.mk
|
||||
@@ -34,6 +34,7 @@ endef
|
||||
define Package/wgsd-coredns
|
||||
$(call Package/wgsd/Default)
|
||||
TITLE+= DNS-SD server
|
||||
DEPENDS:=+coredns +@COREDNS_PLUGIN_WGSD
|
||||
endef
|
||||
|
||||
define Package/wgsd-client
|
||||
@@ -53,7 +54,7 @@ endef
|
||||
define Package/wgsd-coredns/description
|
||||
$(call Package/wgsd/Default/description)
|
||||
|
||||
CoreDNS binary.
|
||||
Transitional package to CoreDNS with wgsd plugin enabled.
|
||||
endef
|
||||
|
||||
define Package/wgsd-client/description
|
||||
@@ -62,21 +63,6 @@ define Package/wgsd-client/description
|
||||
Client binary.
|
||||
endef
|
||||
|
||||
define Package/wgsd-coredns/conffiles
|
||||
/etc/Corefile
|
||||
endef
|
||||
|
||||
define Package/wgsd-coredns/install
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/coredns $(1)/usr/bin/wgsd-coredns
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/
|
||||
$(INSTALL_CONF) $(CURDIR)/files/Corefile $(1)/etc/Corefile
|
||||
$(INSTALL_DIR) $(1)/etc/init.d/
|
||||
$(INSTALL_BIN) $(CURDIR)/files/wgsd-coredns.init $(1)/etc/init.d/wgsd-coredns
|
||||
endef
|
||||
|
||||
define Package/wgsd-client/install
|
||||
$(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
.:5353 {
|
||||
log
|
||||
#whoami
|
||||
wgsd coredns.lan. vpn_wg
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
|
||||
USE_PROCD=1
|
||||
PROG=/usr/bin/wgsd-coredns
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG" -conf /etc/Corefile
|
||||
procd_close_instance
|
||||
}
|
||||
Reference in New Issue
Block a user