Shocktrooper: mass server patching for shellshock
github.com
github.com
Though maybe I'm just disappointed that it doesn't log in via shellshock as I hoped from the title.
It's super-simple (wrote it for this answer), but should be less than 5 min if anyone need something quick.
from fabric.api import *
# Fabric
#
# Simple tool to execute commands on multiple machines.
# Use for easier, ad-hoc changes, such as package updates.
#
# http://docs.fabfile.org
#
# Installation on OS X
# `brew update && brew install python && pip install fabric`
# use local ssh config
env.use_ssh_config = True
# Hard-coding host IPs is not ideal! There are better ways:
# http://docs.fabfile.org/en/latest/usage/execution.html#defining-host-lists
all_nodes = [
'10.10.10.1',
'10.10.10.2',
]
# print uptime
# usage: `fab uptime`
@hosts(all_nodes)
def uptime():
run('uptime')
# install package via apt
# usage: `fab install_package:my-package-name`
@hosts(all_nodes)
def install_package(package):
run('sudo apt-get update && sudo apt-get install {name}'.format(name=package))
# check package version
# usage: `fab package_version:my-package-name`
@hosts(all_nodes)
def package_version(package):
run('dpkg -s {name} | grep Version'.format(name=package))See the following tweet: https://twitter.com/alexandermensa/status/514811145887027201