Giter Site home page Giter Site logo

alfred-ssh's Introduction

Secure SHell for Alfred

Open SSH/SFTP/mosh connections from Alfred 3 with autosuggestions based on SSH config files, /etc/hosts and your history.

demo

Features

  • Auto-suggest hostnames
  • Remembers usernames, so you don't have to type them in every time
  • Alternate actions:
    • Open connection with mosh
    • Open SFTP connection
    • Ping host
  • Sources (can be managed individually):
    • ~/.ssh/config
    • ~/.ssh/known_hosts
    • History (i.e. username + host addresses previously entered by the user)
    • /etc/hosts
    • /etc/ssh/ssh_config

Installation

Download the latest release and double-click the file to install in Alfred.

Usage

The main keyword is ssh:

  • ssh [<query>] — View and filter known SSH connections.

    • or ⌘+<NUM> — Open the connection.
    • — Expand query to selected connection's title. Useful for adding a port number.
    • ⌘+↩ — Open an SFTP connection instead.
    • ⌥+↩ — Open a mosh connection instead.
    • ⇧+↩ — Ping host.
    • ^+↩ — Forget connection (if it's from history).

Configuration is managed with sshconf:

  • sshconf [<query>] — Edit workflow settings (see Configuration)
    • An Update is Available! or Workflow is Up to Date — Action to check for an update and install if one is available.
    • Source: XYZ — Toggle source on/off
    • Log File — Open workflow's log file in the default app (usually Console.app)
    • Documentation / Report Issue / Visit Forum — Open this file, the workflow's issue tracker or forum thread in your browser.

Configuration

Sources can be configured from within the workflow using the sshconf keyword. Other settings are managed via the workflow's configuration sheet.

Sources

The following sources are available and can be toggled on/off using sshconf:

Name Source
SSH Config ~/.ssh/config
SSH Config (system) /etc/ssh/ssh_config
/etc/hosts /etc/hosts
History User-entered hostnames
Known Hosts ~/.ssh/known_hosts

Advanced configuration

There are several additional settings that can only be edited via the workflow's configuration sheet, which allow you to specify a few commands and applications.

To understand these, it's necessary to understand a bit about how the workflow works.

The workflow opens connections either via a URL (sftp://... and ssh://... by default) or via a shell command (ping and mosh by default). URLs are passed off to the system, which opens them in the default application. Shell commands are handled by Alfred's Terminal Command Action, which effectively creates a new tab in your default terminal and pastes the command in there.

URLs

If you'd like sftp://... or ssh://... URLs to be passed to a specific application, specify its name for SFTP_APP or SSH_APP respectively, e.g. Transmit or ForkLift for SFTP, or Terminal for SSH.

Commands

The handling of shell commands is configured in Alfred's own preferences (see Using iTerm2 for more information).

There are two commands you can configure in the workflow, MOSH_CMD and SSH_CMD.

MOSH_CMD sets the command that is pasted in your terminal when the command is run. Normally, the default of mosh should be sufficient, but set to a full path if the command can't be found.

Set MOSH_CMD to empty to disable mosh.

SSH_CMD allows you to override the default behaviour of generating and opening an ssh://... URL. If SSH_CMD is non-empty, a shell command is generated and run in your terminal instead. SSH_CMD is the name or path of the ssh command.

Compared to the default ssh://... URL method, this has the advantage of running the command in your own shell, so your local configuration files should be loaded before the SSH connection is made. It has the downside of being slower and less well-tested than the default URL method.

Using iTerm2

If you'd prefer to use iTerm2 rather than Terminal.app, there are two steps:

  1. To have shell commands open in iTerm2, install @stuartcryan's iTerm2 plugin for Alfred.
  2. To open ssh://... URLs in iTerm2, Set iTerm2 as the default handler for ssh: URLs in iTerm2's own preferences under Profiles > PROFILE_NAME > General > URL Schemes:

iTerm2 > Preferences > PROFILE_NAME > General > URL Schemes

Licensing & thanks

This workflow is released under the MIT Licence.

It uses the following libraries (all MIT Licence):

And icons from or based on the following fonts (all SIL Licence):

This workflow started as a port of @isometry's Python SSH workflow to Go as a testbed for AwGo. It has since gained some additional features.

If you need Alfred 2 support, check out @isometry's workflow.

Changelog

  • v0.9.0

  • v0.8.0 — 2018-03-17
    • Add option to use ssh command instead of URL. Enables loading of local shell configuration before opening connection. #8
    • Add in-workflow configuration of sources
    • Add links to docs, issue tracker and forum thread
  • v0.7.1 — 2016-12-12
    • Fix updater bug
    • Smarter SSH URLs for hosts from ~/.ssh/config
    • Better removal of duplicates
  • v0.6.0 — 2016-11-09
    • Add in-workflow updates
  • v0.5.0 — 2016-10-31
    • Add support for SSH configuration files (~/.ssh/config and /etc/ssh/ssh_config)
    • Alternate action: open connection with mosh
  • v0.4.0 — 2016-05-27
    • Add ability to turn sources of suggestions off #1
  • v0.3.0 — 2016-05-26
    • Alternate action: Open SFTP connection
    • Alternate action: Ping host
    • Remember connections with usernames, so you don't have to type the username each time
  • v0.2.0 — 2016-05-23
    • First public release

alfred-ssh's People

Contributors

deanishe avatar gitatmax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfred-ssh's Issues

macOS Ventura seems to have broken assh

Hi,

My SSH workflow is no longer work since upgrading to macOS Ventura (Intel). I have tried deleting and reinstalling the workflow, clearing Alfreds cache, with no success.

The debugger doesn't give much useful information - it appears the "assh" helper is killed as soon as it is executed. Possibly falling foul of some new System Integrity Protection?

[14:39:01.602] Secure SHell[Script Filter] Queuing argument ''
[14:39:01.624] Secure SHell[Script Filter] Script with argv '' finished
[14:39:01.628] ERROR: Secure SHell[Script Filter] Code 137: /Users/daz/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/81D2EFF4-B155-4382-A166-E37561597653: line 2: 17371 Killed: 9               ./assh search "$1"

I tried dtrace'ing the executable but didn't get any useful info out of it.

Notarise binaries

As other bugs have discussed, with Catalina macOS will refuse to run the helper binaries. However the other bugs are closed as there is nothing you can do, but this is incorrect (as clearly macos binaries can be distributed).

https://github.com/mitchellh/gon is a tool to help notarise Go binaries. Once the binary is notarised macOS won't complain about the binaries.

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

verifying github.com/bmatcuk/[email protected]: checksum mismatch
	downloaded: h1:pU59Kfv7FNj48wpr3s2/S7OnFkJhsSKHcPL9stQkXGo=
	go.sum:     h1:p0ybUUk/Dh+yetkg3v0Yhi/ujMiet/gztYQnxNXfsyw=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

reopen the iterm2 window

Hi,
I meet a problem that when I use ssh myhost and activate a window of iterm2 normally and then right click the iterm2 in the dock it will reopen a new window not to active the old window and the iterm2 window of my server will be hided and must use command option 1 to show the window.

MacOS version 12.2 with intel
iterm2 build 3.4.15

However,It shows fine with my M1 Mac.
Is there any problem with changing the application name from iterm2 to iterm? The renaming operation will cause this problem?

Problems deleting connections from history

I'm having problems deleting connections from my history. I hold down Control and press Return (or click) on the connection I want to delete, the subheader says "Delete connection from history", but when pressing Return the list of connections just refreshes with no change to them (i.e. connection is not deleted).

I'm running the latest version 0.7.1 on a 2017 MacBook Pro 15" with Touch Bar.

Catalina?

Is it possible to make this work in Catalina?
Screen Shot 2020-03-23 at 8 54 43 AM

Can't toggle Configuration options (Alfred 4)

When trying to toggle through Alfred GUI (sshconf) it throws an error, looks like it's looking for Alfred 3 app, I'm using Alfred 4:

    08:50:41 1m11.562061563s since last check for update
    08:50:41 [toggle] DISABLE_KNOWN_HOSTS ->  "1"
    08:50:41 ------------- [/usr/bin/osascript -l JavaScript -e Application('Alfred 3').setConfiguration("DISABLE_KNOWN_HOSTS", {"exportable":true,"inWorkflow":"net.deanishe.alfred-ssh","toValue":"1"})] ---------------
    08:50:41 execution error: Error: Error: Application can't be found. (-2700)
    
    08:50:41 ----------------------------------------------
    08:50:41 [ERROR] exit status 1
    08:50:41 Get help at https://github.com/deanishe/alfred-ssh/issues
    08:50:41 ------------------ 239.648178ms ------------------
    08:50:42 -------- Secure SHell/0.8.0 (AwGo/0.14.0) --------
    08:50:42 [bind] unbindable kind: ptr

Demo

ScreenShot.2020-12-31.at.09.25.47.mp4

The error can be bypassed by manually going into the workflow configuration sheet and setting the DISABLE_* values in there.

Does not show connections with `-` in name

When name in ~/.ssh/config has a - in title, it will not appear in list on alfred

Host example-example-example
    User ...
    HostName ...
    UseKeychain yes
    AddKeysToAgent yes
    IdentityFile ...

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

verifying github.com/bmatcuk/[email protected]: checksum mismatch
	downloaded: h1:pU59Kfv7FNj48wpr3s2/S7OnFkJhsSKHcPL9stQkXGo=
	go.sum:     h1:p0ybUUk/Dh+yetkg3v0Yhi/ujMiet/gztYQnxNXfsyw=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Setting a default user so I don't have to type it every time

Whenever I SSH into any IP, every time, I have to use a different user (different than the one I'm logged in as). I can type 'ssh user@' to get the same list of IPs, but it would be useful if I could set a default user, so I don't have to type it every time. Any thoughts?

Regards,
Alex

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

go: howett.net/[email protected]: unrecognized import path "howett.net/plist" (https fetch: Get https://howett.net/plist?go-get=1: EOF)

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Environment Variable not passed

It seems that this workflow ignores ( don't passes ) the local environment variables to the remote machine. If I open iTerm by hand and connect to the target host via ssh hostname the remote machine gets the local environment variables I declared to send via local ~/.ssh/config-file:

SendEnv RMATE_*

Works only if on the remote machine the variable-namespace was declared to be accepted in the /etc/ssh/sshd_config-file:

AcceptEnv LANG LC_* RMATE_*

But if I use this workflow, it seems that this is getting ignored.

Finally, if I access a host via workflow the printenv-command don't show the declared local variable on the remote machine.

Not finding hosts in .ssh/config

Hi, just installed your awesome workflow, excited to use it!

Followed all the instructions, got it installed and updated. But it's not finding any hosts in ~/.ssh/config. I've disabled all other includes, and left ~/.ssh/config active, to eliminate any false-positives.

Here's an excerpt from the log:

6:30:17 ------------------- 7.658127ms -------------------
16:30:17 -------- Secure SHell/0.8.0 (AwGo/0.14.0) --------
16:30:17 [bind] unbindable kind: ptr
16:30:17 options=
&{Check:false Config:false Demo:false Forget:false Open:false Print:false PrintDataDir:false PrintCacheDir:false PrintDistName:false PrintLogFile:false Remember:false Search:true Toggle:false RawInput:tn RawURL: VarName: DisableConfig:false DisableEtcConfig:true DisableEtcHosts:true DisableHistory:true DisableKnownHosts:true ExitOnSuccess:true MoshCmd:mosh SFTPApp: SSHApp: SSHCmd: query:tn url:<nil> username: port:0 historyPath:/Users/Strex/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-ssh/history.json}
16:30:17 15.685030974s since last check for update
16:30:17 query=tn, username=, port=0
16:30:17 [source/load/config] 0 host(s) in '~/.ssh/config'
16:30:17 0 host(s) loaded in 304.401µs
16:30:17 0/0 hosts match `tn`
16:30:17 Sent 1 result(s) to Alfred

And hers's proof that hosts exist in my local config file:

[Strex@host]: grep host ~/.ssh/config |wc -l
9

The hosts are in the following format:

host foo
   Hostname foo.bar.com
   User foo
   IdentityFile  ~/.ssh/id_foo

I've already uninstalled / reinstalled the workflow. Any suggestions?

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

verifying github.com/bmatcuk/[email protected]: checksum mismatch
	downloaded: h1:pU59Kfv7FNj48wpr3s2/S7OnFkJhsSKHcPL9stQkXGo=
	go.sum:     h1:p0ybUUk/Dh+yetkg3v0Yhi/ujMiet/gztYQnxNXfsyw=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Option to load config from ~/.ssh/config.d/* folder

As of OpenSSH 7.3, there's an Include option in .ssh/config file that reads the folder that you set in .ssh/config with Include .ssh/config.d for example. It would be nice if you can add a possibility to use custom folder.

Thanks

iTerm does not work

iTerm(3.2.9) does not work properly after i installed this plugin for Alfred(3.8.1) and configured.

First,I entered an ssh command in Alfred,
image
iTerm is started, but no commands are executed.

There are some errors in Alfred's log:

[2019-07-06 11:31:34][input.scriptfilter] Processing output of 'utility.debug' with arg 'ssh://111.120.240.181'
[2019-07-06 11:31:34][utility.debug] .
/-------- SSH ---------\
query="ssh://111.120.240.181"
variables=
{
    "AW_SESSION_ID" = Z1ML6GNM3AXSMBIEFN1UPQEZ;
    "DISABLE_CONFIG" = 1;
    "DISABLE_ETC_CONFIG" = 0;
    "DISABLE_ETC_HOSTS" = 0;
    "DISABLE_HISTORY" = 0;
    "DISABLE_KNOWN_HOSTS" = 0;
    "EXIT_ON_SUCCESS" = 1;
    "MOSH_CMD" = mosh;
    "SFTP_APP" = "";
    "SSH_APP" = "";
    "SSH_CMD" = "";
    hostname = "111.120.240.181";
    name = "111.120.240.181";
    port = 22;
    query = "111.120.240.181";
    "shell_cmd" = 0;
    source = history;
    url = "ssh://111.120.240.181";
}
\-------- SSH ---------/
[2019-07-06 11:31:34][utility.debug] Processing output of 'utility.filter' with arg 'ssh://111.120.240.181'
[2019-07-06 11:31:34][utility.debug] Processing output of 'utility.filter' with arg 'ssh://111.120.240.181'
[2019-07-06 11:31:34][utility.filter] Processing output of 'action.script' with arg 'ssh://111.120.240.181'
[2019-07-06 11:31:34][utility.debug] Processing output of 'utility.filter' with arg 'ssh://111.120.240.181'
[2019-07-06 11:31:34][ERROR: action.script] 🍺
11:31:34 workflow.go:319: -------- Secure SHell/0.8.0 (AwGo/0.14.0) --------
11:31:34 alfred_bind.go:272: [bind] unbindable kind: ptr
11:31:34 assh.go:537: options=
&{Check:false Config:false Demo:false Forget:false Open:true Print:false PrintDataDir:false PrintCacheDir:false PrintDistName:false PrintLogFile:false Remember:false Search:false Toggle:false RawInput: RawURL:ssh://111.120.240.181 VarName: DisableConfig:true DisableEtcConfig:false DisableEtcHosts:false DisableHistory:false DisableKnownHosts:false ExitOnSuccess:true MoshCmd:mosh SFTPApp: SSHApp: SSHCmd: query: url:0xc420129280 username: port:0 historyPath:/Users/huangweiyang/Library/Application Support/Alfred 3/Workflow Data/net.deanishe.alfred-ssh/history.json}
11:31:34 update.go:167: Never checked for updates
11:31:34 assh.go:287: Opening URL ssh://111.120.240.181
11:31:34 assh.go:295: Command: /usr/bin/open [open ssh://111.120.240.181]
11:31:34 workflow.go:399: ------------------ 87.056084ms -------------------
[2019-07-06 11:31:34][action.script] Processing output of 'output.notification' with arg ''

My iTerm configuration:
image

I need some help, thx!

Dependabot can't resolve your Go dependency files

Dependabot can't resolve your Go dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

verifying github.com/bmatcuk/[email protected]: checksum mismatch
	downloaded: h1:pU59Kfv7FNj48wpr3s2/S7OnFkJhsSKHcPL9stQkXGo=
	go.sum:     h1:p0ybUUk/Dh+yetkg3v0Yhi/ujMiet/gztYQnxNXfsyw=

SECURITY ERROR
This download does NOT match an earlier download recorded in go.sum.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Add support for `Include`

The ~/.ssh/config file supports an Include directive to load more config files, making it easier to separate groups of hosts. For example:

# ~/.ssh/config
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_rsa_work

Include ~/.ssh/config_work
Include ~/.ssh/config_private

Hosts from these Included configuration files should also be shown.

History doesn't work

Remembering user-entered hostnames doesn't work anymore... I'm not sure about the cause, I've noticed it after updating to 0.8.0 and macOS 10.13.4.

Set a ssh/mosh command

Is there any way to set a ssh/mosh default command as tmux or similar?. I mean, when I type ssh remotehost in Alfred what I would like is to get something like mosh remotehost -- tmux. Dunno if it can be setted in MOSH_CMD but I guess it can't.

Any tip?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.