From ae4e220bd975929b85e844e22d1a48edebe9254c Mon Sep 17 00:00:00 2001
From: David Beniamine <david.beniamine@tetras-libre.fr>
Date: Fri, 14 Sep 2018 10:47:06 +0200
Subject: [PATCH] Send rsa key

---
 registry/scripts/registry.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/registry/scripts/registry.sh b/registry/scripts/registry.sh
index 0120e96..80c8fbf 100755
--- a/registry/scripts/registry.sh
+++ b/registry/scripts/registry.sh
@@ -30,6 +30,7 @@ if [ ! -d $conf_dir ]
 then
     # Init
     mkdir $conf_dir
+    ssh-keygen -P "" -f /root/.ssh/id_rsa
 else
     # Clean
     while read line
@@ -49,6 +50,8 @@ do
     then
         date=$(date +%Y%m%d)
         res=$(grep "$line" $conf_file)
+        rIP=$(echo $line | cut -d ' ' -f 3)
+        line=$(echo $line | cut -d ' ' -f 1-2)
         if [ ! -z "$res" ]
         then
             # Update
@@ -57,6 +60,7 @@ do
             # Add
             echo "$date $line" >> $conf_file
         fi
+        cat /root/.ssh/id_rsa.pub | netcat $rIP $port
     fi
 done
 
-- 
GitLab