Initial commit of the O1 simulator framework.
[sim/o1-interface.git] / ntsimulator / scripts / tls / enable_ssh_key.sh
diff --git a/ntsimulator/scripts/tls/enable_ssh_key.sh b/ntsimulator/scripts/tls/enable_ssh_key.sh
new file mode 100755 (executable)
index 0000000..5ed2868
--- /dev/null
@@ -0,0 +1,16 @@
+#! /bin/bash
+
+sleep 5
+
+SSH_PUB_KEY="$(cat /home/netconf/.ssh/id_dsa.pub| awk '{print $2}')"
+
+echo '<system xmlns="urn:ietf:params:xml:ns:yang:ietf-system"><authentication><user><name>netconf</name><authorized-key><name>ssh_key</name><algorithm>ssh-dss</algorithm>' >> load_auth_pubkey.xml
+echo '<key-data>'"$SSH_PUB_KEY"'</key-data></authorized-key></user></authentication></system>' >> load_auth_pubkey.xml
+
+sysrepocfg --merge=load_auth_pubkey.xml --format=xml ietf-system
+rm load_auth_pubkey.xml
+
+ssh-keyscan -p 830 localhost >> ~/.ssh/known_hosts
+
+echo 'Done'
+exit 0
\ No newline at end of file