ingredient/ssh: Show ssh keys in info
This commit is contained in:
parent
5bceaa0d47
commit
e91e9cb4d6
4 changed files with 41 additions and 0 deletions
|
|
@ -63,6 +63,11 @@ func (i info) Run(context wisski_distillery.Context) error {
|
||||||
context.Printf("Last Update: %v\n", info.LastUpdate.String())
|
context.Printf("Last Update: %v\n", info.LastUpdate.String())
|
||||||
context.Printf("Last Cron: %v\n", info.LastCron.String())
|
context.Printf("Last Cron: %v\n", info.LastCron.String())
|
||||||
|
|
||||||
|
context.Printf("SSH Keys: (count %d)\n", len(info.SSHKeys))
|
||||||
|
for _, key := range info.SSHKeys {
|
||||||
|
context.Printf("- %s\n", key)
|
||||||
|
}
|
||||||
|
|
||||||
context.Printf("Skip Prefixes: %v\n", info.NoPrefixes)
|
context.Printf("Skip Prefixes: %v\n", info.NoPrefixes)
|
||||||
context.Printf("Prefixes: (count %d)\n", len(info.Prefixes))
|
context.Printf("Prefixes: (count %d)\n", len(info.Prefixes))
|
||||||
for _, prefix := range info.Prefixes {
|
for _, prefix := range info.Prefixes {
|
||||||
|
|
|
||||||
|
|
@ -265,6 +265,21 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="pure-u-1-1">
|
||||||
|
<h2 id="ssh">SSH Keys</h2>
|
||||||
|
<table class="pure-table pure-table-bordered padding">
|
||||||
|
<tbody>
|
||||||
|
{{ range .Info.Keys }}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<code>{{ . }}</code>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{ end }}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="pure-u-1-1">
|
<div class="pure-u-1-1">
|
||||||
<h2 id="snapshots">Snapshots</h2>
|
<h2 id="snapshots">Snapshots</h2>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import (
|
||||||
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
"github.com/FAU-CDI/wisski-distillery/pkg/environment"
|
||||||
"github.com/FAU-CDI/wisski-distillery/pkg/sshx"
|
"github.com/FAU-CDI/wisski-distillery/pkg/sshx"
|
||||||
"github.com/gliderlabs/ssh"
|
"github.com/gliderlabs/ssh"
|
||||||
|
gossh "golang.org/x/crypto/ssh"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SSH struct {
|
type SSH struct {
|
||||||
|
|
@ -30,3 +31,20 @@ func (ssh *SSH) Keys() ([]ssh.PublicKey, error) {
|
||||||
}
|
}
|
||||||
return sshx.ParseAllKeys(bytes), nil
|
return sshx.ParseAllKeys(bytes), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sshx *SSH) Fetch(flags ingredient.FetchFlags, info *ingredient.Information) error {
|
||||||
|
if flags.Quick {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
keys, err := sshx.Keys()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
info.SSHKeys = make([]string, len(keys))
|
||||||
|
for i, key := range keys {
|
||||||
|
info.SSHKeys[i] = string(gossh.MarshalAuthorizedKey(key))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,9 @@ type Information struct {
|
||||||
// List of backups made
|
// List of backups made
|
||||||
Snapshots []models.Export
|
Snapshots []models.Export
|
||||||
|
|
||||||
|
// List of SSH Keys
|
||||||
|
SSHKeys []string
|
||||||
|
|
||||||
// WissKI content information
|
// WissKI content information
|
||||||
NoPrefixes bool // TODO: Move this into the database
|
NoPrefixes bool // TODO: Move this into the database
|
||||||
Prefixes []string // list of prefixes
|
Prefixes []string // list of prefixes
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue