mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-13 05:50:33 +01:00
No Branch/Tag Specified
main
21102-fix-graphiql-explorer
update-changelog-comments-docs
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
v3.6.8
v3.6.7
v3.7-beta1
v3.6.6
v3.6.5
v3.6.4
v3.6.3
v3.6.2
v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.3
v2.7.2
v2.7.1
v2.7.0
v2.6.12
v2.6.11
v2.6.10
v2.6.9
v2.7-beta1
Solcon-2020-01-06
v2.6.8
v2.6.7
v2.6.6
v2.6.5
v2.6.4
v2.6.3
v2.6.2
v2.6.1
v2.6.0
v2.5.13
v2.5.12
v2.6-beta1
v2.5.11
v2.5.10
v2.5.9
v2.5.8
v2.5.7
v2.5.6
v2.5.5
v2.5.4
v2.5.3
v2.5.2
v2.5.1
v2.5.0
v2.4.9
v2.5-beta2
v2.4.8
v2.5-beta1
v2.4.7
v2.4.6
v2.4.5
v2.4.4
v2.4.3
v2.4.2
v2.4.1
v2.4.0
v2.3.7
v2.4-beta1
v2.3.6
v2.3.5
v2.3.4
v2.3.3
v2.3.2
v2.3.1
v2.3.0
v2.2.10
v2.3-beta2
v2.2.9
v2.3-beta1
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
v2.2.0
v2.1.6
v2.2-beta2
v2.1.5
v2.2-beta1
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
v2.0.10
v2.1-beta1
v2.0.9
v2.0.8
v2.0.7
v2.0.6
v2.0.5
v2.0.4
v2.0.3
v2.0.2
v2.0.1
v2.0.0
v2.0-beta3
v1.9.6
v1.9.5
v2.0-beta2
v1.9.4-r1
v1.9.3
v2.0-beta1
v1.9.2
v1.9.1
v1.9.0-r1
v1.8.4
v1.8.3
v1.8.2
v1.8.1
v1.8.0
v1.7.3
v1.7.2-r1
v1.7.1
v1.7.0
v1.6.3
v1.6.2-r1
v1.6.1-r1
1.6.1
v1.6.0
v1.5.2
v1.5.1
v1.5.0
v1.4.2
v1.4.1
v1.4.0
v1.3.2
v1.3.1
v1.3.0
v1.2.2
v1.2.1
v1.2.0
v1.1.0
v1.0.7-r1
v1.0.7
v1.0.6
v1.0.5
v1.0.4
v1.0.3-r1
v1.0.3
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
No Label
type: bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#42
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @candlerb on GitHub (Jun 28, 2016).
Netbox
66a16dd0under Ubuntu 14.04, built according to getting-started.mdI tried to create a secret for a device. It told me I needed to create a user key and navigated me to that place. So I generated a user key within the browser, and copy-pasted the private key to a local file.
I then tried again to add a secret to a device. It prompted me to paste my private key into the web interface - I did so.
But from then on, attempting to add a secret to a device just says:
"Invalid RSA key. Please ensure that your key is in PEM (base64) format."
I have tried:
I have never been prompted to paste my private key in again, but I still get the "Invalid RSA key" message. Inspecting the HTML page shows that the private key is in a hidden form variable. I'm not sure how this is being kept "sticky", but at very least logging out should clear it and require it to be re-entered when required.
Side issue: I would be a lot happier if this used GPG keys, not RSA keys. GPG is robustly-designed, whereas it's very easy to make an insecure system from low-level crypto primitives. I'm particularly unhappy about private keys being constantly pasted back-and-forth between web client and server.
GPG allows the same document to be encrypted for multiple recipients: effectively there is no global "master key" but rather each document contains its own session key, encrypted with multiple public keys.
This in turn means that it would be unnecessary to provide your private key into the web interface when adding a new device secret.
@ptman commented on GitHub (Jun 28, 2016):
In what format was your RSA key? According to http://fileformats.archiveteam.org/wiki/PEM_encoded_RSA_private_key it should be a plain text file with:
I agree with you that pasting a private key into the browser sounds like a less than fully thought out system. Have you looked at other team password storage systems? Such as rattic, webpasswordsafe or some commercial offerings? Can access be managed per user or group?
@candlerb commented on GitHub (Jun 28, 2016):
Exactly the format that the Netbox web interface generated it :-)
Actually I did originally try pasting in a GPG public key, but it was rejected; so I read the docs and then used the web interface to generate the public and private key pair. It has happily saved the public one in the database, and the private key is indeed in the format you showed.
Yep, passwordstore is a sound design with one GPG file per password in a directory tree; and GPG allows the same file to be encrypted to multiple recipients.
I am thinking that what we really want here is not just documentation of passwords, but the ability to use those passwords by other backend systems driven from Netbox (e.g. to ssh into a router, or make an SNMP query, or to connect to IPMI). GPG would make this straightforward and secure.
@candlerb commented on GitHub (Jun 28, 2016):
Update: after leaving my terminal for a bit to get lunch, and then trying to add a secret to a device, I got prompted for the private key, yay! (Some cookie has expired?)
So I pasted it in. Unfortunately I can now see that I pasted in had a line truncated; the result was "Invalid key detected: Incorrect padding".
I do have the correct key available, but no way to tell Netbox to ignore the bad key I gave it before!
I guess I'll have to leave it for a while to expire again. I tried changing SECRET_KEY and this forcibly logged me out, but it's still using the same cached private key.
@candlerb commented on GitHub (Jun 28, 2016):
Switched to a different browser (Firefox). That gave me another opportunity to paste in my private key, correctly this time.
Secret is created successfully - displays as asterisks.
However when I click the Unlock button it just changes to empty string
Now that I was able to create the secret in Firefox, returning to Chrome and displaying the Device did prompt me again for my key when I clicked Unlock. But again it displayed an empty secret.
So to summarise problems:
@jeremystretch commented on GitHub (Jun 28, 2016):
What is the response from the server when you click the "unlock" button? You can see this using the inspection tool (F12) in Firefox and selecting the Network tab. You should see a POST to
/api/secrets/secrets/{pk}/.@candlerb commented on GitHub (Jun 28, 2016):
Here's tcpdump output
I note
"plaintext": null@mhmsh commented on GitHub (Jun 30, 2016):
Same issue here.
@jeremystretch commented on GitHub (Jun 30, 2016):
Looks like your key isn't being included with the request. Could you please provide a capture of the request and response to confirm this? You can use the web developer toolkit in Firefox or Chrome to capture the request.
@candlerb commented on GitHub (Jun 30, 2016):
(Using Chrome). The key is definitely being included in the request.
Headers
General
Response headers
Request headers
Form data
View source:
View parsed:
Response
@jeremystretch commented on GitHub (Jul 6, 2016):
Sorry for the delay on this. I believe this is a permissions issue. Secrets are only decryptable by users who are permitted access by SecretRole (either individually or by group) and who have an active UserKey. Unfortunately, there is no error message in place to indicate the lack of permission.
If you edit the secret role in the admin UI under secrets > secret roles, you can assign your user (or a group of which your user is a member) to the role. This should grant you permission to decrypt the secret. Please let me know if that works.
@mhmsh commented on GitHub (Jul 7, 2016):
Yep, that did it. Its working now.
@candlerb commented on GitHub (Jul 7, 2016):
Thank you.
I am logged in as the "admin" user. In the django admin it's not entirely clear whether the admin user is enabled or not for this role:
But after selecting it and saving, it changes so that the user is highlighted in grey:
And it works after this.
So useful changes would be:
In fact, I'm surprised you can create a secret without being able to read it, because creating a secret implies you have access to the master key. If access control is managed at the level of secret roles, shouldn't each role have a separate key?
@jeremystretch commented on GitHub (Jul 7, 2016):
Further improvements:
edde021c85granted all superusers permission to decrypt all secrets, andc19124fcacadds a note to the documentation.@jeremystretch commented on GitHub (Jul 7, 2016):
There may be instances where you want a user to be able to create secrets but no decrypt them, for example a provisioning system that generates RADIUS keys.
Just to clarify, end users never have direct access to the master key.
This might be ideal, but may lead to performance problems. Deriving the master key is a (relatively) slow asymmetric decryption process, whereas decrypting individual secrets is very fast.
In the current scheme, only one key needs to be derived to enable decryption of all secrets. If we kept a separate key for each role, we'd need to decrypt a key for each role in the list of secrets to be decrypted. This could lead to long delays when decrypting secrets belonging to many different roles.
It may be worth taking another look at the permissions around secrets, but we've breached the original topic of this issue, so I'm going to mark it as closed.
@bogdanstoica35 commented on GitHub (Oct 4, 2016):
In my case it is not working. I have created a group with all the permission and added my user to that group. I have added both my user and the group to the secret roles but I am still getting this error: Invalid private key! Unable to encrypt secret data.
I am using the latest netbox version cloned from github.
Any clues?!
@eronlloyd commented on GitHub (Oct 26, 2016):
@bogdanstoica35: I added all the Secrets permissions to a group and then assigning it to my user, it worked. I'm on 1.6.3. HOWEVER, while I was able to encrypt, but now I'm getting an error trying to decrypt. So I'm still having issues.
UPDATE: After just adding a few more, now it's working properly and I can view the secrets. Seems like there's still some reliability testing needed between storing the private key and the UI to view the data?
@bogdanstoica35 commented on GitHub (Oct 27, 2016):
It is working now, but only after upgrading to the latest version from github. Also, previously it was only working on Firefox. Now it works both on Chrome and Firefox.