Skip to content

Commit

Permalink
support token %k #158
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnywong committed Nov 30, 2024
1 parent 6145612 commit 95210d5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tssh/tokens.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ func expandTokens(str string, args *sshArgs, param *sshParam, tokens string) (st
hashStr += param.proxy[len(param.proxy)-1]
}
buf.WriteString(fmt.Sprintf("%x", sha1.Sum([]byte(hashStr))))
case 'k':
if hostKeyAlias := getOptionConfig(args, "HostKeyAlias"); hostKeyAlias != "" {
buf.WriteString(hostKeyAlias)
} else {
buf.WriteString(args.Destination)
}
default:
return str, fmt.Errorf("token [%%%c] in [%s] is not supported yet", c, str)
}
Expand Down

0 comments on commit 95210d5

Please sign in to comment.