User Tools

Site Tools


computing:remote-upgrades

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
computing:remote-upgrades [2019/06/16 03:42] oemb1905computing:remote-upgrades [2020/01/27 20:42] (current) oemb1905
Line 19: Line 19:
      
 Once that is done, put in some parameters that will provide nice feedback to you while you execute the command from primary workstation: Once that is done, put in some parameters that will provide nice feedback to you while you execute the command from primary workstation:
-  +
   #!/bin/bash   #!/bin/bash
 +  echo "I am beginning";
 +  cat /etc/motd
   apt update   apt update
   apt dist-upgrade   apt dist-upgrade
   apt autoremove   apt autoremove
   apt autoclean   apt autoclean
-  echo "I just finished updating";+  echo "I just finished"; 
 +  echo "----->" 
 +  echo "-----> ----->" 
 +  echo "-----> -----> ----->" 
 +  echo "-----> -----> -----> ----->" 
 +  echo "-----> -----> -----> -----> -----> ... ... "
   hostname   hostname
   date   date
   uname -a   uname -a
   echo "If there is another, I will begin that now ...";   echo "If there is another, I will begin that now ...";
 +  sleep 10s
  
 Edit sudoers so that this command can be run on target without password, (or, if your prefer, do not do this, and then you can enter the password for each target as the primary workstations script executes): Edit sudoers so that this command can be run on target without password, (or, if your prefer, do not do this, and then you can enter the password for each target as the primary workstations script executes):
Line 36: Line 44:
    
 Add the following to the file, obviously changing "username" to the target machine's user name.  Add the following to the file, obviously changing "username" to the target machine's user name. 
-  +   
-  ''username ALL=(root) NOPASSWD: /usr/local/bin/apt-remote'' +  username ALL=(root) NOPASSWD: /usr/local/bin/apt-remote 
- +   
-Now you are ready to create the script on the primary workstation that will pass the apt-remote script to the target workstations:+Now you are ready to create the script on the primary workstation (localhost) that will pass the apt-remote script to the target workstations:
  
   sudo touch /usr/local/bin/apt-remote-update.sh   sudo touch /usr/local/bin/apt-remote-update.sh
Line 48: Line 56:
 In the file that opens, use the following script parameters or something similar.  This script runs on the primary workstation and then executes the "sudo apt-remote" script on the target machine.  Again, none of this will work if your ssh is improperly configured.  In the file that opens, use the following script parameters or something similar.  This script runs on the primary workstation and then executes the "sudo apt-remote" script on the target machine.  Again, none of this will work if your ssh is improperly configured. 
      
-hostsa="haackremote.mooo.com lthsf.mooo.com" 
-#run on each host 
-for i in $hostsa; 
-do 
-  echo "I will now update" $i; 
-  ssh -t -p 60000 $i sudo apt-remote; 
-done; 
- 
-And here is how I adjusted the primary workstation script to do this with a remote host that requires an openvpn connection to be established first: 
- 
   #!/bin/bash   #!/bin/bash
-  cd /home/wsuser/zion/client-recs/client/vpn-client-name +  hosts="server.com 10.55.55.9" 
-  sudo openvpn hostname.mooo.com.ovpn & +  #run on each host 
-  sleep 10s +  for i in $hosts;
-  hostsa="10.44.44.19 10.44.44.85+
-  for i in $hostsa;+
   do   do
     echo "I will now update" $i;     echo "I will now update" $i;
-    ssh -t -p 59999 targetuser@$i sudo apt-remote;+    #ssh -t $i sudo apt-remote; 
 +    ssh -t $i screen -S aptremotescreen sudo apt-remote;
   done;   done;
-  cd ~ 
-  sudo killall openvpn 
-  sleep 10s 
  
-These configs an be found on the haackingclub gitlab repository over here +If you would prefer to do these types of backups with a vpn connection (instead of port forwarding), then use something like these configurations below. 
 + 
 +Option 1 - Using vpn connection, connect from localhost to remote host/server with ssh and screen, and then execute a script on the server that uses rsync over ssh to send its backup to target backup host on its LAN: 
 + 
 +Use this script on your localhost: [[https://repo.haacksnetworking.com/oemb1905/haackingclub/blob/master/backups/option1/localhost.sh|localhost.sh]] 
 +Use this script on the remote host that you are backing up: [[https://repo.haacksnetworking.com/oemb1905/haackingclub/blob/master/backups/option1/remote.sh|remote.sh]] 
 + 
 +Option 2 - Using vpn connection, connect from localhost to remote host/server with ssh and screen, and then execute a script on the server that uses rsync over ssh to send its backup back to you at localhost:
  
-  * [[https://codetalkers.services/oemb1905/haackingclub/|Haacking Club]]+Use this script on your localhost: [[https://repo.haacksnetworking.com/oemb1905/haackingclub/blob/master/backups/option2/localhost.sh|localhost.sh]]
      
- --- //[[netcmnd@jonathanhaack.com|oemb1905]] 2019/06/15 21:41//+ --- //[[jonathan@haacksnetworking.com|oemb1905]] 2020/01/27 13:18//
computing/remote-upgrades.1560656576.txt.gz · Last modified: 2019/06/16 03:42 by oemb1905