From 915cf9cd5cd5f1a8dfee3c4bff0e7748684a07fd Mon Sep 17 00:00:00 2001 From: databeille Date: Tue, 17 Mar 2015 16:25:48 +0100 Subject: [PATCH 1/4] openwrt-portable-Makefile [reloaded] --- contrib/build-openwrt-global/wifidog/Makefile | 68 +++++++++++++++++++ .../files/Barrier_Breaker/wifidog.init | 35 ++++++++++ .../wifidog/files/common/wifidog.init | 18 +++++ 3 files changed, 121 insertions(+) create mode 100755 contrib/build-openwrt-global/wifidog/Makefile create mode 100644 contrib/build-openwrt-global/wifidog/files/Barrier_Breaker/wifidog.init create mode 100644 contrib/build-openwrt-global/wifidog/files/common/wifidog.init diff --git a/contrib/build-openwrt-global/wifidog/Makefile b/contrib/build-openwrt-global/wifidog/Makefile new file mode 100755 index 00000000..0c401660 --- /dev/null +++ b/contrib/build-openwrt-global/wifidog/Makefile @@ -0,0 +1,68 @@ +# +# Copyright (C) 2006,2013 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=wifidog +PKG_VERSION:=20130917 +PKG_RELEASE:=1.1.6 + + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) +PKG_SOURCE_VERSION:=master +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.gz + +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +### Adjust "files" directory to suit $RELEASE + # Setting a default "files" directory + OPENWRT_FILESDIR:=common + # Managing exceptions + ifeq ($(RELEASE),Barrier Breaker) + OPENWRT_FILESDIR:=Barrier_Breaker + endif + +define Package/wifidog + SUBMENU:=Captive Portals + SECTION:=net + CATEGORY:=Network + DEPENDS:=+iptables-mod-extra +iptables-mod-ipopt +iptables-mod-nat-extra +libpthread + TITLE:=A wireless captive portal solution + URL:=http://www.wifidog.org +endef + +define Package/wifidog/description + The Wifidog project is a complete and embeddable captive + portal solution for wireless community groups or individuals + who wish to open a free Hotspot while still preventing abuse + of their Internet connection. +endef + +define Package/wifidog/conffiles + /etc/wifidog.conf +endef + +define Package/wifidog/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/init.d/wifidog $(1)/usr/bin/wifidog-init + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wifidog $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wdctl $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttpd.so* $(1)/usr/lib/ + $(INSTALL_DIR) $(1)/etc/ + $(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog.conf $(1)/etc/ + $(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog-msg.html $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/build-openwrt-global/wifidog/files/$(OPENWRT_FILESDIR)/wifidog.init $(1)/etc/init.d/wifidog +endef + +$(eval $(call BuildPackage,wifidog)) diff --git a/contrib/build-openwrt-global/wifidog/files/Barrier_Breaker/wifidog.init b/contrib/build-openwrt-global/wifidog/files/Barrier_Breaker/wifidog.init new file mode 100644 index 00000000..e9738f64 --- /dev/null +++ b/contrib/build-openwrt-global/wifidog/files/Barrier_Breaker/wifidog.init @@ -0,0 +1,35 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +# Updated from post https://dev.openwrt.org/ticket/14761 + +USE_PROCD=1 + +START=99 +EXTRA_COMMANDS="status" +EXTRA_HELP=" status Print the status of the service" + +WIFIDOG_CONF=/etc/wifidog.conf + + +start_service() { + procd_open_instance + procd_set_param command /usr/bin/wifidog-init start + procd_set_param respawn # respawn automatically if something died, be careful if you have an alternative process supervisor + procd_set_param file $WIFIDOG_CONF + procd_close_instance +} + +stop_service() { + /usr/bin/wifidog-init stop +} + +status() { + /usr/bin/wifidog-init status +} + +service_triggers() { + ### Trigger, reload service on network change + procd_add_reload_interface_trigger "$(grep 'GatewayInterface' $WIFIDOG_CONF | grep -v ^# | awk '{print $2}')" + procd_add_reload_trigger "$WIFIDOG_CONF" +} + diff --git a/contrib/build-openwrt-global/wifidog/files/common/wifidog.init b/contrib/build-openwrt-global/wifidog/files/common/wifidog.init new file mode 100644 index 00000000..68d4eea6 --- /dev/null +++ b/contrib/build-openwrt-global/wifidog/files/common/wifidog.init @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org +START=65 +EXTRA_COMMANDS="status" +EXTRA_HELP=" status Print the status of the service" + + +start() { + /usr/bin/wifidog-init start +} + +stop() { + /usr/bin/wifidog-init stop +} + +status() { + /usr/bin/wifidog-init status +} \ No newline at end of file From b153a22c7a7102e957fbd3356d07c365c4b13ff5 Mon Sep 17 00:00:00 2001 From: databeille Date: Wed, 18 Mar 2015 16:47:33 +0100 Subject: [PATCH 2/4] openwrt Makefile handles procd --- contrib/build-openwrt-global/wifidog/Makefile | 19 ++++++++++--------- .../wifidog.init => wifidog.init.common} | 0 .../wifidog.init => wifidog.init.procd} | 0 3 files changed, 10 insertions(+), 9 deletions(-) rename contrib/build-openwrt-global/wifidog/files/{common/wifidog.init => wifidog.init.common} (100%) rename contrib/build-openwrt-global/wifidog/files/{Barrier_Breaker/wifidog.init => wifidog.init.procd} (100%) diff --git a/contrib/build-openwrt-global/wifidog/Makefile b/contrib/build-openwrt-global/wifidog/Makefile index 0c401660..344b36e8 100755 --- a/contrib/build-openwrt-global/wifidog/Makefile +++ b/contrib/build-openwrt-global/wifidog/Makefile @@ -10,25 +10,26 @@ include $(TOPDIR)/rules.mk PKG_NAME:=wifidog PKG_VERSION:=20130917 PKG_RELEASE:=1.1.6 - - +PKG_REV:=master PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git + PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) -PKG_SOURCE_VERSION:=master +PKG_SOURCE_VERSION:=$(PKG_REV) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.gz +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE) PKG_FIXUP:=autoreconf PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk -### Adjust "files" directory to suit $RELEASE - # Setting a default "files" directory - OPENWRT_FILESDIR:=common +### Adjust "init" script if procd $RELEASE + # Setting a default "init" file + INIT_SCRIPT_SUFFIX:=common # Managing exceptions - ifeq ($(RELEASE),Barrier Breaker) - OPENWRT_FILESDIR:=Barrier_Breaker + ifeq ($(CONFIG_PACKAGE_procd),y) + INIT_SCRIPT_SUFFIX:=procd endif define Package/wifidog @@ -62,7 +63,7 @@ define Package/wifidog/install $(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog.conf $(1)/etc/ $(INSTALL_CONF) $(PKG_BUILD_DIR)/wifidog-msg.html $(1)/etc/ $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/build-openwrt-global/wifidog/files/$(OPENWRT_FILESDIR)/wifidog.init $(1)/etc/init.d/wifidog + $(INSTALL_BIN) $(PKG_BUILD_DIR)/contrib/build-openwrt-global/wifidog/files/wifidog.init.$(INIT_SCRIPT_SUFFIX) $(1)/etc/init.d/wifidog endef $(eval $(call BuildPackage,wifidog)) diff --git a/contrib/build-openwrt-global/wifidog/files/common/wifidog.init b/contrib/build-openwrt-global/wifidog/files/wifidog.init.common similarity index 100% rename from contrib/build-openwrt-global/wifidog/files/common/wifidog.init rename to contrib/build-openwrt-global/wifidog/files/wifidog.init.common diff --git a/contrib/build-openwrt-global/wifidog/files/Barrier_Breaker/wifidog.init b/contrib/build-openwrt-global/wifidog/files/wifidog.init.procd similarity index 100% rename from contrib/build-openwrt-global/wifidog/files/Barrier_Breaker/wifidog.init rename to contrib/build-openwrt-global/wifidog/files/wifidog.init.procd From eaeeb0e9e2d7b00f34a4608949bbcdad54a7128d Mon Sep 17 00:00:00 2001 From: databeille Date: Wed, 18 Mar 2015 19:55:27 +0100 Subject: [PATCH 3/4] Removing references to wifidog-init in /etc/init.d/wifidog --- .../build-openwrt-global/wifidog/files/wifidog.init.procd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/build-openwrt-global/wifidog/files/wifidog.init.procd b/contrib/build-openwrt-global/wifidog/files/wifidog.init.procd index e9738f64..261e9752 100644 --- a/contrib/build-openwrt-global/wifidog/files/wifidog.init.procd +++ b/contrib/build-openwrt-global/wifidog/files/wifidog.init.procd @@ -4,7 +4,7 @@ USE_PROCD=1 -START=99 +START=65 EXTRA_COMMANDS="status" EXTRA_HELP=" status Print the status of the service" @@ -13,18 +13,18 @@ WIFIDOG_CONF=/etc/wifidog.conf start_service() { procd_open_instance - procd_set_param command /usr/bin/wifidog-init start + procd_set_param command /usr/bin/wifidog -f procd_set_param respawn # respawn automatically if something died, be careful if you have an alternative process supervisor procd_set_param file $WIFIDOG_CONF procd_close_instance } stop_service() { - /usr/bin/wifidog-init stop + /usr/bin/wdctl stop } status() { - /usr/bin/wifidog-init status + /usr/bin/wdctl status } service_triggers() { From a75c06a3edaffaac102f04bd6a6f0f19d93b8bfb Mon Sep 17 00:00:00 2001 From: databeille Date: Thu, 26 Mar 2015 16:46:12 +0100 Subject: [PATCH 4/4] UCI example file for wifidog --- .../wifidog/files/wifidog.uci.config | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 contrib/build-openwrt-global/wifidog/files/wifidog.uci.config diff --git a/contrib/build-openwrt-global/wifidog/files/wifidog.uci.config b/contrib/build-openwrt-global/wifidog/files/wifidog.uci.config new file mode 100644 index 00000000..9dd0571a --- /dev/null +++ b/contrib/build-openwrt-global/wifidog/files/wifidog.uci.config @@ -0,0 +1,132 @@ +config local + option GatewayID '' + option ExternalInterface 'eth0' + option GatewayInterface 'br-lan' + option GatewayAddress '192.168.1.1' + option HtmlMessageFile '/etc/wifidog-msg.html' + option Daemon '1' + option GatewayPort '2060' + option ProxyPort '0' + option HTTPDName 'WiFiDog' + option HTTPDMaxConn '20' + option HTTPDRealm 'WiFiDog' + option HTTPDUserName '' + option HTTPDPassword '' + option CheckInterval '90' + option ClientTimeout '4' + option TrustedMACList '' + +config authserver + option Hostname 'auth.ilesansfil.org' + option SSLAvailable 'yes' + option SSLPort '443' + option Path '/' +config authserver + option Hostname 'auth2.ilesansfil.org' + option SSLAvailable 'yes' + option SSLPort '443' + option Path '/' + +config FWRS_global + option proto '' + option src '' + option src_port '' + option dest '192.168.0.0/16' + option dest_port '' + option action 'block' + +config FWRS_global + option proto '' + option src '' + option src_port '' + option dest '172.16.0.0/12' + option dest_port '' + option action 'block' + +config FWRS_global + option proto '' + option src '' + option src_port '' + option dest '10.0.0.0/8' + option dest_port '' + option action 'block' + +config FWRS_global + option proto '' + option src '' + option src_port '' + option dest '0.0.0.0/0' + option dest_port '' + option action 'log' + +config FWRS_validating-users + option proto '' + option src '' + option src_port '' + option dest '0.0.0.0/0' + option dest_port '' + option action 'allow' + +config FWRS_known-users + option proto '' + option src '' + option src_port '' + option dest '0.0.0.0/0' + option dest_port '' + option action 'allow' + +config FWRS_unknown-users + option proto 'udp' + option src '' + option src_port '' + option dest '' + option dest_port '53' + option action 'allow' + +config FWRS_unknown-users + option proto 'tcp' + option src '' + option src_port '' + option dest '' + option dest_port '53' + option action 'allow' + +config FWRS_unknown-users + option proto 'udp' + option src '' + option src_port '' + option dest '' + option dest_port '67' + option action 'allow' + +config FWRS_unknown-users + option proto 'tcp' + option src '' + option src_port '' + option dest '' + option dest_port '67' + option action 'allow' + +config FWRS_unknown-users + option proto 'udp' + option src '' + option src_port '' + option dest '' + option dest_port '22' + option action 'drop' + +config FWRS_unknown-users + option proto 'tcp' + option src '' + option src_port '' + option dest '' + option dest_port '22' + option action 'drop' + +config FWRS_locked-users + option proto '' + option src '' + option src_port '' + option dest '0.0.0.0/0' + option dest_port '' + option target 'block'