Skip to content

Instantly share code, notes, and snippets.

@neilellis
Last active August 29, 2015 14:06
Show Gist options
  • Save neilellis/7b7a753b92fb3dba5c32 to your computer and use it in GitHub Desktop.
Save neilellis/7b7a753b92fb3dba5c32 to your computer and use it in GitHub Desktop.
Gets rid of shellshock on Digital ocean + Ubuntu by running security updates in parallel - requires tugboat to be installed first.
#!/bin/bash -eu
function fixIt() {
ip=$1
if ssh -o "StrictHostKeyChecking no" root@${ip} "env X='() { (a)=>\' bash -c \"echo date\"; cat echo" | grep 2014
then
ssh -o "StrictHostKeyChecking no" root@${ip} "apt-get install -y unattended-upgrades; apt-get update; unattended-upgrades; rm echo"
else
echo $ip passed
fi
}
export -f fixIt
tugboat droplets | cut -d":" -f2| tr -d ')' | cut -d, -f1 | tr -d ' ' | parallel --gnu -P 64 --no-run-if-empty "fixIt {}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment