From 593c7ae36cf0b1ddb9cc243e6298e365383f93b0 Mon Sep 17 00:00:00 2001
From: Bob Mottram <bob@robotics.uk.to>
Date: Sat, 30 Apr 2016 10:16:00 +0100
Subject: [PATCH] Obtain ssh parameters from the main project file

---
 src/freedombone-client | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/freedombone-client b/src/freedombone-client
index c6fe99e48..123419bf5 100755
--- a/src/freedombone-client
+++ b/src/freedombone-client
@@ -37,11 +37,21 @@ MESH_CLIENT_INSTALL=
 # Version number of this script
 VERSION="1.01"
 
+# get the main project file, so that some values can be extracted
+MAIN_PROJECT_FILE=/usr/local/bin/${PROJECT_NAME}
+if [ ! -f $MAIN_PROJECT_FILE ]; then
+	MAIN_PROJECT_FILE=/usr/bin/${PROJECT_NAME}
+fi
+if [ ! -f $MAIN_PROJECT_FILE ]; then
+	echo "The main project file $MAIN_PROJECT_FILE was not found"
+	exit 72529
+fi
+
 # ssh (from https://stribika.github.io/2015/01/04/secure-secure-shell.html)
-SSH_CIPHERS="chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr"
-SSH_MACS="hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com"
-SSH_KEX="curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256"
-SSH_HOST_KEY_ALGORITHMS="ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-ed25519,ssh-rsa"
+SSH_CIPHERS=$(cat $MAIN_PROJECT_FILE | grep 'SSH_CIPHERS=' | head -n 1 | awk -F '"' '{print $2}')
+SSH_MACS=$(cat $MAIN_PROJECT_FILE | grep 'SSH_MACS=' | head -n 1 | awk -F '"' '{print $2}')
+SSH_KEX=$(cat $MAIN_PROJECT_FILE | grep 'SSH_KEX=' | head -n 1 | awk -F '"' '{print $2}')
+SSH_HOST_KEY_ALGORITHMS=$(cat $MAIN_PROJECT_FILE | grep 'SSH_HOST_KEY_ALGORITHMS=' | head -n 1 | awk -F '"' '{print $2}')
 
 # see https://stribika.github.io/2015/01/04/secure-secure-shell.html
 function ssh_remove_small_moduli {
-- 
GitLab