consistently use same webserver port for hoodfile on wifi and lan

Submitted by Fabian Blaese on Oct. 19, 2017, 8:19 a.m.

Details

Message ID 20171019081918.20600-1-fabian@blaese.de
State Superseded
Headers show

Commit Message

Fabian Blaese Oct. 19, 2017, 8:19 a.m.
Signed-off-by: Fabian Bläse <fabian@blaese.de>
---
 src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
 src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8 ++++----
 src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10 ++++++++++
 src/packages/fff/fff-web/files/www/hood/.keep                 |  0
 src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
 5 files changed, 17 insertions(+), 7 deletions(-)
 create mode 100644 src/packages/fff/fff-web/files/www/hood/.keep

Patch hide | download patch | download mbox

diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
index d7c2c13..a2fc651 100644
--- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
+++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
@@ -6,8 +6,8 @@ 
 
 getJsonPath() {
 	jsonfile=""
-	if [ -s /www/public/keyxchangev2data ] ; then
-		jsonfile="/www/public/keyxchangev2data"
+	if [ -s /www/hood/keyxchangev2data ] ; then
+		jsonfile="/www/hood/keyxchangev2data"
 	elif [ -s /tmp/keyxchangev2data ] ; then
 		jsonfile="/tmp/keyxchangev2data"
 	fi
diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
index 88f6f53..c47b251 100755
--- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
+++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
@@ -70,7 +70,7 @@  else
 	if ! isGatewayAvailable ; then
 		#now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file!
 		#first we delete all wifi settings
-		rm -f /www/public/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
+		rm -f /www/hood/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
 
 		if ! wifiDelAll; then
 			echo "Can't delete current wifi setup"
@@ -97,7 +97,7 @@  else
 		# wait a moment to start the interface
 		sleep 10;
 		# and here we can download the Hoodfile from the other node
-		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O /tmp/keyxchangev2data
+		wget -T15 -t5 "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
 	else
 		echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1"
 		wget -T15 -t5 "http://[fe80::1%br-mesh]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
@@ -111,7 +111,7 @@  if [ -s /tmp/keyxchangev2data ]; then
 	# but without signature, every hood file we get is valid!
 
 	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
-	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
+	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
 	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
 	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
 
@@ -186,7 +186,7 @@  if [ -s /tmp/keyxchangev2data ]; then
 
 		# copy the file to webroot so that other Meshrouter can download it;
 		# copy only after all other steps so IF can be reentered if something goes wrong
-		cp /tmp/keyxchangev2data /www/public/
+		cp /tmp/keyxchangev2data /www/hood/
 
 	else
 		echo "We have no new file. We do nothing. We try it again in 5 minutes...";
diff --git a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
index 28ae2b5..42376ad 100644
--- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
+++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
@@ -5,6 +5,7 @@  uci batch <<EOF
   delete uhttpd.public
   delete uhttpd.ssl
   delete uhttpd.px5g
+
   set uhttpd.public=uhttpd
   add_list uhttpd.public.listen_http='80'
   set uhttpd.public.home='/www/public'
@@ -14,6 +15,7 @@  uci batch <<EOF
   set uhttpd.public.network_timeout='30'
   set uhttpd.public.tcp_keepalive='1'
   set uhttpd.public.config='_'
+
   set uhttpd.ssl=uhttpd
   add_list uhttpd.ssl.listen_https='443'
   set uhttpd.ssl.home='/www/ssl'
@@ -29,6 +31,14 @@  uci batch <<EOF
   set uhttpd.px5g.days='1400'
   set uhttpd.px5g.bits='2048'
   set uhttpd.px5g.commonname='OpenWrt'
+
+  set uhttpd.hood=uhttpd
+  add_list uhttpd.hood.listen_http='2342'
+  set uhttpd.hood.home='/www/hood'
+  set uhttpd.hood.rfc1918_filter='1'
+  set uhttpd.hood.network_timeout='30'
+  set uhttpd.hood.tcp_keepalive='1'
+  set uhttpd.hood.config='_'
 EOF
 
 uci commit uhttpd
diff --git a/src/packages/fff/fff-web/files/www/hood/.keep b/src/packages/fff/fff-web/files/www/hood/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
index cbce768..402670d 100755
--- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
+++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
@@ -5,7 +5,7 @@ 
 if [ "$REQUEST_METHOD" == "POST" ] ; then
 	if [ "$POST_resethood" != "" ] ; then
 		# reset hood
-		rm /www/public/keyxchangev2data 2> /dev/null
+		rm /www/hood/keyxchangev2data 2> /dev/null
 		MSG='<span class="green">Hood-Daten werden innerhalb von 5 Minuten neu prozessiert.</span>'
 	fi
 fi

Comments

Robert Langhammer Oct. 19, 2017, 9:05 a.m.
Hi,

ich bin immer noch dafür, den Port hier und auf br-mesh auf 80 zu lassen.

Der Druck vom Standard abzuweichen ist meines Erachtens nicht groß genug.

Ein echtes Problem taucht doch erst auf, wenn eine 2. Hood auf dem
Gateway läuft. Und das hat man mit port 2345 auch, weil sämtliche httpd
auf nen Unix Network socket lauschen, und da gibt's kein Interface. Man
gewinnt also nicht wirklich was.

Dann lieber eine einfache Lösung am Gateway: Für jede Hood einen vhost
auf [fe80::1]:XX und den Port pro batX umbiegen. Müsste man auch mit
Port 2345 machen.

Robert


Am 19.10.2017 um 10:19 schrieb Fabian Bläse:
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8 ++++----
>  src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10 ++++++++++
>  src/packages/fff/fff-web/files/www/hood/.keep                 |  0
>  src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
>  5 files changed, 17 insertions(+), 7 deletions(-)
>  create mode 100644 src/packages/fff/fff-web/files/www/hood/.keep
>
> diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> index d7c2c13..a2fc651 100644
> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> @@ -6,8 +6,8 @@
>  
>  getJsonPath() {
>  	jsonfile=""
> -	if [ -s /www/public/keyxchangev2data ] ; then
> -		jsonfile="/www/public/keyxchangev2data"
> +	if [ -s /www/hood/keyxchangev2data ] ; then
> +		jsonfile="/www/hood/keyxchangev2data"
>  	elif [ -s /tmp/keyxchangev2data ] ; then
>  		jsonfile="/tmp/keyxchangev2data"
>  	fi
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 88f6f53..c47b251 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -70,7 +70,7 @@ else
>  	if ! isGatewayAvailable ; then
>  		#now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file!
>  		#first we delete all wifi settings
> -		rm -f /www/public/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
> +		rm -f /www/hood/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
>  
>  		if ! wifiDelAll; then
>  			echo "Can't delete current wifi setup"
> @@ -97,7 +97,7 @@ else
>  		# wait a moment to start the interface
>  		sleep 10;
>  		# and here we can download the Hoodfile from the other node
> -		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O /tmp/keyxchangev2data
> +		wget -T15 -t5 "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
>  	else
>  		echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1"
>  		wget -T15 -t5 "http://[fe80::1%br-mesh]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
> @@ -111,7 +111,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>  	# but without signature, every hood file we get is valid!
>  
>  	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
> -	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
> +	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>  	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
>  	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
>  
> @@ -186,7 +186,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>  
>  		# copy the file to webroot so that other Meshrouter can download it;
>  		# copy only after all other steps so IF can be reentered if something goes wrong
> -		cp /tmp/keyxchangev2data /www/public/
> +		cp /tmp/keyxchangev2data /www/hood/
>  
>  	else
>  		echo "We have no new file. We do nothing. We try it again in 5 minutes...";
> diff --git a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> index 28ae2b5..42376ad 100644
> --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> @@ -5,6 +5,7 @@ uci batch <<EOF
>    delete uhttpd.public
>    delete uhttpd.ssl
>    delete uhttpd.px5g
> +
>    set uhttpd.public=uhttpd
>    add_list uhttpd.public.listen_http='80'
>    set uhttpd.public.home='/www/public'
> @@ -14,6 +15,7 @@ uci batch <<EOF
>    set uhttpd.public.network_timeout='30'
>    set uhttpd.public.tcp_keepalive='1'
>    set uhttpd.public.config='_'
> +
>    set uhttpd.ssl=uhttpd
>    add_list uhttpd.ssl.listen_https='443'
>    set uhttpd.ssl.home='/www/ssl'
> @@ -29,6 +31,14 @@ uci batch <<EOF
>    set uhttpd.px5g.days='1400'
>    set uhttpd.px5g.bits='2048'
>    set uhttpd.px5g.commonname='OpenWrt'
> +
> +  set uhttpd.hood=uhttpd
> +  add_list uhttpd.hood.listen_http='2342'
> +  set uhttpd.hood.home='/www/hood'
> +  set uhttpd.hood.rfc1918_filter='1'
> +  set uhttpd.hood.network_timeout='30'
> +  set uhttpd.hood.tcp_keepalive='1'
> +  set uhttpd.hood.config='_'
>  EOF
>  
>  uci commit uhttpd
> diff --git a/src/packages/fff/fff-web/files/www/hood/.keep b/src/packages/fff/fff-web/files/www/hood/.keep
> new file mode 100644
> index 0000000..e69de29
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> index cbce768..402670d 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> @@ -5,7 +5,7 @@
>  if [ "$REQUEST_METHOD" == "POST" ] ; then
>  	if [ "$POST_resethood" != "" ] ; then
>  		# reset hood
> -		rm /www/public/keyxchangev2data 2> /dev/null
> +		rm /www/hood/keyxchangev2data 2> /dev/null
>  		MSG='<span class="green">Hood-Daten werden innerhalb von 5 Minuten neu prozessiert.</span>'
>  	fi
>  fi
Christian Dresel Oct. 19, 2017, 9:07 a.m.
hi

https://github.com/RedDog99/uweb

sollte alle Probleme lösen und dann ist der umgebogene Port doch sinnvoll ;)

mfg

Christian

On 19.10.2017 11:05, Robert Langhammer wrote:
> Hi,
> 
> ich bin immer noch dafür, den Port hier und auf br-mesh auf 80 zu lassen.
> 
> Der Druck vom Standard abzuweichen ist meines Erachtens nicht groß genug.
> 
> Ein echtes Problem taucht doch erst auf, wenn eine 2. Hood auf dem
> Gateway läuft. Und das hat man mit port 2345 auch, weil sämtliche httpd
> auf nen Unix Network socket lauschen, und da gibt's kein Interface. Man
> gewinnt also nicht wirklich was.
> 
> Dann lieber eine einfache Lösung am Gateway: Für jede Hood einen vhost
> auf [fe80::1]:XX und den Port pro batX umbiegen. Müsste man auch mit
> Port 2345 machen.
> 
> Robert
> 
> 
> Am 19.10.2017 um 10:19 schrieb Fabian Bläse:
>> Signed-off-by: Fabian Bläse <fabian@blaese.de>
>> ---
>>  src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
>>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8 ++++----
>>  src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10 ++++++++++
>>  src/packages/fff/fff-web/files/www/hood/.keep                 |  0
>>  src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
>>  5 files changed, 17 insertions(+), 7 deletions(-)
>>  create mode 100644 src/packages/fff/fff-web/files/www/hood/.keep
>>
>> diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> index d7c2c13..a2fc651 100644
>> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> @@ -6,8 +6,8 @@
>>  
>>  getJsonPath() {
>>  	jsonfile=""
>> -	if [ -s /www/public/keyxchangev2data ] ; then
>> -		jsonfile="/www/public/keyxchangev2data"
>> +	if [ -s /www/hood/keyxchangev2data ] ; then
>> +		jsonfile="/www/hood/keyxchangev2data"
>>  	elif [ -s /tmp/keyxchangev2data ] ; then
>>  		jsonfile="/tmp/keyxchangev2data"
>>  	fi
>> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> index 88f6f53..c47b251 100755
>> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> @@ -70,7 +70,7 @@ else
>>  	if ! isGatewayAvailable ; then
>>  		#now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file!
>>  		#first we delete all wifi settings
>> -		rm -f /www/public/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
>> +		rm -f /www/hood/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
>>  
>>  		if ! wifiDelAll; then
>>  			echo "Can't delete current wifi setup"
>> @@ -97,7 +97,7 @@ else
>>  		# wait a moment to start the interface
>>  		sleep 10;
>>  		# and here we can download the Hoodfile from the other node
>> -		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O /tmp/keyxchangev2data
>> +		wget -T15 -t5 "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
>>  	else
>>  		echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1"
>>  		wget -T15 -t5 "http://[fe80::1%br-mesh]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
>> @@ -111,7 +111,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>>  	# but without signature, every hood file we get is valid!
>>  
>>  	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>> -	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>> +	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>>  	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
>>  	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
>>  
>> @@ -186,7 +186,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>>  
>>  		# copy the file to webroot so that other Meshrouter can download it;
>>  		# copy only after all other steps so IF can be reentered if something goes wrong
>> -		cp /tmp/keyxchangev2data /www/public/
>> +		cp /tmp/keyxchangev2data /www/hood/
>>  
>>  	else
>>  		echo "We have no new file. We do nothing. We try it again in 5 minutes...";
>> diff --git a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> index 28ae2b5..42376ad 100644
>> --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> @@ -5,6 +5,7 @@ uci batch <<EOF
>>    delete uhttpd.public
>>    delete uhttpd.ssl
>>    delete uhttpd.px5g
>> +
>>    set uhttpd.public=uhttpd
>>    add_list uhttpd.public.listen_http='80'
>>    set uhttpd.public.home='/www/public'
>> @@ -14,6 +15,7 @@ uci batch <<EOF
>>    set uhttpd.public.network_timeout='30'
>>    set uhttpd.public.tcp_keepalive='1'
>>    set uhttpd.public.config='_'
>> +
>>    set uhttpd.ssl=uhttpd
>>    add_list uhttpd.ssl.listen_https='443'
>>    set uhttpd.ssl.home='/www/ssl'
>> @@ -29,6 +31,14 @@ uci batch <<EOF
>>    set uhttpd.px5g.days='1400'
>>    set uhttpd.px5g.bits='2048'
>>    set uhttpd.px5g.commonname='OpenWrt'
>> +
>> +  set uhttpd.hood=uhttpd
>> +  add_list uhttpd.hood.listen_http='2342'
>> +  set uhttpd.hood.home='/www/hood'
>> +  set uhttpd.hood.rfc1918_filter='1'
>> +  set uhttpd.hood.network_timeout='30'
>> +  set uhttpd.hood.tcp_keepalive='1'
>> +  set uhttpd.hood.config='_'
>>  EOF
>>  
>>  uci commit uhttpd
>> diff --git a/src/packages/fff/fff-web/files/www/hood/.keep b/src/packages/fff/fff-web/files/www/hood/.keep
>> new file mode 100644
>> index 0000000..e69de29
>> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> index cbce768..402670d 100755
>> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> @@ -5,7 +5,7 @@
>>  if [ "$REQUEST_METHOD" == "POST" ] ; then
>>  	if [ "$POST_resethood" != "" ] ; then
>>  		# reset hood
>> -		rm /www/public/keyxchangev2data 2> /dev/null
>> +		rm /www/hood/keyxchangev2data 2> /dev/null
>>  		MSG='<span class="green">Hood-Daten werden innerhalb von 5 Minuten neu prozessiert.</span>'
>>  	fi
>>  fi
>
Fabian Blaese Oct. 19, 2017, 9:15 a.m.
Hallo Robert,

zwar besteht aktuell keine dringende Notwendigkeit, auf einen anderen Port auszuweichen, allerdings macht ein anderer Port die Konfiguration nicht kompliziert, erlaubt aber, für das Anbieten der hoodfile eine andere Software zu verwenden, als für normale Webseiten. Und da man dafür ggf. sogar andere Software verwenden MUSS und es sich bei der hoodfile um einen gänzlich anderen Dienst als Webseiten handelt, sollte meiner Ansicht nach auf jeden Fall ein anderer Port verwendet werden.
Die wirkliche Lösung für mehrere Hoods auf einem Gateway ist Software, die sich an ein Interface binden kann (wie von Christian erwähnt)

Fabian

> On 19. Oct 2017, at 11:05, Robert Langhammer <rlanghammer@web.de> wrote:
> 
> Hi,
> 
> ich bin immer noch dafür, den Port hier und auf br-mesh auf 80 zu lassen.
> 
> Der Druck vom Standard abzuweichen ist meines Erachtens nicht groß genug.
> 
> Ein echtes Problem taucht doch erst auf, wenn eine 2. Hood auf dem
> Gateway läuft. Und das hat man mit port 2345 auch, weil sämtliche httpd
> auf nen Unix Network socket lauschen, und da gibt's kein Interface. Man
> gewinnt also nicht wirklich was.
> 
> Dann lieber eine einfache Lösung am Gateway: Für jede Hood einen vhost
> auf [fe80::1]:XX und den Port pro batX umbiegen. Müsste man auch mit
> Port 2345 machen.
> 
> Robert
> 
> 
> Am 19.10.2017 um 10:19 schrieb Fabian Bläse:
>> Signed-off-by: Fabian Bläse <fabian@blaese.de>
>> ---
>> src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
>> src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8 ++++----
>> src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10 ++++++++++
>> src/packages/fff/fff-web/files/www/hood/.keep                 |  0
>> src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
>> 5 files changed, 17 insertions(+), 7 deletions(-)
>> create mode 100644 src/packages/fff/fff-web/files/www/hood/.keep
>> 
>> diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> index d7c2c13..a2fc651 100644
>> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> @@ -6,8 +6,8 @@
>> 
>> getJsonPath() {
>> 	jsonfile=""
>> -	if [ -s /www/public/keyxchangev2data ] ; then
>> -		jsonfile="/www/public/keyxchangev2data"
>> +	if [ -s /www/hood/keyxchangev2data ] ; then
>> +		jsonfile="/www/hood/keyxchangev2data"
>> 	elif [ -s /tmp/keyxchangev2data ] ; then
>> 		jsonfile="/tmp/keyxchangev2data"
>> 	fi
>> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> index 88f6f53..c47b251 100755
>> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> @@ -70,7 +70,7 @@ else
>> 	if ! isGatewayAvailable ; then
>> 		#now we haven't a gateway in Range, we search for a hidden AP to get a keyxchangev2data file!
>> 		#first we delete all wifi settings
>> -		rm -f /www/public/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
>> +		rm -f /www/hood/keyxchangev2data # delete this, so interfaces are recreated if reconnect with unchanged hood file takes place
>> 
>> 		if ! wifiDelAll; then
>> 			echo "Can't delete current wifi setup"
>> @@ -97,7 +97,7 @@ else
>> 		# wait a moment to start the interface
>> 		sleep 10;
>> 		# and here we can download the Hoodfile from the other node
>> -		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O /tmp/keyxchangev2data
>> +		wget -T15 -t5 "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
>> 	else
>> 		echo "We have a Gateway in Range, we load the keyxchangev2data from fe80::1"
>> 		wget -T15 -t5 "http://[fe80::1%br-mesh]:2342/keyxchangev2data" -O /tmp/keyxchangev2data
>> @@ -111,7 +111,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>> 	# but without signature, every hood file we get is valid!
>> 
>> 	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>> -	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>> +	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed 's/"timestamp":[0-9]*/"timestamp":0/')"
>> 	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
>> 	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
>> 
>> @@ -186,7 +186,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>> 
>> 		# copy the file to webroot so that other Meshrouter can download it;
>> 		# copy only after all other steps so IF can be reentered if something goes wrong
>> -		cp /tmp/keyxchangev2data /www/public/
>> +		cp /tmp/keyxchangev2data /www/hood/
>> 
>> 	else
>> 		echo "We have no new file. We do nothing. We try it again in 5 minutes...";
>> diff --git a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> index 28ae2b5..42376ad 100644
>> --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> @@ -5,6 +5,7 @@ uci batch <<EOF
>>   delete uhttpd.public
>>   delete uhttpd.ssl
>>   delete uhttpd.px5g
>> +
>>   set uhttpd.public=uhttpd
>>   add_list uhttpd.public.listen_http='80'
>>   set uhttpd.public.home='/www/public'
>> @@ -14,6 +15,7 @@ uci batch <<EOF
>>   set uhttpd.public.network_timeout='30'
>>   set uhttpd.public.tcp_keepalive='1'
>>   set uhttpd.public.config='_'
>> +
>>   set uhttpd.ssl=uhttpd
>>   add_list uhttpd.ssl.listen_https='443'
>>   set uhttpd.ssl.home='/www/ssl'
>> @@ -29,6 +31,14 @@ uci batch <<EOF
>>   set uhttpd.px5g.days='1400'
>>   set uhttpd.px5g.bits='2048'
>>   set uhttpd.px5g.commonname='OpenWrt'
>> +
>> +  set uhttpd.hood=uhttpd
>> +  add_list uhttpd.hood.listen_http='2342'
>> +  set uhttpd.hood.home='/www/hood'
>> +  set uhttpd.hood.rfc1918_filter='1'
>> +  set uhttpd.hood.network_timeout='30'
>> +  set uhttpd.hood.tcp_keepalive='1'
>> +  set uhttpd.hood.config='_'
>> EOF
>> 
>> uci commit uhttpd
>> diff --git a/src/packages/fff/fff-web/files/www/hood/.keep b/src/packages/fff/fff-web/files/www/hood/.keep
>> new file mode 100644
>> index 0000000..e69de29
>> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> index cbce768..402670d 100755
>> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> @@ -5,7 +5,7 @@
>> if [ "$REQUEST_METHOD" == "POST" ] ; then
>> 	if [ "$POST_resethood" != "" ] ; then
>> 		# reset hood
>> -		rm /www/public/keyxchangev2data 2> /dev/null
>> +		rm /www/hood/keyxchangev2data 2> /dev/null
>> 		MSG='<span class="green">Hood-Daten werden innerhalb von 5 Minuten neu prozessiert.</span>'
>> 	fi
>> fi
> 
> --
> franken-dev mailing list
> franken-dev@freifunk.net <mailto:franken-dev@freifunk.net>
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net <http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net>
Adrian Schmutzler Oct. 19, 2017, 11:22 a.m.
Hallo Fabian,

da du in deinem Patch den Path zu einem der Hoodfiles änderst und der an
diversen Stellen verwendet wird, habe ich einen Patch gebaut, der das in
eine Variable steckt:

https://pw.freifunk-franken.de/patch/608/

Vll. macht es Sinn, deinen Patch darauf zu rebasen?

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Fabian Bläse
> Sent: Donnerstag, 19. Oktober 2017 10:19
> To: franken-dev@freifunk.net
> Subject: [PATCH] consistently use same webserver port for hoodfile on wifi
> and lan
> 
> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> ---
>  src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8
++++----
>  src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10
> ++++++++++
>  src/packages/fff/fff-web/files/www/hood/.keep                 |  0
>  src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
>  5 files changed, 17 insertions(+), 7 deletions(-)  create mode 100644
> src/packages/fff/fff-web/files/www/hood/.keep
> 
> diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> index d7c2c13..a2fc651 100644
> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> @@ -6,8 +6,8 @@
> 
>  getJsonPath() {
>  	jsonfile=""
> -	if [ -s /www/public/keyxchangev2data ] ; then
> -		jsonfile="/www/public/keyxchangev2data"
> +	if [ -s /www/hood/keyxchangev2data ] ; then
> +		jsonfile="/www/hood/keyxchangev2data"
>  	elif [ -s /tmp/keyxchangev2data ] ; then
>  		jsonfile="/tmp/keyxchangev2data"
>  	fi
> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> index 88f6f53..c47b251 100755
> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> @@ -70,7 +70,7 @@ else
>  	if ! isGatewayAvailable ; then
>  		#now we haven't a gateway in Range, we search for a hidden
> AP to get a keyxchangev2data file!
>  		#first we delete all wifi settings
> -		rm -f /www/public/keyxchangev2data # delete this, so
> interfaces are recreated if reconnect with unchanged hood file takes place
> +		rm -f /www/hood/keyxchangev2data # delete this, so
> interfaces are
> +recreated if reconnect with unchanged hood file takes place
> 
>  		if ! wifiDelAll; then
>  			echo "Can't delete current wifi setup"
> @@ -97,7 +97,7 @@ else
>  		# wait a moment to start the interface
>  		sleep 10;
>  		# and here we can download the Hoodfile from the other
> node
> -		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O
> /tmp/keyxchangev2data
> +		wget -T15 -t5
> "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O
> +/tmp/keyxchangev2data
>  	else
>  		echo "We have a Gateway in Range, we load the
> keyxchangev2data from fe80::1"
>  		wget -T15 -t5 "http://[fe80::1%br-
> mesh]:2342/keyxchangev2data" -O /tmp/keyxchangev2data @@ -111,7
> +111,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>  	# but without signature, every hood file we get is valid!
> 
>  	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-
> 9]*/"timestamp":0/')"
> -	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed
> 's/"timestamp":[0-9]*/"timestamp":0/')"
> +	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed
> 's/"timestamp":[0-9]*/"timestamp":0/')"
>  	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
>  	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
> 
> @@ -186,7 +186,7 @@ if [ -s /tmp/keyxchangev2data ]; then
> 
>  		# copy the file to webroot so that other Meshrouter can
> download it;
>  		# copy only after all other steps so IF can be reentered if
> something goes wrong
> -		cp /tmp/keyxchangev2data /www/public/
> +		cp /tmp/keyxchangev2data /www/hood/
> 
>  	else
>  		echo "We have no new file. We do nothing. We try it again in
> 5 minutes..."; diff --git
a/src/packages/fff/fff-web/files/etc/uci-defaults/93-
> fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> index 28ae2b5..42376ad 100644
> --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> @@ -5,6 +5,7 @@ uci batch <<EOF
>    delete uhttpd.public
>    delete uhttpd.ssl
>    delete uhttpd.px5g
> +
>    set uhttpd.public=uhttpd
>    add_list uhttpd.public.listen_http='80'
>    set uhttpd.public.home='/www/public'
> @@ -14,6 +15,7 @@ uci batch <<EOF
>    set uhttpd.public.network_timeout='30'
>    set uhttpd.public.tcp_keepalive='1'
>    set uhttpd.public.config='_'
> +
>    set uhttpd.ssl=uhttpd
>    add_list uhttpd.ssl.listen_https='443'
>    set uhttpd.ssl.home='/www/ssl'
> @@ -29,6 +31,14 @@ uci batch <<EOF
>    set uhttpd.px5g.days='1400'
>    set uhttpd.px5g.bits='2048'
>    set uhttpd.px5g.commonname='OpenWrt'
> +
> +  set uhttpd.hood=uhttpd
> +  add_list uhttpd.hood.listen_http='2342'
> +  set uhttpd.hood.home='/www/hood'
> +  set uhttpd.hood.rfc1918_filter='1'
> +  set uhttpd.hood.network_timeout='30'
> +  set uhttpd.hood.tcp_keepalive='1'
> +  set uhttpd.hood.config='_'
>  EOF
> 
>  uci commit uhttpd
> diff --git a/src/packages/fff/fff-web/files/www/hood/.keep
> b/src/packages/fff/fff-web/files/www/hood/.keep
> new file mode 100644
> index 0000000..e69de29
> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> index cbce768..402670d 100755
> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> @@ -5,7 +5,7 @@
>  if [ "$REQUEST_METHOD" == "POST" ] ; then
>  	if [ "$POST_resethood" != "" ] ; then
>  		# reset hood
> -		rm /www/public/keyxchangev2data 2> /dev/null
> +		rm /www/hood/keyxchangev2data 2> /dev/null
>  		MSG='<span class="green">Hood-Daten werden innerhalb
> von 5 Minuten neu prozessiert.</span>'
>  	fi
>  fi
> --
> 2.14.2
> 
> --
> franken-dev mailing list
> franken-dev@freifunk.net
> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
Fabian Blaese Oct. 19, 2017, 11:52 a.m.
Hallo Adrian,

