-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c095ad1
commit 7f50167
Showing
10 changed files
with
284 additions
and
328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ proxied | |
socio | ||
Solana | ||
stacksjs | ||
tlsx | ||
typecheck | ||
unplugin | ||
unref | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
{ | ||
"name": "@stacksjs/reverse-proxy", | ||
"name": "@stacksjs/rpx", | ||
"type": "module", | ||
"version": "0.1.0", | ||
"description": "A modern reverse proxy.", | ||
"author": "Chris Breuer <[email protected]>", | ||
"license": "MIT", | ||
"homepage": "https://github.com/stacksjs/reverse-proxy#readme", | ||
"homepage": "https://github.com/stacksjs/rpx#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/stacksjs/reverse-proxy.git" | ||
"url": "git+https://github.com/stacksjs/rpx.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/stacksjs/reverse-proxy/issues" | ||
"url": "https://github.com/stacksjs/rpx/issues" | ||
}, | ||
"keywords": [ | ||
"reverse proxy", | ||
|
@@ -61,7 +61,7 @@ | |
"preview:docs": "vitepress preview docs" | ||
}, | ||
"dependencies": { | ||
"@stacksjs/tlsx": "^0.3.3" | ||
"@stacksjs/tlsx": "^0.5.6" | ||
}, | ||
"devDependencies": { | ||
"@stacksjs/cli": "^0.68.2", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { log } from '@stacksjs/cli' | ||
import { addCertToSystemTrustStoreAndSaveCert, createRootCA, generateCert } from '@stacksjs/tlsx' | ||
import { config } from './config' | ||
|
||
export async function generateCertificate(domain?: string): Promise<void> { | ||
domain = domain ?? config.https.altNameURIs[0] | ||
|
||
log.info(`Generating a self-signed SSL certificate for: ${domain}`) | ||
|
||
const caCert = await createRootCA(config.https) | ||
const hostCert = await generateCert({ | ||
hostCertCN: config.https.commonName ?? domain, | ||
domain, | ||
altNameIPs: config.https.altNameIPs, | ||
altNameURIs: config.https.altNameURIs, | ||
countryName: config.https.countryName, | ||
stateName: config.https.stateName, | ||
localityName: config.https.localityName, | ||
organizationName: config.https.organizationName, | ||
validityDays: config.https.validityDays, | ||
rootCAObject: { | ||
certificate: caCert.certificate, | ||
privateKey: caCert.privateKey, | ||
}, | ||
verbose: config.https.verbose || config.verbose, | ||
}) | ||
|
||
await addCertToSystemTrustStoreAndSaveCert(hostCert, caCert.certificate, config.https) | ||
|
||
log.success('Certificate generated') | ||
} |
Oops, something went wrong.