]> git.saurik.com Git - apple/security.git/blob - sec/SOSCircle/CloudKeychainProxy/scripts/soscopysshkeys
Security-55471.tar.gz
[apple/security.git] / sec / SOSCircle / CloudKeychainProxy / scripts / soscopysshkeys
1 #!/bin/zsh
2
3 echo 'Copying ssh keys to devices'
4
5 sshopts=(-o CheckHostIP=no -o StrictHostKeyChecking=no -o NoHostAuthenticationForLocalhost=yes -o UserKnownHostsFile=/dev/null)
6
7 locations=(`mobdev list | awk '/UDID/ { gsub(/^(.*location ID = )+|(,.*)+$/, ""); print}'`)
8
9 port_offset=20000
10
11 mkdir -p /var/tmp/roothome/.ssh/
12 cat ~/.ssh/id_*.pub > /var/tmp/roothome/.ssh/authorized_keys
13
14 for location in $locations
15 do
16 echo 'Copying to location '"$location"
17
18 tcprelay --portoffset $port_offset --locationid $location ssh --quiet &
19
20 (( sshport = $port_offset + 22 ))
21
22 echo "Copying file to device (via port $sshport)"
23 scp -r -P $sshport $sshopts /var/tmp/roothome/.ssh root@localhost:/var/root/
24
25 kill -HUP %%
26 done