gute Idee, ich rebase die nächste Version dann darauf.

Außerdem getestet, daher
Tested-by: Fabian Bläse <fabian@blaese.de>

Fabian

> On 19. Oct 2017, at 13:22, Adrian Schmutzler <mail@adrianschmutzler.de> wrote:
> 
> Hallo Fabian,
> 
> da du in deinem Patch den Path zu einem der Hoodfiles änderst und der an
> diversen Stellen verwendet wird, habe ich einen Patch gebaut, der das in
> eine Variable steckt:
> 
> https://pw.freifunk-franken.de/patch/608/
> 
> Vll. macht es Sinn, deinen Patch darauf zu rebasen?
> 
> Grüße
> 
> Adrian
> 
>> -----Original Message-----
>> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
>> Of Fabian Bläse
>> Sent: Donnerstag, 19. Oktober 2017 10:19
>> To: franken-dev@freifunk.net
>> Subject: [PATCH] consistently use same webserver port for hoodfile on wifi
>> and lan
>> 
>> Signed-off-by: Fabian Bläse <fabian@blaese.de>
>> ---
>> src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
>> src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8
> ++++----
>> src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10
>> ++++++++++
>> src/packages/fff/fff-web/files/www/hood/.keep                 |  0
>> src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
>> 5 files changed, 17 insertions(+), 7 deletions(-)  create mode 100644
>> src/packages/fff/fff-web/files/www/hood/.keep
>> 
>> diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> index d7c2c13..a2fc651 100644
>> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
>> @@ -6,8 +6,8 @@
>> 
>> getJsonPath() {
>> 	jsonfile=""
>> -	if [ -s /www/public/keyxchangev2data ] ; then
>> -		jsonfile="/www/public/keyxchangev2data"
>> +	if [ -s /www/hood/keyxchangev2data ] ; then
>> +		jsonfile="/www/hood/keyxchangev2data"
>> 	elif [ -s /tmp/keyxchangev2data ] ; then
>> 		jsonfile="/tmp/keyxchangev2data"
>> 	fi
>> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> index 88f6f53..c47b251 100755
>> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
>> @@ -70,7 +70,7 @@ else
>> 	if ! isGatewayAvailable ; then
>> 		#now we haven't a gateway in Range, we search for a hidden
>> AP to get a keyxchangev2data file!
>> 		#first we delete all wifi settings
>> -		rm -f /www/public/keyxchangev2data # delete this, so
>> interfaces are recreated if reconnect with unchanged hood file takes place
>> +		rm -f /www/hood/keyxchangev2data # delete this, so
>> interfaces are
>> +recreated if reconnect with unchanged hood file takes place
>> 
>> 		if ! wifiDelAll; then
>> 			echo "Can't delete current wifi setup"
>> @@ -97,7 +97,7 @@ else
>> 		# wait a moment to start the interface
>> 		sleep 10;
>> 		# and here we can download the Hoodfile from the other
>> node
>> -		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O
>> /tmp/keyxchangev2data
>> +		wget -T15 -t5
>> "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O
>> +/tmp/keyxchangev2data
>> 	else
>> 		echo "We have a Gateway in Range, we load the
>> keyxchangev2data from fe80::1"
>> 		wget -T15 -t5 "http://[fe80::1%br-
>> mesh]:2342/keyxchangev2data" -O /tmp/keyxchangev2data @@ -111,7
>> +111,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>> 	# but without signature, every hood file we get is valid!
>> 
>> 	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-
>> 9]*/"timestamp":0/')"
>> -	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed
>> 's/"timestamp":[0-9]*/"timestamp":0/')"
>> +	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed
>> 's/"timestamp":[0-9]*/"timestamp":0/')"
>> 	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
>> 	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
>> 
>> @@ -186,7 +186,7 @@ if [ -s /tmp/keyxchangev2data ]; then
>> 
>> 		# copy the file to webroot so that other Meshrouter can
>> download it;
>> 		# copy only after all other steps so IF can be reentered if
>> something goes wrong
>> -		cp /tmp/keyxchangev2data /www/public/
>> +		cp /tmp/keyxchangev2data /www/hood/
>> 
>> 	else
>> 		echo "We have no new file. We do nothing. We try it again in
>> 5 minutes..."; diff --git
> a/src/packages/fff/fff-web/files/etc/uci-defaults/93-
>> fff-uhttpd b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> index 28ae2b5..42376ad 100644
>> --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
>> @@ -5,6 +5,7 @@ uci batch <<EOF
>>   delete uhttpd.public
>>   delete uhttpd.ssl
>>   delete uhttpd.px5g
>> +
>>   set uhttpd.public=uhttpd
>>   add_list uhttpd.public.listen_http='80'
>>   set uhttpd.public.home='/www/public'
>> @@ -14,6 +15,7 @@ uci batch <<EOF
>>   set uhttpd.public.network_timeout='30'
>>   set uhttpd.public.tcp_keepalive='1'
>>   set uhttpd.public.config='_'
>> +
>>   set uhttpd.ssl=uhttpd
>>   add_list uhttpd.ssl.listen_https='443'
>>   set uhttpd.ssl.home='/www/ssl'
>> @@ -29,6 +31,14 @@ uci batch <<EOF
>>   set uhttpd.px5g.days='1400'
>>   set uhttpd.px5g.bits='2048'
>>   set uhttpd.px5g.commonname='OpenWrt'
>> +
>> +  set uhttpd.hood=uhttpd
>> +  add_list uhttpd.hood.listen_http='2342'
>> +  set uhttpd.hood.home='/www/hood'
>> +  set uhttpd.hood.rfc1918_filter='1'
>> +  set uhttpd.hood.network_timeout='30'
>> +  set uhttpd.hood.tcp_keepalive='1'
>> +  set uhttpd.hood.config='_'
>> EOF
>> 
>> uci commit uhttpd
>> diff --git a/src/packages/fff/fff-web/files/www/hood/.keep
>> b/src/packages/fff/fff-web/files/www/hood/.keep
>> new file mode 100644
>> index 0000000..e69de29
>> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> index cbce768..402670d 100755
>> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
>> @@ -5,7 +5,7 @@
>> if [ "$REQUEST_METHOD" == "POST" ] ; then
>> 	if [ "$POST_resethood" != "" ] ; then
>> 		# reset hood
>> -		rm /www/public/keyxchangev2data 2> /dev/null
>> +		rm /www/hood/keyxchangev2data 2> /dev/null
>> 		MSG='<span class="green">Hood-Daten werden innerhalb
>> von 5 Minuten neu prozessiert.</span>'
>> 	fi
>> fi
>> --
>> 2.14.2
>> 
>> --
>> franken-dev mailing list
>> franken-dev@freifunk.net
>> http://lists.freifunk.net/mailman/listinfo/franken-dev-freifunk.net
>
Adrian Schmutzler Oct. 28, 2017, 10:35 a.m.
Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>

