I'm trying to manage OpenSSH's authorized_keys using cfengine.
It's easy to add/delete special lines in authorized_keys, but I cannot figure out how to delete unwanted lines.
e.g. I need to add pubkey_one, pubkey_two, pubkey_three to authorized_key, then delete any lines not listed above.
Any help or hint would appreciated :-)
For this particular case, I think the easiest would be to use
edit_defaults => empty, so that CFEngine starts from an empty file. Something like this:Note that
body edit_defaults emptyis defined in cfengine_stdlib.cf, so you need to include it in yourinputs.