[v2] fff-webui: show fast public key in webui

Submitted by Christian Dresel on Jan. 5, 2020, 9:13 a.m.

Details

Message ID 20200105091341.22648-1-fff@chrisi01.de
State New
Headers show

Commit Message

Christian Dresel Jan. 5, 2020, 9:13 a.m.
User can see the fastd public key in the webui

Signed-off-by: Christian Dresel <fff@chrisi01.de>

---
Changes in v2:
- if router a layer3 router or mesh node and have no fastdkey use "-" as output
- remove /tmp/sec file
---
---
 src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

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 f18a3b4..eda5d15 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
@@ -46,6 +46,10 @@  else
 	internet_active="Nein"
 fi
 
+if ! fastd_pub=$(echo "secret \"$(uci -q get fastd.fff.secret)\";" | fastd -c - --show-key --machine-readable); then
+	fastd_pub="-"
+fi
+
 %>
 <table style="width: 100%;">
 <tr><td>
@@ -58,6 +62,7 @@  fi
 		<tr><th>Bekannte Knoten:</th><td><%= $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)+1)) %></td></tr>
 		<tr><th>Nachbarknoten:</th><td><%= $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null) %></td></tr>
 		<tr><th>VPN via fastd:</th><td><%= ${vpn_active} %></td></tr>
+		<tr><th>fastd public key:</th><td><%= ${fastd_pub} %></td></tr>
 		<tr><th>Laufzeit:</th><td><%= ${uptime} %></td></tr>
 		<tr><th>Auslastung:</th><td><%= ${load} %></td></tr>
 		<tr><th>Uhrzeit:</th><td><% date %></td></tr>

Comments

Robert Langhammer Jan. 5, 2020, 4:57 p.m.
Hi Christian,

das kann sehr hilfreich sein.

Reviewed-by: Robert Langhammer <rlanghammer@web.de>

Am 05.01.20 um 10:13 schrieb Christian Dresel:
> User can see the fastd public key in the webui
>
> Signed-off-by: Christian Dresel <fff@chrisi01.de>
>
> ---
> Changes in v2:
> - if router a layer3 router or mesh node and have no fastdkey use "-" as output
> - remove /tmp/sec file
> ---
> ---
>  src/packages/fff/fff-web/files/www/ssl/cgi-bin/home.html | 5 +++++
>  1 file changed, 5 insertions(+)
>
> 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 f18a3b4..eda5d15 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
> @@ -46,6 +46,10 @@ else
>  	internet_active="Nein"
>  fi
>
> +if ! fastd_pub=$(echo "secret \"$(uci -q get fastd.fff.secret)\";" | fastd -c - --show-key --machine-readable); then
> +	fastd_pub="-"
> +fi
> +
>  %>
>  <table style="width: 100%;">
>  <tr><td>
> @@ -58,6 +62,7 @@ fi
>  		<tr><th>Bekannte Knoten:</th><td><%= $(($(batctl tg -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null)+1)) %></td></tr>
>  		<tr><th>Nachbarknoten:</th><td><%= $(batctl o -H | cut -b 40-56 | sort | uniq | wc -l 2>/dev/null) %></td></tr>
>  		<tr><th>VPN via fastd:</th><td><%= ${vpn_active} %></td></tr>
> +		<tr><th>fastd public key:</th><td><%= ${fastd_pub} %></td></tr>
>  		<tr><th>Laufzeit:</th><td><%= ${uptime} %></td></tr>
>  		<tr><th>Auslastung:</th><td><%= ${load} %></td></tr>
>  		<tr><th>Uhrzeit:</th><td><% date %></td></tr>