Getestet zusammen mit dem Sector-Patch.

Funktioniert und sieht plausibel aus, für ein Review fehlt mir die Kompetenz zwecks der uhttp Settings.

@Fabian: Ich würde es jetzt anders herum machen, erst diesen Patch einspielen und dann die einheitlichen Hoodvariablen draufpatchen.

Grüße

Adrian

> -----Original Message-----
> From: franken-dev [mailto:franken-dev-bounces@freifunk.net] On Behalf
> Of Christian Dresel
> Sent: Donnerstag, 19. Oktober 2017 11:07
> To: Robert Langhammer <rlanghammer@web.de>; franken-
> dev@freifunk.net
> Subject: Re: [PATCH] consistently use same webserver port for hoodfile on
> wifi and lan
> 
> hi
> 
> https://github.com/RedDog99/uweb
> 
> sollte alle Probleme lösen und dann ist der umgebogene Port doch sinnvoll ;)
> 
> mfg
> 
> Christian
> 
> On 19.10.2017 11:05, Robert Langhammer wrote:
> > Hi,
> >
> > ich bin immer noch dafür, den Port hier und auf br-mesh auf 80 zu lassen.
> >
> > Der Druck vom Standard abzuweichen ist meines Erachtens nicht groß
> genug.
> >
> > Ein echtes Problem taucht doch erst auf, wenn eine 2. Hood auf dem
> > Gateway läuft. Und das hat man mit port 2345 auch, weil sämtliche
> > httpd auf nen Unix Network socket lauschen, und da gibt's kein
> > Interface. Man gewinnt also nicht wirklich was.
> >
> > Dann lieber eine einfache Lösung am Gateway: Für jede Hood einen vhost
> > auf [fe80::1]:XX und den Port pro batX umbiegen. Müsste man auch mit
> > Port 2345 machen.
> >
> > Robert
> >
> >
> > Am 19.10.2017 um 10:19 schrieb Fabian Bläse:
> >> Signed-off-by: Fabian Bläse <fabian@blaese.de>
> >> ---
> >>  src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange |  4 ++--
> >>  src/packages/fff/fff-hoods/files/usr/sbin/configurehood       |  8 ++++----
> >>  src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd | 10
> ++++++++++
> >>  src/packages/fff/fff-web/files/www/hood/.keep                 |  0
> >>  src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html      |  2 +-
> >>  5 files changed, 17 insertions(+), 7 deletions(-)  create mode
> >> 100644 src/packages/fff/fff-web/files/www/hood/.keep
> >>
> >> diff --git
> >> a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> >> b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> >> index d7c2c13..a2fc651 100644
> >> --- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> >> +++ b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
> >> @@ -6,8 +6,8 @@
> >>
> >>  getJsonPath() {
> >>  	jsonfile=""
> >> -	if [ -s /www/public/keyxchangev2data ] ; then
> >> -		jsonfile="/www/public/keyxchangev2data"
> >> +	if [ -s /www/hood/keyxchangev2data ] ; then
> >> +		jsonfile="/www/hood/keyxchangev2data"
> >>  	elif [ -s /tmp/keyxchangev2data ] ; then
> >>  		jsonfile="/tmp/keyxchangev2data"
> >>  	fi
> >> diff --git a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >> b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >> index 88f6f53..c47b251 100755
> >> --- a/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >> +++ b/src/packages/fff/fff-hoods/files/usr/sbin/configurehood
> >> @@ -70,7 +70,7 @@ else
> >>  	if ! isGatewayAvailable ; then
> >>  		#now we haven't a gateway in Range, we search for a hidden
> AP to get a keyxchangev2data file!
> >>  		#first we delete all wifi settings
> >> -		rm -f /www/public/keyxchangev2data # delete this, so
> interfaces are recreated if reconnect with unchanged hood file takes place
> >> +		rm -f /www/hood/keyxchangev2data # delete this, so
> interfaces are
> >> +recreated if reconnect with unchanged hood file takes place
> >>
> >>  		if ! wifiDelAll; then
> >>  			echo "Can't delete current wifi setup"
> >> @@ -97,7 +97,7 @@ else
> >>  		# wait a moment to start the interface
> >>  		sleep 10;
> >>  		# and here we can download the Hoodfile from the other
> node
> >> -		wget -T15 -t5 "http://[fe80::1%w2sta]/keyxchangev2data" -O
> /tmp/keyxchangev2data
> >> +		wget -T15 -t5
> "http://[fe80::1%w2sta]:2342/keyxchangev2data" -O
> >> +/tmp/keyxchangev2data
> >>  	else
> >>  		echo "We have a Gateway in Range, we load the
> keyxchangev2data from fe80::1"
> >>  		wget -T15 -t5 "http://[fe80::1%br-
> mesh]:2342/keyxchangev2data" -O
> >> /tmp/keyxchangev2data @@ -111,7 +111,7 @@ if [ -s
> /tmp/keyxchangev2data ]; then
> >>  	# but without signature, every hood file we get is valid!
> >>
> >>  	catnew="$(cat /tmp/keyxchangev2data | sed 's/"timestamp":[0-
> 9]*/"timestamp":0/')"
> >> -	catold="$(cat /www/public/keyxchangev2data 2>/dev/null | sed
> 's/"timestamp":[0-9]*/"timestamp":0/')"
> >> +	catold="$(cat /www/hood/keyxchangev2data 2>/dev/null | sed
> 's/"timestamp":[0-9]*/"timestamp":0/')"
> >>  	sumnew=$(echo "$catnew" | sha256sum | cut -f1 -d " ")
> >>  	sumold=$(echo "$catold" | sha256sum | cut -f1 -d " ")
> >>
> >> @@ -186,7 +186,7 @@ if [ -s /tmp/keyxchangev2data ]; then
> >>
> >>  		# copy the file to webroot so that other Meshrouter can
> download it;
> >>  		# copy only after all other steps so IF can be reentered if
> something goes wrong
> >> -		cp /tmp/keyxchangev2data /www/public/
> >> +		cp /tmp/keyxchangev2data /www/hood/
> >>
> >>  	else
> >>  		echo "We have no new file. We do nothing. We try it again in
> 5
> >> minutes..."; diff --git
> >> a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> >> b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> >> index 28ae2b5..42376ad 100644
> >> --- a/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> >> +++ b/src/packages/fff/fff-web/files/etc/uci-defaults/93-fff-uhttpd
> >> @@ -5,6 +5,7 @@ uci batch <<EOF
> >>    delete uhttpd.public
> >>    delete uhttpd.ssl
> >>    delete uhttpd.px5g
> >> +
> >>    set uhttpd.public=uhttpd
> >>    add_list uhttpd.public.listen_http='80'
> >>    set uhttpd.public.home='/www/public'
> >> @@ -14,6 +15,7 @@ uci batch <<EOF
> >>    set uhttpd.public.network_timeout='30'
> >>    set uhttpd.public.tcp_keepalive='1'
> >>    set uhttpd.public.config='_'
> >> +
> >>    set uhttpd.ssl=uhttpd
> >>    add_list uhttpd.ssl.listen_https='443'
> >>    set uhttpd.ssl.home='/www/ssl'
> >> @@ -29,6 +31,14 @@ uci batch <<EOF
> >>    set uhttpd.px5g.days='1400'
> >>    set uhttpd.px5g.bits='2048'
> >>    set uhttpd.px5g.commonname='OpenWrt'
> >> +
> >> +  set uhttpd.hood=uhttpd
> >> +  add_list uhttpd.hood.listen_http='2342'
> >> +  set uhttpd.hood.home='/www/hood'
> >> +  set uhttpd.hood.rfc1918_filter='1'
> >> +  set uhttpd.hood.network_timeout='30'
> >> +  set uhttpd.hood.tcp_keepalive='1'
> >> +  set uhttpd.hood.config='_'
> >>  EOF
> >>
> >>  uci commit uhttpd
> >> diff --git a/src/packages/fff/fff-web/files/www/hood/.keep
> >> b/src/packages/fff/fff-web/files/www/hood/.keep
> >> new file mode 100644
> >> index 0000000..e69de29
> >> diff --git a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> >> b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> >> index cbce768..402670d 100755
> >> --- a/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> >> +++ b/src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html
> >> @@ -5,7 +5,7 @@
> >>  if [ "$REQUEST_METHOD" == "POST" ] ; then
> >>  	if [ "$POST_resethood" != "" ] ; then
> >>  		# reset hood
> >> -		rm /www/public/keyxchangev2data 2> /dev/null
> >> +		rm /www/hood/keyxchangev2data 2> /dev/null
> >>  		MSG='<span class="green">Hood-Daten werden innerhalb
> von 5 Minuten neu prozessiert.</span>'
> >>  	fi
> >>  fi
> >