start building up a static list of ssh host keys

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 8bc0af30
#! /usr/bin/python3
import sys
import yaml
with open('list.yml') as f:
data = yaml.load(f)
class Host:
def __init__(self, d):
self.hostname = d['hostname']
self.ip = d['ip']
self.keys = d['keys']
for host in data:
try:
h = Host(host)
except KeyError as e:
print('Missing required key "{}"'.format(e), file=sys.stderr)
sys.exit(1)
for key in h.keys:
print('{},{} {}'.format(h.hostname, h.ip, key))
- hostname: jenkins.debian.net,jenkins
ip: 78.137.96.196
keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAVYP8sYSp95zWTMFVEbt6aw3RAyv+4tjNh/JfbsihXQ root@jenkins
- ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNE6RhNS1kjo2nlEMXzNM4G0fMB/AQECLiXZZVfKKyHnmPTj+bAAvf98vAJ5QpAT2+wt/nF9xSIPKVJNSnxoC2I= root@jenkins
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDklpU2iLalJONEFGJe42Sg2cISwCiDaq/nAEgIAnbDpnkyDC9PRUcsT3j72AWhoau0FUGcHxCUndTRNiz71M2nPyxyqOFMXpcQqlMnDdDzfOg41BCGnOHbTihtPtTiS4nRm3mQgT0fTMar367daWjpe0gQd0+h5Ec7y7N11iFUMKA6i70fePSS2vPtVMfsayMyHkH/hPWi2OFPP0WV9RLS/TH91KEy/oRb4MNEi10cfsERXpEAB+JLMtQZuhAwKNwAn54KuC1MThFOmgxw8/sCfYYlNpjSMgaBtgqxuoQMZbeGqiIYIj9IzbYwUST5EHfm6CNIvqqqmbz4k3MwRGkZ root@jenkins
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment