Live data from Hacker News

Shocktrooper: mass server patching for shellshock

github.com

11–12 of 12 posts

Re: Shocktrooper: mass server patching for shellshock

#11
post #6

I don't really understand the point of this. Aren't there already simple tools that take a list of server credentials and run the same command on all of them? (I could understand if it was made for fun but the FAQ says it's "out of necessity" and patching multiple distros can be a "nightmare". How? Just attempt to execute apt and yum everywhere.) Though maybe I'm just disappointed that it doesn't log in via shellshoc…

For those wondering, "What simple tools take a list of server credentials and run the same command on all of them?", Fabric is a great one: http://www.fabfile.org/en/latest/

Fabric is a great suggestion! Here is a small fabfile as an example.

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))
Post reply on HN