I want to ssh to my bastion host and run some commands. How I can ssh to bastion using circle ci?
Hi @RohitEverestek! Welcome to the CircleCI Community!
You could then SSH in to your bastion host, and run any commands that you want!
Let me know if you have any additional questions.
Below is the command I use within my own scripts, as I use self hosted runners it was coded without using the circleci key store, but it does show how simple the process is
deploy_to_target: parameters: target_system: type: string ssh_port: type: string steps: - run: name: Reload container on target system command: | echo "$SECURITY_SSH_CIRCLECI_KEY" > private_key chmod 600 private_key ssh -o StrictHostKeyChecking=no -i private_key -p <<parameters.ssh_port>> -o ConnectTimeout=10 circleci@<<parameters.target_system>> reload-backend ssh -o StrictHostKeyChecking=no -i private_key -p <<parameters.ssh_port>> -o ConnectTimeout=10 circleci@<<parameters.target_system>> display-system-stats rm private_key
The target is configured so that a known script is run when the ssh session is opened. This script is then passed the parameter “reload-backend” or “display-system-stats” and then executes the task - this is a way to provide a higher level of security on the target, instead of just providing access to a full shell.