mirror of
https://github.com/hak5/nano-tetra-modules.git
synced 2025-10-29 16:58:09 +00:00
Add modules to repository
This commit is contained in:
34
KeyManager/scripts/copy_key.sh
Executable file
34
KeyManager/scripts/copy_key.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
[[ -f /tmp/KeyManager.progress ]] && {
|
||||
exit 0
|
||||
}
|
||||
|
||||
LOG=/tmp/keymanager.log
|
||||
HOST=`uci get keymanager.settings.host`
|
||||
PORT=`uci get keymanager.settings.port`
|
||||
USER=`uci get keymanager.settings.user`
|
||||
PASSWORD=$1
|
||||
|
||||
touch /tmp/KeyManager.progress
|
||||
|
||||
rm -rf ${LOG}
|
||||
|
||||
if ! grep -q ${HOST} /root/.ssh/known_hosts; then
|
||||
echo -e "Cannot find ${HOST} in known_hosts. Adding it now." > ${LOG}
|
||||
|
||||
ssh-keyscan -p ${PORT} ${HOST} > /tmp/tmp_hosts
|
||||
cat /tmp/tmp_hosts >> /root/.ssh/known_hosts
|
||||
|
||||
echo -e "Added the following to /root/.ssh/known_hosts:" >> ${LOG}
|
||||
cat /tmp/tmp_hosts >> ${LOG}
|
||||
fi
|
||||
|
||||
sshpass -p ${PASSWORD} /pineapple/modules/KeyManager/scripts/ssh-copy-id.sh -i /root/.ssh/id_rsa.pub -p ${PORT} ${USER}@${HOST}
|
||||
echo -e "Copied local public key to remote host." >> ${LOG}
|
||||
|
||||
rm /tmp/KeyManager.progress
|
||||
Reference in New Issue
Block a user