Skip to content

Instantly share code, notes, and snippets.

@djoreilly
djoreilly / meta_svr.py
Last active November 5, 2024 02:20
Metadata server to allow booting cloud-init images on Libvirt
"""
Server to answer requests from Libvirt VMs to http://169.254.169.254/
Cloud images usually don't have a preset user/password, and this is needed to add a ssh pub key to .ssh/authorized_hosts.
Change SSH_PUB_KEY path below.
pip install bottle
sudo ip address add 169.254.169.254 dev virbr0
open firewall
-A ufw-user-input -s 192.168.122.0/24 -d 169.254.169.254/32 -i virbr0 -p tcp -m tcp --dport 80 -j ACCEPT