Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check_csr.sh #104

Merged
merged 1 commit into from
Feb 1, 2024
Merged

Add check_csr.sh #104

merged 1 commit into from
Feb 1, 2024

Conversation

aaronpkahn
Copy link
Collaborator

Description

Adds a simple script to validate CSR submissions

Type of change

  • Documentation update

Checklist:

Confirm you have completed the following steps:

  • I have made corresponding updates to the documentation.

Copy link
Collaborator

@agbpatro agbpatro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NICE

@aaronpkahn aaronpkahn merged commit 613041e into main Feb 1, 2024
3 checks passed
@aaronpkahn aaronpkahn deleted the akahn/check_csrs branch February 1, 2024 23:52
@jbanyer
Copy link

jbanyer commented Feb 2, 2024

@aaronpkahn cool script, but it's giving me an error. I'm on a Macbook.

% openssl req -out tesla.chqtest.net.csr -key ~/garnet/keys/tesla-api/tesla.chqtest.net/com.tesla.3p.key.pem -subj /CN=tesla.chqtest.net/ -new

% cat tesla.chqtest.net.csr 
-----BEGIN CERTIFICATE REQUEST-----
MIHWMH4CAQAwHDEaMBgGA1UEAwwRdGVzbGEuY2hxdGVzdC5uZXQwWTATBgcqhkjO
PQIBBggqhkjOPQMBBwNCAAR4UUCCeq2kTehcBLSlmwl3DfEimd4PQhKLA5PUqekz
F6FradBOWa5StLZgCqbEngf6p+YTFSVPIqPK6rU1kggQoAAwCgYIKoZIzj0EAwID
SAAwRQIhAOpVBBg1zyaD6mCyU9dq1tt5XNw+x9lBfcXfmBXN0Q7wAiBh6P5OyUvN
fHCPvdIGZD4CzC6Thgme/Jjhn0lVuw8NZg==
-----END CERTIFICATE REQUEST-----

% ./tools/check_csr.sh tesla.chqtest.net.csr                                                                                                  
----
CSR: tesla.chqtest.net.csr
Host: subject=CN = tesla.chqtest.net
curl: (3) URL rejected: Malformed input to a URL function
Could not retrieve https://subject=CN = tesla.chqtest.net/.well-known/appspecific/com.tesla.3p.public-key.pem

Is there a bug in the script or have I done something wrong? My CSR creation command comes from the instructions at https://developer.tesla.com/docs/fleet-api#fleet-telemetry

@Bre77
Copy link

Bre77 commented Feb 2, 2024

The check script also didnt work for me, and I generated my CSR using the provided openssl instruction. the SED command does not account for whitespace.

openssl req -in teslemetry.com/teslemetry.com.csr -subject -noout | sed 's/subject=[\/]*CN=//'
subject=CN = teslemetry.com

It should be
s/subject=[\/]*CN\s*=\s*//

Raised #105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants