+ # lines can now be prepended with "allowed_hosts=machine1,machine2 "
+ machines = []
+ if Str.startswith("allowed_hosts="):
+ Str = Str.split("=", 1)[1]
+ if ' ' not in Str:
+ return "invalid ssh key syntax with machine specification"
+ machines, Str = Str.split(' ', 1)
+ machines = machines.split(",")
+ for m in machines:
+ if not m:
+ return "empty machine specification for ssh key"
+ if not machine_regex.match(m):
+ return "machine specification for ssh key contains invalid characters"
+ if m not in ValidHostNames:
+ return "unknown machine used in allowed_hosts stanza for ssh keys"
+