smogon / pokemon-showdown

Pokémon battle simulator.
https://pokemonshowdown.com
MIT License
4.77k stars 2.79k forks source link

Cannot get Let's Encrypt Certificate to work (CRASH: Error: The SSL settings are misconfigured: Error: error:0909006C:PEM routines:get_name:no start line)) #6150

Closed AetherCollective closed 4 years ago

AetherCollective commented 4 years ago

I can't get SSL to work at all. Can I get some assistance on this? I'm using https://zerossl.com/free-ssl/#crt to generate certificates, which uses Let's Encrypt.

Config.js:

exports.ssl = {
    port: 443,
    options: {
        key: 'S:\ssl\domain-key.key',
        cert: 'S:\ssl\domain-crt.crt',
    },
};

Log:

NEW GLOBAL: global
NEW CHATROOM: lobby
NEW CHATROOM: staff
SSL private key config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.
SSL certificate config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.
SSL private key config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.
SSL certificate config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.

CRASH: Error: The SSL settings are misconfigured:
Error: error:0909006C:PEM routines:get_name:no start line
    at Object.createSecureContext (_tls_common.js:130:17)
    at Server.setSecureContext (_tls_wrap.js:1155:27)
    at Server (_tls_wrap.js:1033:8)
    at new Server (https.js:65:14)
    at Object.createServer (https.js:89:10)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:331:31)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:333:22)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

SSL private key config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.
SSL certificate config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.

CRASH: Error: The SSL settings are misconfigured:
Error: error:0909006C:PEM routines:get_name:no start line
    at Object.createSecureContext (_tls_common.js:130:17)
    at Server.setSecureContext (_tls_wrap.js:1155:27)
    at Server (_tls_wrap.js:1033:8)
    at new Server (https.js:65:14)
    at Object.createServer (https.js:89:10)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:331:31)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:333:22)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

CRASH: Error: The SSL settings are misconfigured:
Error: error:0909006C:PEM routines:get_name:no start line
    at Object.createSecureContext (_tls_common.js:130:17)
    at Server.setSecureContext (_tls_wrap.js:1155:27)
    at Server (_tls_wrap.js:1033:8)
    at new Server (https.js:65:14)
    at Object.createServer (https.js:89:10)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:331:31)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:333:22)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

SSL private key config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.
SSL certificate config values will not support HTTPS server option values in the future. Please set it to use the absolute path of its PEM file.

CRASH: Error: The SSL settings are misconfigured:
Error: error:0909006C:PEM routines:get_name:no start line
    at Object.createSecureContext (_tls_common.js:130:17)
    at Server.setSecureContext (_tls_wrap.js:1155:27)
    at Server (_tls_wrap.js:1033:8)
    at new Server (https.js:65:14)
    at Object.createServer (https.js:89:10)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:331:31)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Object.<anonymous> (G:\My Drive\pokemon-showdown-master\server\sockets.js:333:22)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

Worker 3 now listening on 0.0.0.0:80
Test your server at http://localhost:80
Worker 1 now listening on 0.0.0.0:80
Test your server at http://localhost:80
Worker 4 now listening on 0.0.0.0:80
Test your server at http://localhost:80
Worker 2 now listening on 0.0.0.0:80
Test your server at http://localhost:80
KamilaBorowska commented 4 years ago

Those properties accept strings with PEM format certificates, not paths to those.

AetherCollective commented 4 years ago

Do I need to include the beginning/end sections or just insert the base64 section?

AetherCollective commented 4 years ago

I've tried copy pasting as is, I've tried removing new lines so it is all on one line, I tried removing the begin/end sections, and I tried both removing new lines and the begin/end sections. I still can't get it to work. Same error code.

KamilaBorowska commented 4 years ago

Oops, sorry, I misread the code. The real issue is that those properties accept paths, however, you are using \, and you should be using \\ or / in your paths (or use String.raw).