Skip to content

jen20/hostkeyparser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CloudInit Host Key Parser

This library parses SSH Host Keys from the output of CloudInit as provided by (for example) the AWS ec2 get-console-output command, in order that they can be used to verify host keys for SSH connections. Comments are removed from keys, though no validation of the actual keys is performed.

It is important to note that not all AMIs set the console correctly at boot time so this method is not 100% reliable, though if the output is present the parsing should succeed.

Usage

// Use the AWS SDK for this
consoleOutput := GetConsoleOutput("i-12345")
if consoleOutput == "" {
    // No console output to read
}

hostKeys, err := hostkeys.Parse(consoleOutput)
if err != nil {
    if err == hostkeys.ErrNoStartHostKeysBlock {
        // No host keys in console output
    }
}

// hostKeys is a []string with the keys in the same order as read from the console output.

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages