feat: TLS certificate file support
- NewConnectionDialog: TLS cert file selectors (CA/Cert/Key) + rejectUnauthorized checkbox - connection.ts: read cert files and pass to ioredis tls options - Add tlsRejectUnauthorized to all ConnectionConfig types - i18n keys for tlsCaPath/tlsCertPath/tlsKeyPath/tlsRejectUnauthorized
This commit is contained in:
@@ -13,6 +13,10 @@ export interface ConnectionOptions {
|
||||
username?: string
|
||||
password?: string
|
||||
tls?: boolean
|
||||
tlsCaPath?: string
|
||||
tlsCertPath?: string
|
||||
tlsKeyPath?: string
|
||||
tlsRejectUnauthorized?: boolean
|
||||
sshEnabled?: boolean
|
||||
sshHost?: string
|
||||
sshPort?: number
|
||||
@@ -121,10 +125,20 @@ function buildRedisOptions(opts: ConnectionOptions): RedisOptions {
|
||||
}
|
||||
|
||||
if (opts.tls) {
|
||||
options.tls = {
|
||||
rejectUnauthorized: false,
|
||||
const tlsOpts: any = {
|
||||
rejectUnauthorized: opts.tlsRejectUnauthorized || false,
|
||||
checkServerIdentity: () => undefined,
|
||||
}
|
||||
if (opts.tlsCaPath) {
|
||||
try { tlsOpts.ca = readFileSync(expandHomePath(opts.tlsCaPath)) } catch { /* ignore */ }
|
||||
}
|
||||
if (opts.tlsCertPath) {
|
||||
try { tlsOpts.cert = readFileSync(expandHomePath(opts.tlsCertPath)) } catch { /* ignore */ }
|
||||
}
|
||||
if (opts.tlsKeyPath) {
|
||||
try { tlsOpts.key = readFileSync(expandHomePath(opts.tlsKeyPath)) } catch { /* ignore */ }
|
||||
}
|
||||
options.tls = tlsOpts
|
||||
}
|
||||
|
||||
return options
|
||||
|
||||
Reference in New Issue
Block a user