question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug]: error RSA PRIVATE KEY not found from openssl output

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Firefox
  • Local OS: Windows 10
  • Remote OS: Ubuntu 22.04 LTS Server
  • Remote Architecture: arm64
  • code-server --version: 4.3.0

Steps to Reproduce

  1. Install using installer script
  2. Modify config to:
bind-addr: 0.0.0.0:443
auth: password
password: ...
cert: true
  1. Read logs of service

Expected

code-server should start up normally.

Actual

code-server fails to start-up with error message in logs as seen below.

Logs

May 05 11:25:56 ubuntu code-server[17012]: [2022-05-05T11:25:56.314Z] error RSA PRIVATE KEY not found from openssl output: May 05 11:25:56 ubuntu code-server[17012]: —stdout— May 05 11:25:56 ubuntu code-server[17012]: -----BEGIN PRIVATE KEY----- May 05 11:25:56 ubuntu code-server[17012]: MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDBtlEnZLssezit May 05 11:25:56 ubuntu code-server[17012]: … May 05 11:25:56 ubuntu code-server[17012]: 85ApfDxbNKRPXB24sszXjhWI3A== May 05 11:25:56 ubuntu code-server[17012]: -----END PRIVATE KEY----- May 05 11:25:56 ubuntu code-server[17012]: —stderr— May 05 11:25:56 ubuntu code-server[17012]: code: 0

Screenshot/Video

No response

Does this issue happen in VS Code?

  • I cannot reproduce this in VS Code.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

This could be related: https://githubhot.com/repo/Chocobozzz/PeerTube/issues/4901, Ubuntu 22.04 LTS Server was running OpenSSL Version 3.0.2.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

5reactions
Newtonianocommented, Aug 13, 2022

Any clue on when this will be fixed? Doesn’t seem like there is much progress on pem side. The workaround I’m currently using is manually generating valid keys with mkcert , and passing those in code-server config.yaml . It works very well and it’s probably the easiest thing to do until this gets fixed

Hi @Newtoniano could you please explain how I can do this in simple steps? I apologize but I’m fairly new to this any assistance is greatly appreciated.

Sure @DNAMcKnight , I’m not a super expert myself but after many attempts I managed to get it to work for me.

  1. Read mkcert 's install instructions and install it on the machine that’s supposed to run code-server. Choose the method you prefer from the instructions, in my case on linux I first installed certutil with my package manager and then used the instructions for the precompiled binaries (didn’t really want to install another package manager like homebrew just for mkcert).
  2. Install the CA Authority by typing mkcert -install
  3. Navigate to a folder where you’d like to store the certificates you’re gonna generate, and then once inside type mkcert your_machine_ip 127.0.0.1 . You can type more addresses after that, any domain names you might want to use to reach the machine from your local network, if you need for example to access code-server from other devices. If what I suggested doesn’t work, just experiment withmkcert inside that folder and insert any IP’s and hostnames afterwards with spaces between each other, until you generate some certificates that work for your use case.
  4. Mkcert has now generated two .pem files inside that folder. Now edit the code-server config file with nano ~/.config/code-server/config.yaml (or whatever the path to the code-server file is on your machine) and add the following two lines (customized for your specific case)cert: path_to_your_cert_folder/cert_name.pem and cert-key: path_to_your_cert_folder/cert_name-key.pem . Save and close.
  5. Restart code server.

My configuration is slightly different from this, so what I told you might not work for you because that’s not exactly how mine is set up and I can’t really check if everything I said is 100% correct right now (probably not, this stuff is complicated if you haven’t much experience with it), so you’d have to experiment a little bit especially with what addresses you pass exactly to mkcert when generating the certificates. But you should be able to get it to work, in general this is the correct workflow. Tagging @GuilhermeSCLima in case he is still stuck on this step.

3reactions
Newtonianocommented, Jun 25, 2022

Any clue on when this will be fixed? Doesn’t seem like there is much progress on pem side.

The workaround I’m currently using is manually generating valid keys with mkcert , and passing those in code-server config.yaml . It works very well and it’s probably the easiest thing to do until this gets fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenSSL not creating a key file from a RSA private key
It says to create a RSA private key and from this create a key file and after that generate a certificate. But I...
Read more >
What can I do if I'm getting an RSA Private Key is invalid error ...
If you are getting an RSA Private Key is invalid error when you try adding your .key file under Server > HTTPS &...
Read more >
For valid PEM I get unable to load private key by openssh
The issue is that ssh-keygen generates an SSH key, while openssl rsa doesn't read SSH keys - it can read PKCS#1 or PKCS#8....
Read more >
openssl unable to read/load/import SSL private key from ...
I recently ran into an interesting problem using openssl to convert a private key obtained from GoDaddy.
Read more >
OpenSSL Tips and Tricks - Command Line Fanatic
openssl req -x509 -newkey rsa:2048 Generating a 512 bit RSA private key . ... This will output the certificate to stdout, which is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found