Skip to content

Commit 4a515d9

Browse files
authored
Add support for %h and %r escape characters in IdentityFile for SSH. (#10343)
* Add support for %h and %r escape characters in IdentityFile for SSH. See section "IdentityFile" on https://linux.die.net/man/5/ssh_config for details. * Fix lint warnings.
1 parent b83b2e5 commit 4a515d9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tabby-ssh/src/session/ssh.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,11 @@ export class SSHSession {
162162
this.allAuthMethods = [{ type: 'none' }]
163163
if (!this.profile.options.auth || this.profile.options.auth === 'publicKey') {
164164
if (this.profile.options.privateKeys?.length) {
165-
for (const pk of this.profile.options.privateKeys) {
165+
for (let pk of this.profile.options.privateKeys) {
166166
// eslint-disable-next-line @typescript-eslint/init-declarations
167167
let contents: Buffer
168+
pk = pk.replace('%h', this.profile.options.host)
169+
pk = pk.replace('%r', this.profile.options.user)
168170
try {
169171
contents = await this.fileProviders.retrieveFile(pk)
170172
} catch (error) {

0 commit comments

Comments
 (0)