-
Hello, I am trying to figure out how the Secrets functionality is meant to be used in Netbox. I get as far as being able to get the Secret instance, but unsurprisingly the apirole = SecretRole.objects.get(name='api')
apisecret = Secret.objects.get(role=apirole, assigned_object_id=switch.id)
self.log_success(f'Dumping secret data: {apisecret.plaintext}') If I go to Is this working as intended? If so, it seems to me that accessing Secrets in scripts is impossible by design. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
From a quick look at the code, to set the However, secrets are in the process of being removed into a plugin, so if you want to use them - especially via an API - you'd probably be better off using something like Hashicorp Vault. |
Beta Was this translation helpful? Give feedback.
From a quick look at the code, to set the
plaintext
attribute on the secret object, you need to call itsdecrypt
method, passing in the master key (which in turn you could get from decrypting a user key)However, secrets are in the process of being removed into a plugin, so if you want to use them - especially via an API - you'd probably be better off using something like Hashicorp Vault.