Skip to content

Instantly share code, notes, and snippets.

@thoward
Created September 25, 2013 09:19
Show Gist options
  • Save thoward/6697128 to your computer and use it in GitHub Desktop.
Save thoward/6697128 to your computer and use it in GitHub Desktop.
Create a three-box environment using vagrant-testbed. Generates unique ssh keys for each box and removes default vagrant keys.
#!/bin/bash
# make three boxes
BOXES=3 IP_START=60 vagrant up
# generate ssh keys
if [ ! -f /tmp/testbed1.pub ]; then
ssh-keygen -b 2048 -t rsa -f /tmp/testbed1 -P "" -C "testbed1"
fi
if [ ! -f /tmp/testbed2.pub ]; then
ssh-keygen -b 2048 -t rsa -f /tmp/testbed2 -P "" -C "testbed2"
fi
if [ ! -f /tmp/testbed3.pub ]; then
ssh-keygen -b 2048 -t rsa -f /tmp/testbed3 -P "" -C "testbed3"
fi
# install keys
scp -i ~/.vagrant.d/insecure_private_key /tmp/testbed1.pub [email protected]:~/.ssh/authorized_keys
scp -i ~/.vagrant.d/insecure_private_key /tmp/testbed2.pub [email protected]:~/.ssh/authorized_keys
scp -i ~/.vagrant.d/insecure_private_key /tmp/testbed3.pub [email protected]:~/.ssh/authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment