I am stuck in a slightly annoying situation.
There is a chain of machines between my desktop and production servers. Something like that:
desktop -> firewall 1 -> firewall 2 -> prod_box 1 -> prod_box 2 -> ...
I am looking for a way to automate deployment in prod boxes via ssh.
I know that in general there are a number of solutions, but my limitations are:
- Changes to the firewall not allowed 2
- No configuration changes allowed for prod windows (content only)
- Firewall 1 has a local account for me
- firewall 2 and prod are available as root
- port 22 is the only open port between each link
So, in the general case, the sequence of commands that I execute for deployment is:
scp archive.tar user@firewall1 :archive.tar ssh user@firewall1 scp archive.tar root@firewall2 :/tmp/archive.tar ssh root@firewall2 scp /tmp/archive.tar root@prod1 :/tmp/archive.tar ssh root@prod1 cd /var/www/ tar xvf /tmp/archive.tar
This is a bit more complicated than itβs in reality, but this is the main summary of the tasks that need to be completed.
I put my ssh key in firewall1: /home/user/.ssh/authorized_keys, so no problem.
However, I cannot do this for firewall2 or prod packages.
It would be great if I could run this (the commands above) from the shell script locally, enter my password 4 times and do it with it. Unfortunately, I cannot figure out how to do this.
I need to somehow bind ssh commands. I spent all day trying to use python for this, and eventually refused, because the ssh libraries did not seem to support password-style input.
What can i do here?
There must be some kind of library that I can use for:
- login via ssh using either a key file or dynamically entered password
- remote shell remote commands through ssh tunnel chain
I'm not quite sure what to flag this question, so I just left it as ssh, deployment for now.
NB. It would be great to use ssh tunnels and the deployment tool to push these changes out, but I still have to manually go into each box to configure the tunnel, and this will not work anyway due to a port lock.