mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-14 06:13:32 +01:00
Invalid private key - secrets #3162
Closed
opened 2025-12-29 18:26:14 +01:00 by adam
·
4 comments
No Branch/Tag Specified
main
21142-device-component-graphql-filters
21050-device-oob-ip-may-become-orphaned
21102-fix-graphiql-explorer
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
v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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
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#3162
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 @squigley on GitHub (Jan 15, 2020).
Environment
Steps to Reproduce
Expected Behaviour
System would accept my private key matching the public key in the profile, give me a session key, and allow me to save the secret.
Observed Behaviour
Just keeps prompting for the private key.
Using the dev tools I see that in response to submitting the private key, I am getting a 400 error, with the text "Invalid Private Key."
It doesn't matter what format I try submitting the private key, eg including the BEGIN/END lines etc, and with the encoded body as one long line, or split after x number of characters, every attempt is invalid.
I was having this issue with 2.6.7, so I upgraded to 2.6.12, deleted the public key from the profile, readded it, but there was no change. I have tried using both Firefox and Chrome, and both fail.
@hSaria commented on GitHub (Jan 15, 2020):
I tried to recreate this but wasn't able to. What do you mean by preexisting, like one you've generated elsewhere? If you navigate to
/user/user-key/, does it say that the user key is active?Here's a dummy private and public key pair. It works with those
private
Generated with
openssl genrsa -out private.pem 2048public
Generated with
openssl rsa -in private.pem -outform PEM -pubout -out public.pem@squigley commented on GitHub (Jan 15, 2020):
Oh. I was trying to use my existing SSH private and public keys, and while it is an RSA key, I guess it is not in the PEM format which is required.
After using your generation commands to create a new private and public key in PEM format, and loading them into Netbox, I now get "session key received!" and am able to create and unlock secrets.
Can I suggest that the Secrets documentation page at https://netbox.readthedocs.io/en/stable/core-functionality/secrets/ be modified to add a note that SSH keys can't be used, or if they can, how to convert them into the correct format?
I think I got lead down the wrong path when I read the line "you can either generate a new RSA key pair, or upload the public key belonging to a pair you already have.", and I presumed this meant I could use my existing SSH key pair.
Thanks for the quick reply, which resolved my issue.
@jeremystretch commented on GitHub (Jan 15, 2020):
I'm going to treat this as a bug, since we should be validating the key format on input. (But the docs also need to be improved.)
@squigley Would you mind generating a new key pair in the same format as the one you tried and posting it here to assist with testing? I'm pretty sure I know what's going on but it would help to be sure.
@squigley commented on GitHub (Jan 15, 2020):
Sure, the keypair I was trying to use was one which was generated by "ssh-keygen", with no parameters. eg:
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/squigley/.ssh/id_rsa): /tmp/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /tmp/id_rsa.
Your public key has been saved in /tmp/id_rsa.pub.
The key fingerprint is:
SHA256:K/717DPH8CaAuoRhpoaxCtGwBX0bU9rw5vOMVobJoBg squigley@9K771Z2L
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
NhAAAAAwEAAQAAAYEA81rv3gmBjbyhNY33qDyM1vpVZ1sUSL5QGpxb23X21+et7Edkn5SG
FCOeeWXAA2FJRdNHOjk62qnu9+ABgzHtqO+Jp9gch8EWBpyTEaQcxA91cR0aio7AjgzOON
Kl8C1p8JpMUC6O9Rh+ulJn8l+vAl9sCOvOEEV6XpZIpAGcx7ptiHESIQbNhNcLcU1JAVJB
8XMbsdhJGUTpvkKINNKY0t9W57GluTYrSTiSJhwle3u7IqwF0nMfDDu5qJyY+U9N4OndIL
nBDw0v+pQYBYaWfT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