From 3a6949dfaffda130a2945f714305bcafb8ac98fa Mon Sep 17 00:00:00 2001 From: Nick Hainke Date: Thu, 4 Feb 2021 16:34:02 +0100 Subject: wg-installer: add wg-installer This tool can be used to automatically create wireguard tunnels. Using rpcd a new wireguard interface is created on the server where the client can connect to. Wiregurad server automatically installs a user and associated ACL to use the wireguard-installer-server features. The user is called wginstaller and so is the password. Get Usage: wg-client-installer get_usage --ip 127.0.0.1 --user wginstaller --password wginstaller Register Interface: wg-client-installer register --ip 127.0.0.1 --user wginstaller --password wginstaller --bandwidth 10 --mtu 1400 Signed-off-by: Nick Hainke --- net/wg-installer/Makefile | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 net/wg-installer/Makefile (limited to 'net/wg-installer/Makefile') diff --git a/net/wg-installer/Makefile b/net/wg-installer/Makefile new file mode 100644 index 000000000..d43407b03 --- /dev/null +++ b/net/wg-installer/Makefile @@ -0,0 +1,69 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=wg-installer +PKG_RELEASE:=$(AUTORELEASE) + +PKG_MAINTAINER:=Nick Hainke + +include $(INCLUDE_DIR)/package.mk + +Build/Compile= + +define Package/wg-installer/Default + SECTION:=net + CATEGORY:=Network + TITLE:=WireGuard Installer + URL:=https://github.com/Freifunk-Spalter/ + PKGARCH:=all + DEPENDS:=+kmod-wireguard +owipcalc +endef + +define Package/wg-installer-server + $(call Package/wg-installer/Default) + TITLE+= (server) + DEPENDS:=+rpcd +uhttpd +uhttpd-mod-ubus +owipcalc +endef + +define Package/wg-installer-server/install + $(INSTALL_DIR) $(1)/usr/share/wginstaller/ + $(INSTALL_BIN) ./wg-server/lib/install_wginstaller_user.sh $(1)/usr/share/wginstaller/install_wginstaller_user.sh + $(INSTALL_BIN) ./wg-server/lib/wg_functions.sh $(1)/usr/share/wginstaller/wg_functions.sh + $(INSTALL_BIN) ./common/wg.sh $(1)/usr/share/wginstaller/wg.sh + + $(INSTALL_DIR) $(1)/usr/libexec/rpcd/ + $(INSTALL_BIN) ./wg-server/wginstaller.sh $(1)/usr/libexec/rpcd/wginstaller + + $(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d + $(CP) ./wg-server/config/wginstaller.json $(1)/usr/share/rpcd/acl.d/ + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./wg-server/config/wgserver.conf $(1)/etc/config/wgserver +endef + +define Package/wg-installer-server/postinst + #!/bin/sh + if [ -z $${IPKG_INSTROOT} ] ; then + . /usr/share/wginstaller/install_wginstaller_user.sh + fi +endef + +define Package/wg-installer-client + $(call Package/wg-installer/Default) + TITLE+= (client) + DEPENDS:=+curl +wireguard-tools +endef + +define Package/wg-installer-client/install + $(INSTALL_DIR) $(1)/usr/share/wginstaller/ + $(INSTALL_BIN) ./wg-client/lib/rpcd_ubus.sh $(1)/usr/share/wginstaller/rpcd_ubus.sh + $(INSTALL_BIN) ./common/wg.sh $(1)/usr/share/wginstaller/wg.sh + + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) ./wg-client/wg-client-installer.sh $(1)/usr/bin/wg-client-installer + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) ./wg-client/config/wgclient.conf $(1)/etc/config/wgclient +endef + +$(eval $(call BuildPackage,wg-installer-server)) +$(eval $(call BuildPackage,wg-installer-client)) -- cgit v1.2.3