[pisa-src] r1746 - in trunk/openwrt: package/pisa/Makefile package/pisa/files/pisaautoconf.init router-configurations/auto-asus router-configurations/auto-asus/etc router-configurations/auto-asus/etc/banner r...

  • From: Jahn Bertsch <jahn.bertsch@xxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Mon, 23 Nov 2009 17:26:08 +0100

Author: bertsch
Date: Mon Nov 23 17:26:08 2009
New Revision: 1746

Log:
Initial version of a pisa-autonfiguration package.

On first boot of a router, a simple configuration file of the form

ROUTER_NAME=eros
ROUTER_NUMBER=111
ROUTER_WIFI_MAC=00:0F:A3:1A:11:91
ROUTER_CHANNEL=5

is read from a webserver (morpheus) and the router is configured accordingly.

This is not yet completly tested.

Added:
   trunk/openwrt/package/pisa/files/pisaautoconf.init   (contents, props 
changed)
   trunk/openwrt/router-configurations/auto-asus/
   trunk/openwrt/router-configurations/auto-asus/etc/
   trunk/openwrt/router-configurations/auto-asus/etc/banner   (contents, props 
changed)
   trunk/openwrt/router-configurations/auto-asus/etc/config/
   trunk/openwrt/router-configurations/auto-asus/etc/config/dhcp   (contents, 
props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/config/dropbear   
(contents, props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/config/firewall   
(contents, props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/config/httpd   (contents, 
props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/config/network
   trunk/openwrt/router-configurations/auto-asus/etc/config/ntpclient   
(contents, props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/config/system
   trunk/openwrt/router-configurations/auto-asus/etc/config/wireless
   trunk/openwrt/router-configurations/auto-asus/etc/dropbear/
   trunk/openwrt/router-configurations/auto-asus/etc/dropbear/authorized_keys   
(contents, props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/hip   (contents, props 
changed)
   trunk/openwrt/router-configurations/auto-asus/etc/hosts   (contents, props 
changed)
   trunk/openwrt/router-configurations/auto-asus/etc/opkg.conf   (contents, 
props changed)
   trunk/openwrt/router-configurations/auto-asus/etc/pisa   (contents, props 
changed)
Modified:
   trunk/openwrt/package/pisa/Makefile

Modified: trunk/openwrt/package/pisa/Makefile
==============================================================================
--- trunk/openwrt/package/pisa/Makefile Mon Nov 23 16:46:26 2009        (r1745)
+++ trunk/openwrt/package/pisa/Makefile Mon Nov 23 17:26:08 2009        (r1746)
@@ -25,7 +25,7 @@
 
 define Package/pisa
 $(call Package/pisa/Default)
-  DEPENDS:=+libconfig +libopenssl +pisa-mobile-guest +pisa-trust-point
+  DEPENDS:=+libconfig +libopenssl +pisa-mobile-guest +pisa-trust-point 
+pisa-autoconf
 endef
 
 CONFIGURE_VARS += \
@@ -125,6 +125,20 @@
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/pisasd $(1)/usr/sbin/
 endef
 
+define Package/pisa-autoconf
+$(call Package/pisa/Default)
+  TITLE:=PISA autoconf script
+endef
+
+define Package/pisa-autoconf/description
+ This package contains a script which automatically configures a router for 
use with pisa
+ on first boot. Configuration is read from a webserver.
+endef
+
+define Package/pisa-autoconf/install
+       $(INSTALL_BIN) ./files/pisa-autoconf.init $(1)/etc/init.pisa-autoconf
+endif
+
 $(eval $(call BuildPackage,pisa))
 $(eval $(call BuildPackage,libpisa))
 $(eval $(call BuildPackage,pisa-beacon))

Added: trunk/openwrt/package/pisa/files/pisaautoconf.init
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/package/pisa/files/pisaautoconf.init  Mon Nov 23 17:26:08 
2009        (r1746)
@@ -0,0 +1,67 @@
+#!/bin/sh /etc/rc.common
+#
+# PISA Autoconf
+# This script configures a router on first boot for use within the PISA
+# project.
+#
+# Configuration is read from webserver with an url of the form
+# http://HOSTNAME/autoconf/ROUTER-MAC."; For example
+# http://192.168.5.1/autoconf/00-0F-A3-1A-11-91";
+#
+#
+# Copyright (c) 2009, Distributed Systems Group, RWTH Aachen
+# All rights reserved.
+#
+# Relies on the '-i' GNU extension for sed.
+
+START=100
+STOP=100
+
+replace () {
+    sed -i "s/$2/$3/g" $1
+}
+
+start() {
+echo "PISA autoconf"
+
+### get mac ###
+MAC=$(ifconfig wlan0|grep HWaddr|awk '{print $5}')
+MAC=$(echo $MAC|sed -e 's/:/-/g')
+
+
+### get and read router configuratin file from webserver ###
+CONFIG_URL="http://192.168.5.1/autoconf/$MAC";
+
+echo "Getting configuration from $CONFIG_URL"
+wget $CONFIG_URL
+. $MAC
+rm $MAC
+
+echo "Configuring with"
+echo "ROUTER_NAME $ROUTER_NAME"
+echo "ROUTER_NUMBER $ROUTER_NUMBER"
+echo "ROUTER_WIFI_MAC $ROUTER_WIFI_MAC"
+echo "ROUTER_CHANNEL $ROUTER_CHANNEL"
+
+
+### do configuration ###
+echo "Configuring /etc/config/wireless"
+replace /etc/config/wireless "##ROUTER_NAME##"     $ROUTER_NAME
+replace /etc/config/wireless "##ROUTER_NUMBER##"   $ROUTER_NUMBER
+replace /etc/config/wireless "##ROUTER_WIFI_MAC##" $ROUTER_WIFI_MAC
+replace /etc/config/wireless "##ROUTER_CHANNEL##"  $ROUTER_CHANNEL
+
+echo "Configuring /etc/config/system"
+replace /etc/config/system pisa-autoconf pisa-$ROUTER_NAME
+
+echo "Configuring /etc/config/network"
+replace /etc/config/network 200 $ROUTER_NUMBER
+
+
+### self destruct ###
+rm $0
+}
+
+stop {
+
+}

Added: trunk/openwrt/router-configurations/auto-asus/etc/banner
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/banner    Mon Nov 23 
17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../files/etc/banner
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/dhcp
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/dhcp       Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../../files/etc/config/dhcp
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/dropbear
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/dropbear   Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../../files/etc/config/dropbear
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/firewall
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/firewall   Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../../files/etc/config/firewall
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/httpd
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/httpd      Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../../files/etc/config/httpd
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/network
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/network    Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1,32 @@
+#### VLAN configuration
+config switch eth0
+        option vlan0    "0 1 2 3 4 5u"
+
+
+#### Loopback configuration
+config interface loopback
+        option ifname   "lo"
+        option proto    static
+        option ipaddr   127.0.0.1
+        option netmask  255.0.0.0
+
+
+#### LAN configuration
+config interface lan
+        option type     bridge
+        option ifname   "eth0"
+        option proto    static
+        option ipaddr   192.168.6.200
+        option netmask  255.255.255.0
+
+
+#### WAN configuration
+config interface        wan
+        option ifname   "eth1"
+#        option proto    dhcp
+        option proto    static
+        option ipaddr   192.168.5.200
+        option netmask  255.255.255.0
+        option gateway  192.168.5.1
+        option dns      134.130.5.1
+        option dns      134.130.4.1

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/ntpclient
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/ntpclient  Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../../files/etc/config/ntpclient
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/system
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/system     Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1,5 @@
+config system
+        option hostname pisa-autoconf
+        #option timezone UTC
+        option zonename 'Europe/Berlin'
+        option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'

Added: trunk/openwrt/router-configurations/auto-asus/etc/config/wireless
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/config/wireless   Mon Nov 
23 17:26:08 2009        (r1746)
@@ -0,0 +1,12 @@
+config wifi-device  wlan0
+        option type     mac80211
+        option channel  ##ROUTER_CHANNEL##
+       option macaddr  ##ROUTER_WIFI_MAC##
+
+config wifi-iface
+        option device   wlan0
+        option network  lan
+        option mode     ap
+        option ssid     pisa-testbed-##ROUTER_NAME##
+        option encryption none
+       option disabled 1

Added: 
trunk/openwrt/router-configurations/auto-asus/etc/dropbear/authorized_keys
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/dropbear/authorized_keys  
Mon Nov 23 17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../../files/etc/dropbear/authorized_keys
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/hip
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/hip       Mon Nov 23 
17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../files/etc/hip/
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/hosts
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/hosts     Mon Nov 23 
17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../files/etc/hosts
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/opkg.conf
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/opkg.conf Mon Nov 23 
17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../files/etc/opkg.conf
\ No newline at end of file

Added: trunk/openwrt/router-configurations/auto-asus/etc/pisa
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/openwrt/router-configurations/auto-asus/etc/pisa      Mon Nov 23 
17:26:08 2009        (r1746)
@@ -0,0 +1 @@
+link ../../../files/etc/pisa/
\ No newline at end of file

Other related posts: