Teleport dynamic labels lacking documentation / adhoc cmd examples


#1

Dynamic labels using commands without the need for .sh scripts to be dropped on the sys.

I would have expected the ability to run adhoc command such as;
["facter --json os |jq -r .os.name"]

instead i get startup/output errors. there is little to no documentation about the expected format of a command. please could this be updated?

  commands:
  - name: os
    command: ["/usr/bin/facter --json os | jq -r .os.name"]
    period: 1h0m0s

Teleport: Teleport Enterprise v3.1.0git:v3.1.0-0-g538656a5 go1.11.1
Ubuntu: 16.04


#2

I don’t think that pipe will work, because we are not launching a shell, we are launching fork/exec

So your example could be

 commands:
  - name: os
    command: ["/bin/sh", "-c", "/usr/bin/facter --json os | jq -r .os.name"]
    period: 1h0m0s

Or instead you could write a little shell script that will do all the shell things

 commands:
  - name: os
    command: ["/bin/myscript"]
    period: 1h0m0s

#3

Quick Update, this section https://gravitational.com/teleport/docs/admin-guide/#labeling-nodes now contains more examples to address this question.