Genesis
This commit is contained in:
20
generate-cert.js
Normal file
20
generate-cert.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const { execSync } = require('node:child_process');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
|
||||
const certsDir = path.join(__dirname, 'certs');
|
||||
const keyPath = path.join(certsDir, 'key.pem');
|
||||
const certPath = path.join(certsDir, 'cert.pem');
|
||||
|
||||
fs.mkdirSync(certsDir, { recursive: true });
|
||||
|
||||
const subject = '/CN=localhost/O=JTL Debug Server/C=DE';
|
||||
const san = 'subjectAltName=DNS:localhost,IP:127.0.0.1,IP:0.0.0.0';
|
||||
|
||||
execSync(
|
||||
`openssl req -x509 -newkey rsa:2048 -nodes -keyout "${keyPath}" -out "${certPath}" -days 3650 -subj "${subject}" -addext "${san}"`,
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
|
||||
console.log(`Wrote ${keyPath}`);
|
||||
console.log(`Wrote ${certPath}`);
|
||||
Reference in New Issue
Block a user