Skip to content

Commit

Permalink
feat: add the ssh public-key to the json list output
Browse files Browse the repository at this point in the history
  • Loading branch information
josegonzalez committed Feb 26, 2025
1 parent 939d227 commit d93efd2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sshcommand
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ sshcommand-list() {

if [[ -n "$OUTPUT_TYPE" ]] && [[ "$OUTPUT_TYPE" == "json" ]]; then
data=$(sed --silent --regexp-extended \
's/^command="FINGERPRINT=(\S+) NAME=(\\"|)(.*)\2 `.*",(\S+).*/{ "fingerprint": "\1", "name": "\3", "SSHCOMMAND_ALLOWED_KEYS": "\4" }/p' \
's/^command="FINGERPRINT=(\S+) NAME=(\\"|)(.*)\2 `.*",(\S+) (.*)/{ "fingerprint": "\1", "name": "\3", "SSHCOMMAND_ALLOWED_KEYS": "\4", "public-key": "\5" }/p' \
"$userhome/.ssh/authorized_keys" | tr '\n' ',' | sed '$s/,$/\n/')

if [[ -n "$NAME" ]]; then
Expand Down

0 comments on commit d93efd2

Please sign in to comment.