Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions contrib/build-openwrt-global/wifidog/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#
# 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_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:=$(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 "init" script if procd $RELEASE
# Setting a default "init" file
INIT_SCRIPT_SUFFIX:=common
# Managing exceptions
ifeq ($(CONFIG_PACKAGE_procd),y)
INIT_SCRIPT_SUFFIX:=procd
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/wifidog.init.$(INIT_SCRIPT_SUFFIX) $(1)/etc/init.d/wifidog
endef

$(eval $(call BuildPackage,wifidog))
18 changes: 18 additions & 0 deletions contrib/build-openwrt-global/wifidog/files/wifidog.init.common
Original file line number Diff line number Diff line change
@@ -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
}
35 changes: 35 additions & 0 deletions contrib/build-openwrt-global/wifidog/files/wifidog.init.procd
Original file line number Diff line number Diff line change
@@ -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=65
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 -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/wdctl stop
}

status() {
/usr/bin/wdctl 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"
}

132 changes: 132 additions & 0 deletions contrib/build-openwrt-global/wifidog/files/wifidog.uci.config
Original file line number Diff line number Diff line change
@@ -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'