NuSkooler / enigma-bbs

ENiGMA½ BBS Software
https://nuskooler.github.io/enigma-bbs/
BSD 2-Clause "Simplified" License
529 stars 104 forks source link

Cannot parse privateKey #540

Closed dream7prod closed 1 month ago

dream7prod commented 1 month ago

Describe the Bug After following the config.hjson instructions to generate a private key for ssh connection I got the following error :

2024-06-14 16:39:23 Error initializing: Error: Cannot parse privateKey: Unsupported key format 2024-06-14 16:39:23 at new Server (/enigma-bbs/node_modules/ssh2/lib/server.js:249:15) 2024-06-14 16:39:23 at SSHServerModule.createServer (/enigma-bbs/core/servers/login/ssh.js:396:23) 2024-06-14 16:39:23 at /enigma-bbs/core/listening_server.js:39:36 2024-06-14 16:39:23 at /enigma-bbs/core/module_util.js:120:28 2024-06-14 16:39:23 at loaded (/enigma-bbs/core/module_util.js:93:20) 2024-06-14 16:39:23 at loadModuleEx (/enigma-bbs/core/module_util.js:76:12) 2024-06-14 16:39:23 at loadModule (/enigma-bbs/core/module_util.js:90:5) 2024-06-14 16:39:23 at /enigma-bbs/core/module_util.js:111:17 2024-06-14 16:39:23 at /enigma-bbs/node_modules/async/dist/async.js:2588:44 2024-06-14 16:39:23 at eachOfArrayLike (/enigma-bbs/node_modules/async/dist/async.js:506:13)

I tried both options suggested :

openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 \ -pkeyopt rsa_keygen_pubexp:65537 | openssl rsa \ -out ./config/security/ssh_private_key.pem -aes128

and openssl genrsa -aes128 -out ./config/security/ssh_private_key.pem 2048

Thanks for your help

Environment Docker desktop 4.31.0 | Engine: 26.1.4 Node 20.11.1 Mac OSX 14.5 OpenSSL 3.3.1 4 Jun 2024 (Library: OpenSSL 3.3.1 4 Jun 2024)

NuSkooler commented 1 month ago

@dream7prod Would you mind creating a couple of "dummy" key pairs to post here for me to look at? Just make sure you don't use the same ones for production.

dream7prod commented 1 month ago

I installed openssl v1.1 and it worked. After that I reinstalled v3.3.1 and it worked too... maybe some conflict on something on my system... sorry my bad, I should have tried this before.

NuSkooler commented 1 month ago

Glad it's working for you!