telegraf icon indicating copy to clipboard operation
telegraf copied to clipboard

Signing telegraf output with a host-specific key, so that the metrics cannot be spoofed

Open poulhs opened this issue 3 years ago • 3 comments

Use Case

On each telegraf client, we can provide a certificate to be used to sign the line-protocol. On the telegraf agent that inserts the data into the InfluxDB, we can verify that signature.

This will improve the data-integrity as the metrics no longer can be spoofed from another host.

As the line-protocal is passed upstream with TLS, no further encryption is needed.

This will play well with the ABAC in InflxuDB 3.0

Expected behavior

1a) On host foo.bar.example

``disk,host=foo.bar.example,label=vg0-Root,mode=rw,path=/,signature=KKKFrpergXrlKKK,signature-key-type=rot13 ...,used_percent=99.9999 1711972800000000000

1b) On host not.bar.example (with another key) :

``disk,host=foo.bar.example,label=vg0-Root,mode=rw,path=/,signature=KKKVainyvqXrlKKK,signature-key-type=rot13 ...,used_percent=1.1111 1711972800000000000

(This may be caused by a bogus configuration (setting wrong hostname explicit in /etc/telegraf/telegraf.conf) or by malicious attacker - emiting line-protocol by whatever means)

  1. On central host that consumes line-protocol indirectly from the above hosts and inserts the data in InfluxDB:

2a) insert metrics from foo.bar.example into InfluxDB as expected

2b) and make a lot of noise and NOT inserting the data from not.bar.example (as they CLAIM to be from host=foo but do not have the correct signature)

Actual behavior

Both metrics are inserted into the InfluxDB for the host "foo.bar.example". (in the worst case spoofed value will overwrite the correct).

So the disk-usage values may be incorrect and alarms may not be triggered (or false alarms may be triggered (depending on the spoofed values)

Graphs and reports presented to the owner of the host will be misleading

Additional info

Some things to consider...:

  1. Update the key-file on a host - that would change the signature.
  2. What if a host is reinstalled - it will get a new key, but same hostname
  3. Maybe it is enough to just sign the "host=foo.bar.example" part - A host always has the possible to lie about itself, and that is not what we need to solve here.
  4. Maybe one could trust the first certificate from the host (i.e. if we have seen you before we trust your key to be yours)
  5. A way to configure what to do with metrics that has NO key (accept/drop)

poulhs avatar Sep 10 '23 13:09 poulhs

Hi @poulhs,

Implementing a message signing and verification service is out of scope of the Telegraf project. If a user needs to harden the passing of communications then the usage of a input with authentication is our preferred option.

However, @srebhan and I wanted to play with the idea yesterday. If we were to entertain this proposal we would not implement this in a parser, input, or output, but create a processor plugin: one to sign the content of the entire metric as input and add the signature as a tag and a second to validate a metric based on the signature.

Right away this would introduce some limitations as during signing no additional changes to the metric would be possible with additional processors or during the output. And likewise the processor to validate the message would need to be the first thing to occur and would prevent the user from doing any type of filtering or modification at the input stage as well.

Any feature like this would also need to be explicitly configured. The user would need to set the private and public keys in their config hard-coded, nothing would be dynamic. Updating a key or redeploying a system would require an update to the config in both the signing system and the verification system.

Finally, all these limitations will result in follow-up requests for exceptions or different changes that users would want. For example, maybe they want to include exclude specific fields, use different types of keys/certs, etc. Leading to a larger and larger feature to maintain.

We are still curious to hear your thought as well, but this is not something we are inclined to add.

powersj avatar Sep 12 '23 16:09 powersj

I have to focus on an ongoing major issue concerning out meta-nodes in influxdb enterprise. But I will return to this issue ASAP!

poulhs avatar Sep 19 '23 07:09 poulhs

Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Forums or provide additional details in this issue and reqeust that it be re-opened. Thank you!

telegraf-tiger[bot] avatar Oct 03 '23 18:10 telegraf-tiger[bot]