Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/cli",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"bin": {
"diskpush": "./dist/bin.js"
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/desktop",
"version": "0.16.2",
"version": "0.16.3",
"private": true,
"type": "module",
"main": "dist-electron/main/index.js",
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/web",
"version": "0.16.2",
"version": "0.16.3",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/database/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/database",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/fleet-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/fleet-core",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/plugin-api",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-dbbackup/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/plugin-dbbackup",
"version": "0.16.2",
"version": "0.16.3",
"description": "DiskPush plugin: dump Postgres, Supabase, MySQL/MariaDB and SQLite databases to tagged, verified, gzipped files, prune them, push them anywhere rsync reaches, and restore them.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-mediaanalyzer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/plugin-mediaanalyzer",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/rsync-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/rsync-core",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/s3-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/s3-core",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/schemas",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/ssh-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@diskpush/ssh-core",
"version": "0.16.2",
"version": "0.16.3",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
12 changes: 11 additions & 1 deletion packages/ssh-core/src/session.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { existsSync, readFileSync } from 'node:fs'
import { homedir } from 'node:os'
import { join } from 'node:path'
import { Client, type AnyAuthMethod, type ConnectConfig, type SFTPWrapper } from 'ssh2'
import type { Connection } from '@diskpush/schemas'
import { keyTypeOf, sha256Fingerprint } from './fingerprint.js'
Expand All @@ -23,7 +25,14 @@ export type HostKeyPrompt = (details: {
}) => Promise<boolean>

export type SessionOptions = {
/** DiskPush's own known_hosts: read, and where newly trusted keys are written. */
knownHostsPath: string
/**
* Further known_hosts files trusted read-only, so a host OpenSSH already
* knows is not "new" to DiskPush. Defaults to ~/.ssh/known_hosts (hashed
* entries included); pass [] to trust only `knownHostsPath`.
*/
trustedKnownHostsPaths?: readonly string[]
/**
* Asked only when a host is genuinely new. A *changed* key is never
* prompted away here; it fails, and the user has to deal with it
Expand Down Expand Up @@ -76,7 +85,8 @@ export class SshSession {

static async connect(connection: Connection, options: SessionOptions): Promise<SshSession> {
const client = new Client()
const knownHosts = readKnownHosts(options.knownHostsPath)
const trusted = options.trustedKnownHostsPaths ?? [join(homedir(), '.ssh', 'known_hosts')]
const knownHosts = [options.knownHostsPath, ...trusted.filter((p) => p !== options.knownHostsPath)].flatMap(readKnownHosts)

const config: ConnectConfig = {
host: connection.host,
Expand Down
Loading