Skip to content

Commit 9c39a14

Browse files
committed
1. fix issues #365 #366
1 parent 8a8ac9f commit 9c39a14

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

build/helper.js

Lines changed: 6 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/fork/module/Tool.win.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,16 @@ class Manager extends Base {
114114
await execPromise(command)
115115

116116
process.chdir(param.savePath)
117-
command = `echo basicConstraints=CA:true > "${caFileName}.cnf"`
118-
await execPromise(command)
119117

120118
const caCRT = join(param.savePath, `${caFileName}.crt`)
121119
const caCnf = join(param.savePath, `${caFileName}.cnf`)
122120

121+
const cnf = `basicConstraints = critical,CA:TRUE
122+
keyUsage = critical,keyCertSign,cRLSign
123+
subjectKeyIdentifier = hash
124+
authorityKeyIdentifier = keyid:always,issuer`
125+
await writeFile(caCnf, cnf)
126+
123127
process.chdir(dirname(openssl))
124128
command = `${basename(openssl)} x509 -req -in "${caCSR}" -signkey "${caKey}" -out "${caCRT}" -extfile "${caCnf}" -sha256 -days 3650`
125129
await execPromise(command)

src/fork/module/host/SSL.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ subjectAltName=@alt_names
121121
resolve(false)
122122
return
123123
}
124-
await Helper.send('host', 'sslAddTrustedCert', CADir)
124+
await Helper.send('host', 'sslAddTrustedCert', CADir, 'FlyEnv-Root-CA.crt')
125125
const res: any = await Helper.send('host', 'sslFindCertificate', CADir)
126126
if (!res.stdout.includes('FlyEnv-Root-CA') && !res.stderr.includes('FlyEnv-Root-CA')) {
127127
resolve(false)

src/helper/module/Host.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { BaseManager } from './Base'
22
import { execPromise } from '../util'
33

44
class Manager extends BaseManager {
5-
sslAddTrustedCert(cwd: string): Promise<boolean> {
5+
sslAddTrustedCert(cwd: string, caName: string): Promise<boolean> {
66
return new Promise(async (resolve, reject) => {
77
try {
88
await execPromise(
9-
`security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "FlyEnv-Root-CA.crt"`,
9+
`security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" "${caName}"`,
1010
{
1111
cwd
1212
}

src/main/core/AppHelper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const SOCKET_PATH = '/tmp/flyenv-helper.sock'
1010

1111
class AppHelper {
1212
state: 'normal' | 'installing' | 'installed' = 'normal'
13-
version = 5
13+
version = 6
1414
check() {
1515
console.time('AppHelper check')
1616
return new Promise((resolve, reject) => {

src/render/components/Tools/SSLMake/Index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
if (!exists) {
174174
let command = `openssl genrsa -out "${caFileName}.key" 2048;`
175175
command += `openssl req -new -key "${caFileName}.key" -out "${caFileName}.csr" -sha256 -subj "/CN=Dev Root CA ${caFileName}";`
176-
command += `echo "basicConstraints=CA:true" > "${caFileName}.cnf";`
176+
command += `echo "basicConstraints = critical,CA:TRUE\nkeyUsage = critical,keyCertSign,cRLSign\nsubjectKeyIdentifier = hash\nauthorityKeyIdentifier = keyid:always,issuer" > "${caFileName}.cnf";`
177177
command += `openssl x509 -req -in "${caFileName}.csr" -signkey "${caFileName}.key" -out "${caFileName}.crt" -extfile "${caFileName}.cnf" -sha256 -days 3650;`
178178
await exec.exec(command, opt)
179179
}

0 commit comments

Comments
 (0)