[RFC PATCH v3 5/8] Added VPN Connectivity to previous added Hood-Management

mayosemmel mayosemmel at googlemail.com
Mo Jun 13 20:26:46 CEST 2016


Hi
Am Sonntag, den 12.06.2016, 22:53 +0200 schrieb Tim Niemeyer:
> Hi
> 
> Von der Struktur her gefällt es mir noch nicht so. Ich fänd es besser,
> wenn es irgendwie geht, dass ein vpn-select package die Daten vom
> keyXchnage auswertet und dann entsprechen fastd oder tunneldigger via
> Openwrt Methoden konfiguriert und startet (oder stoppt).
> 
> Damit wir aber hier vorwärst kommen: Lass halt erstmal so. Spätestens
> wenn wir dann endlich tunneldigger rein bringen kann man das
> überarbeiten. Aktuell muss das Grundlegende Zeugs erstmal laufen.
Darüber hatten wir im Lab ja damals schonmal kurz geredet und waren uns
einig, das es schöner wäre.
Ich hab hier ehrlich gesagt ein bisschen auf die Hassberger gehofft, mit
dem Tunneldigger ist das ja quasi schon fertig.

Könnte ja grundsätzlich auch jetzt schon in den Master und kann auch
nach dem dezKeyExchange noch kommen.
> 
> Unten noch paar Kleinigkeiten.
> 
> Am Sonntag, den 12.06.2016, 14:17 +0200 schrieb Jan Kraus:
> > Signed-off-by: Jan Kraus <mayosemmel at gmail.com>
> > ---
> >  bsp/default/root_file_system/etc/rc.local          |  1 +
> >  .../fff/fff-fastd/files/usr/sbin/fastdstart        | 36 +++++++++++++++++-----
> >  src/packages/fff/fff-hoods/Makefile                |  2 +-
> >  .../fff/fff-hoods/files/usr/sbin/configurehood     |  5 +--
> >  4 files changed, 33 insertions(+), 11 deletions(-)
> > 
> > diff --git a/bsp/default/root_file_system/etc/rc.local b/bsp/default/root_file_system/etc/rc.local
> > index c980d8e..171883d 100755
> > --- a/bsp/default/root_file_system/etc/rc.local
> > +++ b/bsp/default/root_file_system/etc/rc.local
> > @@ -4,6 +4,7 @@
> >  
> >  /usr/sbin/configurehood
> >  /usr/sbin/configurenetwork
> > +/usr/sbin/fastdstart
> >  
> >  touch /tmp/started
> >  
> > diff --git a/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart b/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> > index 611a3f8..8e494ff 100755
> > --- a/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> > +++ b/src/packages/fff/fff-fastd/files/usr/sbin/fastdstart
> > @@ -4,6 +4,7 @@ SERVER="no"
> >  #SERVERNAME="--servername--"
> >  
> >  . /etc/community.cfg
> > +. /usr/share/libubox/jshn.sh
> >  
> >  project="$VPN_PROJECT"
> >  
> > @@ -77,14 +78,33 @@ if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
> >  		fastd -c /etc/fastd/$project/$project.conf -d --pid-file /var/run/fastd.$project.pid
> >  	fi
> >  
> > -#	register
> > -	wget -T15 "http://keyserver.freifunk-franken.de/${project}/geo.php?mac=$mac&name=$hostname&port=$port&key=$pubkey&lat=$lat&long=$long" -O /tmp/fastd_${project}_output
> Ahh.. Endlich.. :-)
> 
> > -	filenames=$(awk '/^####/ { gsub(/^####/, "", $0); gsub(/.conf/, "", $0); print $0; }' /tmp/fastd_${project}_output)
> > -	for file in $filenames; do
> > -		awk "{ if(a) print }; /^####$file.conf$/{a=1}; /^$/{a=0};" /tmp/fastd_${project}_output | sed 's/ float;/;/g' > /etc/fastd/$project/peers/$file
> > -		echo 'float yes;' >> /etc/fastd/$project/peers/$file
> > -	done
> > +#   configure
> > +    rm -f /etc/fastd/$project/peers/*
> > +    hood="$(uci get system. at system[0].hood)"
> > +    json_load "$(cat /etc/hoods/$hood.hood)"
> > +    json_select vpn
> > +    local Index="1"
> > +    while json_select $Index > /dev/null
> > +    do
> > +        json_get_var protocol protocol
> > +        if [ "$protocol" == "fastd" ]
> > +        then
> > +            json_get_var servername name
> > +            echo "#name \"$servername\";" > /etc/fastd/$project/peers/$servername
> > +            json_get_var key key
> > +            echo "key \"$key\";" >> /etc/fastd/$project/peers/$servername
> > +            json_get_var address address
> > +            json_get_var port port
> > +            echo "remote ipv4 \"$address\" port $port;" >> /etc/fastd/$project/peers/$servername
> Das ist nicht immer ipv4. Das ist aktuell ein Problem beim zentralen
> KeyXchange, sollten wir hier besser machen.
Werd ich mir mal anschauen. Eigentlich müsste man ja nur prüfen ob es
eine valide v4 bzw. v6 ist und dann passend eintragen...
> 
> > +            echo "float yes;" >> /etc/fastd/$project/peers/$servername
> > +        else
> > +            echo "protocol $protocol is not supported by this script"
> > +            json_select ".."
> > +            continue
> > +        fi
> > +        json_select ".."
> > +        Index=$((Index+1))
> > +    done
> >  
> >  	#reload
> >  	kill -HUP $(cat /var/run/fastd.$project.pid)
> > diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile
> > index ac48760..b182485 100644
> > --- a/src/packages/fff/fff-hoods/Makefile
> > +++ b/src/packages/fff/fff-hoods/Makefile
> > @@ -13,7 +13,7 @@ define Package/fff-hoods
> >      CATEGORY:=Freifunk
> >      TITLE:= Freifunk-Franken hoods
> >      URL:=http://www.freifunk-franken.de
> > -    DEPENDS:=+mdns +fff-network
> > +    DEPENDS:=+mdns +fff-network +fff-fastd
> Anders rum, oder? fff-fastd hängt dank diesem Patch von dem keyXchange
> (also fff-hoods) ab.
Stimmt...
> 
> >  endef
> >  
> >  define Package/fff-hoods/description
> > diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > index f401a94..ae69a3b 100755
> > --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> > @@ -86,9 +86,10 @@ echo "Setting channel 2.4 Ghz: $channel2"
> >  echo "Setting mode 2.4 GHz: $mode2"
> >  echo "Setting mesh 2.4 GHz type: $type2"
> >  
> > -echo "Shutting down wifi"
> > -wifi down
> > +#echo "Shutting down wifi"
> > +#wifi down
> Vermutlich ist das im nächsten Patch eh obsolete, also hier raus
> nehmen..
erledigt
> 
> >  
> > +uci set system. at system[0].hood=$hood
> Das sollte gleich am Anfang bereits mit in die configurehood Datei, also
> schon in Patch 1.
> Dabei fällt mir auf. Nach dem Flashen wird die Hood also bekannt sein.
> Die Trusted Hoods sind aber vermutlich gelöscht.. Ungut.. Vorschlag:
> Trusted Hoods mit ins Update-Überleben-Script.
Stimmt

Grüße Jan
> 
> Tim
> 
> >  uci set wireless.radio0=wifi-device
> >  uci set wireless.radio0.type=mac80211
> >  uci set wireless.radio0.channel=$channel2
> > -- 
> > 2.1.4
> > 
> 

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 473 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20160613/eea5ba25/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev