Skip to content

Instantly share code, notes, and snippets.

@cmattoon
Created February 14, 2019 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cmattoon/6ff83978ee7cdb24610383b1fadcaf70 to your computer and use it in GitHub Desktop.
Save cmattoon/6ff83978ee7cdb24610383b1fadcaf70 to your computer and use it in GitHub Desktop.
CVE-2019-5736 - Apply patch with Fabric
#!/usr/bin/env python
import os
from fabric import Connection
# kubectl get nodes | grep ip | cut -d'-' -f2,3,4,5 | cut -d'.' -f1 | sed 's/-/./g' | xargs echo | sed s'/ /",\"/g'
def getConnection(host):
return Connection(host=host,
user='admin',
connect_kwargs={
'key_filename': '/Users/cmattoon/keys/k8s-admin-key'
})
for host in hosts:
conn = getConnection(host)
conn.sudo('cp $(which docker-runc){,.$(date -I)}')
conn.run('curl -sL https://github.com/rancher/runc-cve/releases/download/CVE-2019-5736-build2/runc-v17.03.2-amd64 > /tmp/runc')
conn.sudo('chmod +x /tmp/runc')
conn.sudo('mv /tmp/runc $(which docker-runc)')
conn.run('docker-runc -v')
conn.sudo('docker info')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment