aker-gateway / Aker

SSH bastion/jump host/jumpserver
Other
568 stars 71 forks source link

[bug] custom remote SSH port does not work #91

Closed brosky closed 4 years ago

brosky commented 5 years ago

Hi,

I have a console appliance that via SSH on port 22 gives administration menu and on port 7000 gives user menu.

Setting a custom port in hosts.json connects to port 22 instead of 7000

My config:

{ "name": "Console", "hostname": "1.2.3.4", "port": "7000", "key": "~/.ssh/id_rsa", "usergroups": [ "lnxadmins" ], hostgroups": [ "linuxservers" ] },

Log:

Apr 17 10:42:58 sshgw-cj systemd-logind: New session 28624 of user brosky. Apr 17 10:42:59 sshgw-cj Aker: aker INFO - Core: Starting up, user=aker from=1.2.3.254:60319 Apr 17 10:42:59 sshgw-cj Aker: IdPFactory INFO - IdPFactory: trying dynamic loading of module : Json Apr 17 10:42:59 sshgw-cj Aker: Json INFO - Json: loaded Apr 17 10:42:59 sshgw-cj Aker: hosts INFO - Hosts: loading hosts from cache Apr 17 10:43:00 sshgw-cj Aker: tui INFO - TUI: Refreshing entries for user brosky Apr 17 10:43:00 sshgw-cj Aker: aker INFO - Core: reloading hosts for user brosky from backened identity provider Apr 17 10:43:01 sshgw-cj systemd: Started Session 28625 of user root. Apr 17 10:43:02 sshgw-cj Aker: tui INFO - TUI: Refreshing entries for user brosky Apr 17 10:43:02 sshgw-cj Aker: aker INFO - Core: reloading hosts for user brosky from backened identity provider Apr 17 10:43:05 sshgw-cj Aker: aker INFO - Core: Starting session UUID fc075808-5cc4-4004-966a-b6bd35cf7c3d for user brosky to host 1.2.3.4 Apr 17 10:43:05 sshgw-cj Aker: transport INFO - Connected (version 2.0, client OpenSSH_4.2) Apr 17 10:43:06 sshgw-cj Aker: transport INFO - Authentication (publickey) failed. Apr 17 10:43:10 sshgw-cj Aker: transport INFO - Authentication (password) successful!

I've tried this with different hosts and it seems to always use port 22 - tcpdump on the outgoing interface shows nothing.

anazmy commented 5 years ago

Yeah, that is a duplicate of #38 I think it can be applied with recent changes now.

jgraham-bw commented 4 years ago

Having the same issue for a server using port 2024. Tshark capture showing that despite the hosts.json file configured for port 2024, it ssh's to port 22.

anazmy commented 4 years ago

@jgraham-bw you're using JSON provider, right?

anazmy commented 4 years ago

@jgraham-bw @brosky

For JSON provider, ssh custom port should work now, can you please test and let me know your feedback?

jgraham-bw commented 4 years ago

Thank you for the quick reply. Pulled the new code, but getting a traceback error now. Formatting was bad here, attached traceback. aker_port_traceback.txt

anazmy commented 4 years ago

Most probably you have the old json file format. The change is simple, please change port to ssh_port in the json file and retry.

jgraham-bw commented 4 years ago

Yep, that was the problem. Thank you very much!!! Custom port issue is fixed.

anazmy commented 4 years ago

Thanks for confirming