Skip to content

A native macOS / windows / Linux database IDE built with Swift and AppKit. Connect to PostgreSQL, MySQL, SQLite, and Redis from a single app with a fast, keyboard-driven interface.

C++

feat(ssl): add mTLS support for Teleport tunnels + add CI workflow

Tobi4708ef2e2366
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..eeb5f06
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,33 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+jobs:
+ build-macos:
+ name: Build macOS
+ runs-on: macos-14
+ timeout-minutes: 30
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Select Xcode
+ run: |
+ XCODE=$(ls /Applications | grep "^Xcode" | sort -V | tail -1)
+ sudo xcode-select -s "/Applications/$XCODE/Contents/Developer"
+ swift --version
+ xcodebuild -version
+
+ - name: Resolve dependencies
+ run: swift package resolve
+
+ - name: Build (Debug)
+ run: swift build
+
+ - name: Build (Release)
+ run: swift build -c release
diff --git a/macos/Core/Models/Database/ConnectionConfig.swift b/macos/Core/Models/Database/ConnectionConfig.swift
index ebe4536..578e4a3 100644
--- a/macos/Core/Models/Database/ConnectionConfig.swift
+++ b/macos/Core/Models/Database/ConnectionConfig.swift
@@ -17,6 +17,11 @@ struct ConnectionConfig: Codable, Sendable, Hashable, Identifiable {
var colorTag: ColorTag?
var group: String?
+ // SSL/TLS certificates (for mTLS, e.g., Teleport)
+ var sslKeyPath: String?
+ var sslCertPath: String?
+ var sslCACertPath: String?
+
// SQLite-specific
var filePath: String?
@@ -34,6 +39,9 @@ struct ConnectionConfig: Codable, Sendable, Hashable, Identifiable {
sslEnabled: Bool = false,
colorTag: ColorTag? = nil,
group: String? = nil,
+ sslKeyPath: String? = nil,
+ sslCertPath: String? = nil,
+ sslCACertPath: String? = nil,
filePath: String? = nil,
sshConfig: SSHTunnelConfig? = nil
) {
@@ -47,6 +55,9 @@ struct ConnectionConfig: Codable, Sendable, Hashable, Identifiable {
self.sslEnabled = sslEnabled
self.colorTag = colorTag
self.group = group
+ self.sslKeyPath = sslKeyPath
+ self.sslCertPath = sslCertPath
+ self.sslCACertPath = sslCACertPath
self.filePath = filePath
self.sshConfig = sshConfig
}
diff --git a/macos/Data/Adapters/PostgreSQL/PostgreSQLAdapter.swift b/macos/Data/Adapters/PostgreSQL/PostgreSQLAdapter.swift
index a501003..755f0d2 100644
--- a/macos/Data/Adapters/PostgreSQL/PostgreSQLAdapter.swift
+++ b/macos/Data/Adapters/PostgreSQL/PostgreSQLAdapter.swift
@@ -31,7 +31,24 @@ final class PostgreSQLAdapter: DatabaseAdapter, SchemaInspectable, @unchecked Se
let tlsConfig: PostgresClient.Configuration.TLS
if config.sslEnabled {
var tls = TLSConfiguration.makeClientConfiguration()
- tls.certificateVerification = .none
+
+ // Load client certificate and key for mTLS (e.g., Teleport)
+ if let certPath = config.sslCertPath, !certPath.isEmpty,
+ let keyPath = config.sslKeyPath, !keyPath.isEmpty {
+ let cert = try NIOSSLCertificate.fromPEMFile(certPath)
+ let key = try NIOSSLPrivateKey(file: keyPath, format: .pem)
+ tls.certificateChain = cert.map { .certificate($0) }
+ tls.privateKey = .privateKey(key)
+ }
+
+ // Load CA certificate for server verification
+ if let caPath = config.sslCACertPath, !caPath.isEmpty {
+ tls.trustRoots = .file(caPath)
+ tls.certificateVerification = .fullVerification
+ } else {
+ tls.certificateVerification = .none
+ }
+
tlsConfig = .prefer(tls)
} else {
tlsConfig = .disable
diff --git a/macos/Presentation/Views/ConnectionForm/ConnectionFormView.swift b/macos/Presentation/Views/ConnectionForm/ConnectionFormView.swift
index ee4a09a..3b4a334 100644
--- a/macos/Presentation/Views/ConnectionForm/ConnectionFormView.swift
+++ b/macos/Presentation/Views/ConnectionForm/ConnectionFormView.swift
@@ -376,6 +376,11 @@ struct ConnectionFormView: View {
colorTag = config.colorTag ?? .blue
sqliteFilePath = config.filePath ?? ""
+ // SSL certificates (for mTLS)
+ sslKeyPath = config.sslKeyPath ?? ""
+ sslCertPath = config.sslCertPath ?? ""
+ sslCACertPath = config.sslCACertPath ?? ""
+
if let ssh = config.sshConfig {
sshEnabled = true
sshHost = ssh.host
@@ -435,6 +440,9 @@ struct ConnectionFormView: View {
sslEnabled: isFileDB ? false : sslEnabled,
colorTag: colorTag,
group: existingConfig?.group,
+ sslKeyPath: sslKeyPath.isEmpty ? nil : sslKeyPath,
+ sslCertPath: sslCertPath.isEmpty ? nil : sslCertPath,
+ sslCACertPath: sslCACertPath.isEmpty ? nil : sslCACertPath,
filePath: databaseType == .sqlite ? sqliteFilePath : nil,
sshConfig: sshConfig
)