shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

Add more ssh_config directives

Open thshdw opened this issue 9 years ago • 4 comments

Requested by @skebi69 Add more flexibility with building the JSON settings for Hosts parsed in ssh_config

Example:

Host gandalf
        # shuttle.name = work/servers/web01 (webserver)
        # shuttle.cmd = ssh -Nf webserver
        # shuttle.theme = Homebrew
        # shuttle.title = personal webserver 
        # shuttle.window = new
        HostName [email protected]

thshdw avatar Jan 17 '16 04:01 thshdw

Instead of the following in AppDelegate.m:

      // if everything worked out we will see a non-nil itemList where the
        // system should be appended to. part hold the last part of the splitted string (aka hostname).
        if (itemList) {
            // build the corresponding ssh command
            NSString* cmd = [NSString stringWithFormat:@"ssh %@", key];

we change it to:

        // if everything worked out we will see a non-nil itemList where the
        // system should be appended to. part hold the last part of the splitted string (aka hostname).
        if (itemList) {      
            // build the corresponding ssh command
            NSString* cmd = servers[key][@"cmd"] ?
                cmd = servers[key][@"cmd"] : [NSString stringWithFormat:@"ssh %@", key];

The reason we do this is to enable snippets like this in ~/.ssh/config:

Host Sandbox-Tunnels

shuttle.name = Sandbox/_Tunnels

shuttle.cmd = ssh -Nf Sandbox-Tunnels && exit

Hostname A.B.C.D Port 57534 LocalForward 127.0.0.1:12345 some.machine.us-east-1.rds.amazonaws.com:1521 LocalForward 127.0.0.1:12356 10.100.9.10:22 LocalForward 127.0.0.1:12357 10.100.1.100:22

The # shuttle.cmd directive allows us to establish a non-interactive session with the bastion host (using –Nf and exit). This allows users to establish “tunnels” and then use those tunnels to connect to servers secured behind the bastion host.

skebi69 avatar Apr 19 '16 01:04 skebi69

@skebi69 Looks reasonable! If you want to make a pull request I'll test it out to make sure we have no regressions. If all tests well I'll commit it.

thshdw avatar Apr 25 '16 20:04 thshdw

I can't create a branch (shuttle-johnk) to push the change to. Permission denied.

skebi69 avatar Apr 26 '16 14:04 skebi69

Click on the Pull Request button; where it says this branch is 1 commit ahead.

screen shot 2016-04-27 at 12 14 34 pm

thshdw avatar Apr 27 '16 19:04 thshdw