@@ -134,6 +134,7 @@ func (r *Repository) createHostFromServer(server domain.Server) *ssh_config.Host
134
134
// Authentication and key management
135
135
r .addKVNodeIfNotEmpty (host , "PubkeyAuthentication" , server .PubkeyAuthentication )
136
136
r .addKVNodeIfNotEmpty (host , "PubkeyAcceptedAlgorithms" , server .PubkeyAcceptedAlgorithms )
137
+ r .addKVNodeIfNotEmpty (host , "HostbasedAcceptedAlgorithms" , server .HostbasedAcceptedAlgorithms )
137
138
r .addKVNodeIfNotEmpty (host , "PasswordAuthentication" , server .PasswordAuthentication )
138
139
r .addKVNodeIfNotEmpty (host , "PreferredAuthentications" , server .PreferredAuthentications )
139
140
r .addKVNodeIfNotEmpty (host , "IdentitiesOnly" , server .IdentitiesOnly )
@@ -197,45 +198,48 @@ func (r *Repository) addKVNodeIfNotEmpty(host *ssh_config.Host, key, value strin
197
198
// updateHostNodes updates the nodes of an existing host with new server details.
198
199
func (r * Repository ) updateHostNodes (host * ssh_config.Host , newServer domain.Server ) {
199
200
updates := map [string ]string {
200
- "hostname" : newServer .Host ,
201
- "user" : newServer .User ,
202
- "port" : fmt .Sprintf ("%d" , newServer .Port ),
203
- "proxycommand" : newServer .ProxyCommand ,
204
- "proxyjump" : newServer .ProxyJump ,
205
- "remotecommand" : newServer .RemoteCommand ,
206
- "requesttty" : newServer .RequestTTY ,
207
- "connecttimeout" : newServer .ConnectTimeout ,
208
- "connectionattempts" : newServer .ConnectionAttempts ,
209
- "bindaddress" : newServer .BindAddress ,
210
- "bindinterface" : newServer .BindInterface ,
211
- "pubkeyauthentication" : newServer .PubkeyAuthentication ,
212
- "passwordauthentication" : newServer .PasswordAuthentication ,
213
- "preferredauthentications" : newServer .PreferredAuthentications ,
214
- "pubkeyacceptedalgorithms" : newServer .PubkeyAcceptedAlgorithms ,
215
- "pubkeyacceptedkeytypes" : newServer .PubkeyAcceptedAlgorithms , // Deprecated alias
216
- "identitiesonly" : newServer .IdentitiesOnly ,
217
- "addkeystoagent" : newServer .AddKeysToAgent ,
218
- "identityagent" : newServer .IdentityAgent ,
219
- "forwardagent" : newServer .ForwardAgent ,
220
- "forwardx11" : newServer .ForwardX11 ,
221
- "forwardx11trusted" : newServer .ForwardX11Trusted ,
222
- "controlmaster" : newServer .ControlMaster ,
223
- "controlpath" : newServer .ControlPath ,
224
- "controlpersist" : newServer .ControlPersist ,
225
- "serveraliveinterval" : newServer .ServerAliveInterval ,
226
- "serveralivecountmax" : newServer .ServerAliveCountMax ,
227
- "compression" : newServer .Compression ,
228
- "tcpkeepalive" : newServer .TCPKeepAlive ,
229
- "stricthostkeychecking" : newServer .StrictHostKeyChecking ,
230
- "userknownhostsfile" : newServer .UserKnownHostsFile ,
231
- "hostkeyalgorithms" : newServer .HostKeyAlgorithms ,
232
- "macs" : newServer .MACs ,
233
- "ciphers" : newServer .Ciphers ,
234
- "kexalgorithms" : newServer .KexAlgorithms ,
235
- "localcommand" : newServer .LocalCommand ,
236
- "permitlocalcommand" : newServer .PermitLocalCommand ,
237
- "loglevel" : newServer .LogLevel ,
238
- "batchmode" : newServer .BatchMode ,
201
+ "hostname" : newServer .Host ,
202
+ "user" : newServer .User ,
203
+ "port" : fmt .Sprintf ("%d" , newServer .Port ),
204
+ "proxycommand" : newServer .ProxyCommand ,
205
+ "proxyjump" : newServer .ProxyJump ,
206
+ "remotecommand" : newServer .RemoteCommand ,
207
+ "requesttty" : newServer .RequestTTY ,
208
+ "connecttimeout" : newServer .ConnectTimeout ,
209
+ "connectionattempts" : newServer .ConnectionAttempts ,
210
+ "bindaddress" : newServer .BindAddress ,
211
+ "bindinterface" : newServer .BindInterface ,
212
+ "pubkeyauthentication" : newServer .PubkeyAuthentication ,
213
+ "passwordauthentication" : newServer .PasswordAuthentication ,
214
+ "preferredauthentications" : newServer .PreferredAuthentications ,
215
+ "pubkeyacceptedalgorithms" : newServer .PubkeyAcceptedAlgorithms ,
216
+ "pubkeyacceptedkeytypes" : newServer .PubkeyAcceptedAlgorithms , // Deprecated alias (since OpenSSH 8.5)
217
+ "hostbasedacceptedalgorithms" : newServer .HostbasedAcceptedAlgorithms ,
218
+ "hostbasedkeytypes" : newServer .HostbasedAcceptedAlgorithms , // Deprecated alias (since OpenSSH 8.5)
219
+ "hostbasedacceptedkeytypes" : newServer .HostbasedAcceptedAlgorithms , // Deprecated alias (since OpenSSH 8.5)
220
+ "identitiesonly" : newServer .IdentitiesOnly ,
221
+ "addkeystoagent" : newServer .AddKeysToAgent ,
222
+ "identityagent" : newServer .IdentityAgent ,
223
+ "forwardagent" : newServer .ForwardAgent ,
224
+ "forwardx11" : newServer .ForwardX11 ,
225
+ "forwardx11trusted" : newServer .ForwardX11Trusted ,
226
+ "controlmaster" : newServer .ControlMaster ,
227
+ "controlpath" : newServer .ControlPath ,
228
+ "controlpersist" : newServer .ControlPersist ,
229
+ "serveraliveinterval" : newServer .ServerAliveInterval ,
230
+ "serveralivecountmax" : newServer .ServerAliveCountMax ,
231
+ "compression" : newServer .Compression ,
232
+ "tcpkeepalive" : newServer .TCPKeepAlive ,
233
+ "stricthostkeychecking" : newServer .StrictHostKeyChecking ,
234
+ "userknownhostsfile" : newServer .UserKnownHostsFile ,
235
+ "hostkeyalgorithms" : newServer .HostKeyAlgorithms ,
236
+ "macs" : newServer .MACs ,
237
+ "ciphers" : newServer .Ciphers ,
238
+ "kexalgorithms" : newServer .KexAlgorithms ,
239
+ "localcommand" : newServer .LocalCommand ,
240
+ "permitlocalcommand" : newServer .PermitLocalCommand ,
241
+ "loglevel" : newServer .LogLevel ,
242
+ "batchmode" : newServer .BatchMode ,
239
243
}
240
244
for key , value := range updates {
241
245
if value != "" {
@@ -315,51 +319,54 @@ func (r *Repository) updateOrAddKVNode(host *ssh_config.Host, key, newValue stri
315
319
// Reference: https://www.ssh.com/academy/ssh/config
316
320
func (r * Repository ) getProperKeyCase (key string ) string {
317
321
keyMap := map [string ]string {
318
- "hostname" : "HostName" ,
319
- "user" : "User" ,
320
- "port" : "Port" ,
321
- "identityfile" : "IdentityFile" ,
322
- "proxycommand" : "ProxyCommand" ,
323
- "proxyjump" : "ProxyJump" ,
324
- "remotecommand" : "RemoteCommand" ,
325
- "requesttty" : "RequestTTY" ,
326
- "connecttimeout" : "ConnectTimeout" ,
327
- "connectionattempts" : "ConnectionAttempts" ,
328
- "bindaddress" : "BindAddress" ,
329
- "bindinterface" : "BindInterface" ,
330
- "localforward" : "LocalForward" ,
331
- "remoteforward" : "RemoteForward" ,
332
- "dynamicforward" : "DynamicForward" ,
333
- "pubkeyauthentication" : "PubkeyAuthentication" ,
334
- "passwordauthentication" : "PasswordAuthentication" ,
335
- "preferredauthentications" : "PreferredAuthentications" ,
336
- "pubkeyacceptedalgorithms" : "PubkeyAcceptedAlgorithms" ,
337
- "pubkeyacceptedkeytypes" : "PubkeyAcceptedAlgorithms" , // Deprecated alias
338
- "identitiesonly" : "IdentitiesOnly" ,
339
- "addkeystoagent" : "AddKeysToAgent" ,
340
- "identityagent" : "IdentityAgent" ,
341
- "forwardagent" : "ForwardAgent" ,
342
- "forwardx11" : "ForwardX11" ,
343
- "forwardx11trusted" : "ForwardX11Trusted" ,
344
- "controlmaster" : "ControlMaster" ,
345
- "controlpath" : "ControlPath" ,
346
- "controlpersist" : "ControlPersist" ,
347
- "serveraliveinterval" : "ServerAliveInterval" ,
348
- "serveralivecountmax" : "ServerAliveCountMax" ,
349
- "compression" : "Compression" ,
350
- "tcpkeepalive" : "TCPKeepAlive" ,
351
- "stricthostkeychecking" : "StrictHostKeyChecking" ,
352
- "userknownhostsfile" : "UserKnownHostsFile" ,
353
- "hostkeyalgorithms" : "HostKeyAlgorithms" ,
354
- "macs" : "MACs" ,
355
- "ciphers" : "Ciphers" ,
356
- "kexalgorithms" : "KexAlgorithms" ,
357
- "localcommand" : "LocalCommand" ,
358
- "permitlocalcommand" : "PermitLocalCommand" ,
359
- "sendenv" : "SendEnv" ,
360
- "setenv" : "SetEnv" ,
361
- "loglevel" : "LogLevel" ,
362
- "batchmode" : "BatchMode" ,
322
+ "hostname" : "HostName" ,
323
+ "user" : "User" ,
324
+ "port" : "Port" ,
325
+ "identityfile" : "IdentityFile" ,
326
+ "proxycommand" : "ProxyCommand" ,
327
+ "proxyjump" : "ProxyJump" ,
328
+ "remotecommand" : "RemoteCommand" ,
329
+ "requesttty" : "RequestTTY" ,
330
+ "connecttimeout" : "ConnectTimeout" ,
331
+ "connectionattempts" : "ConnectionAttempts" ,
332
+ "bindaddress" : "BindAddress" ,
333
+ "bindinterface" : "BindInterface" ,
334
+ "localforward" : "LocalForward" ,
335
+ "remoteforward" : "RemoteForward" ,
336
+ "dynamicforward" : "DynamicForward" ,
337
+ "pubkeyauthentication" : "PubkeyAuthentication" ,
338
+ "passwordauthentication" : "PasswordAuthentication" ,
339
+ "preferredauthentications" : "PreferredAuthentications" ,
340
+ "pubkeyacceptedalgorithms" : "PubkeyAcceptedAlgorithms" ,
341
+ "pubkeyacceptedkeytypes" : "PubkeyAcceptedAlgorithms" , // Deprecated alias (since OpenSSH 8.5)
342
+ "hostbasedacceptedalgorithms" : "HostbasedAcceptedAlgorithms" ,
343
+ "hostbasedkeytypes" : "HostbasedAcceptedAlgorithms" , // Deprecated alias (since OpenSSH 8.5)
344
+ "hostbasedacceptedkeytypes" : "HostbasedAcceptedAlgorithms" , // Deprecated alias (since OpenSSH 8.5)
345
+ "identitiesonly" : "IdentitiesOnly" ,
346
+ "addkeystoagent" : "AddKeysToAgent" ,
347
+ "identityagent" : "IdentityAgent" ,
348
+ "forwardagent" : "ForwardAgent" ,
349
+ "forwardx11" : "ForwardX11" ,
350
+ "forwardx11trusted" : "ForwardX11Trusted" ,
351
+ "controlmaster" : "ControlMaster" ,
352
+ "controlpath" : "ControlPath" ,
353
+ "controlpersist" : "ControlPersist" ,
354
+ "serveraliveinterval" : "ServerAliveInterval" ,
355
+ "serveralivecountmax" : "ServerAliveCountMax" ,
356
+ "compression" : "Compression" ,
357
+ "tcpkeepalive" : "TCPKeepAlive" ,
358
+ "stricthostkeychecking" : "StrictHostKeyChecking" ,
359
+ "userknownhostsfile" : "UserKnownHostsFile" ,
360
+ "hostkeyalgorithms" : "HostKeyAlgorithms" ,
361
+ "macs" : "MACs" ,
362
+ "ciphers" : "Ciphers" ,
363
+ "kexalgorithms" : "KexAlgorithms" ,
364
+ "localcommand" : "LocalCommand" ,
365
+ "permitlocalcommand" : "PermitLocalCommand" ,
366
+ "sendenv" : "SendEnv" ,
367
+ "setenv" : "SetEnv" ,
368
+ "loglevel" : "LogLevel" ,
369
+ "batchmode" : "BatchMode" ,
363
370
}
364
371
365
372
if properCase , exists := keyMap [strings .ToLower (key )]; exists {
0 commit comments