Code Monkey home page Code Monkey logo

geofront-cli's Introduction

Geofront CLI client

Latest PyPI version Build status (Travis CI) Build status (AppVeyor)

It provides a CLI client for Geofront, a simple SSH key management server.

Installation

It is available on PyPI, so you can install it using pip installer. We, however, recommend to use pipsi instead so that geofront-cli and its dependencies don't make your global site-packages messy.

$ pipsi install geofront-cli

Getting started

What you have to do first of all is to configure the Geofront server URL. Type geofront-cli start and then it will show a prompt:

$ geofront-cli start
Geofront server URL:

We suppose http://example.com/ here. It will open an authentication page in your default web browser:

$ geofront-cli start
Geofront server URL: http://example.com/
Continue to authenticate in your web browser...
Press return to continue

List available remotes

You can list the available remotes using geofront-cli remotes command:

$ geofront-cli remotes
web-1
web-2
web-3
worker-1
worker-2
db-1
db-2

If you give -v/--verbose option it will show their actual addresses as well:

SSH to remote

You can easily connect to a remote through SSH. Use geofront-cli ssh command instead of vanilla ssh:

$ geofront-cli ssh web-1
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 2.6.32-042stab078.27 i686)

 * Documentation:  https://help.ubuntu.com/
ubuntu@web-1:~$

In most cases, you probably need to list remotes to find an alias to SSH before run geofront-cli ssh command. geofront-cli go command is a single command for these two actions at once:

$ geofront-cli go
(...interactive fuzzy finder for remotes is shown...)
Welcome to Ubuntu 12.04.3 LTS (GNU/Linux 2.6.32-042stab078.27 i686)

 * Documentation:  https://help.ubuntu.com/
ubuntu@web-1:~$

Note that there's a shortcut command gfg which is an alias of geofront-cli go.

There is geofront-cli scp command as well, which is corresponding to scp:

$ geofront-cli scp file.txt web-1:file.txt
file.txt                                      100% 3157     3.1KB/s   00:00
$ geofront-cli scp -r web-1:path/etc/apt ./
sources.list                                  100% 3157     3.1KB/s   00:00
trusted.gpg                                   100%   14KB  13.9KB/s   00:00

Missing features

  • Shortcut for geofront-cli ssh command
  • Make geofront-cli ssh similar to ssh
  • Autocompletion

Author and license

Hong Minhee wrote geofront-cli, and Spoqa maintains it. It is licensed under GPLv3 or later.

Changelog

Version 0.4.5

To be released.

Version 0.4.4

Released on April 03, 2020.

  • Fixed some command won't work properly. This bug occured when running ssh or scp command through the other command. (e.g. geofront-cli go) [#19 by cynthia]

Version 0.4.3

Released on March 25, 2020.

  • Added jump host options to use ProxyJump in SSH. [#18 by cynthia]

Version 0.4.2

Released on February 26, 2020.

  • Added supporting for LibreSSL. [#16 by cynthia]

Version 0.4.1

Released on May 24, 2017.

  • Fixed a bug that geofront-cli go/gfg had crashed with AttributeError when a user cancelled (i.e. Ctrl-C) to select a remote. [#10]

Version 0.4.0

Released on May 23, 2017.

  • Dropped support of Python 2.6 and 3.2.
  • geofront-cli go command and its alias shortcut gfg were introduced. It's an interactive user interface to select a remote and SSH to it at once.
  • Fixed verification failure of SSL certificates when Python was installed using Homebrew on macOS. Now it depends on Certifi.
  • Now the output list of geofront-cli remotes is sorted.
  • The second column of geofront-cli remotes --verbose result became vertically aligned.
  • The second column of geofront-cli remotes --verbose result became to omit the port number if it's 22 so that these are easy to copy-and-paste into other SSH programs.
  • Loading spinners became shown when time-taking tasks are running.

Version 0.3.4

Released on April 3, 2017.

  • Fixed UnicodeError during signing the running Python 3 executable on macOS.

Version 0.3.3

Released on March 30, 2017.

Version 0.3.2

Released on May 31, 2016.

  • Fixed ImportError on Python 2.6.

Version 0.3.1

Released on May 28, 2016.

  • Forward compatibility with Geofront 0.4.

Version 0.3.0

Released on January 15, 2016.

  • Fixed an AttributeError during handling error sent by server. [#4]

Version 0.2.2

Released on November 14, 2014.

  • Added -v/--version option.
  • Fixed an AttributeError during handling error from server. [#2, #3 by Lee Jaeyoung]

Version 0.2.1

Released on June 29, 2014.

  • Added geofront-cli scp command.
  • Added the short option -S for --ssh.
  • It becomes to no more depend on dirspec. Instead it's simply bundled together.
  • geofront-cli now prints a usage description when no subcommand specified.

Version 0.2.0

Released on May 3, 2014.

  • Added handling of unfinished authentication error.
  • Added handling of incompatible protocol version.

Version 0.1.1

Released on April 22, 2014.

  • Fixed Python 2 incompatibility.
  • Added warning for non-SSL server URL.

Version 0.1.0

First pre-alpha release. Released on April 21, 2014.

geofront-cli's People

Contributors

csjune avatar cynthia avatar dahlia avatar hanc1208 avatar jeyraof avatar kanghyojun avatar ravikim 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

Watchers

 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

geofront-cli's Issues

There is no geofront-cli 0.3.0 but version of geofront on the server is 0.3.0.

So I can't access my server with a command geofront-cli ssh.

$ geofront-cli ssh [email protected]
geofront-cli seems incompatible with the server.
Try `pip install --upgrade geofront-cli` command.
The server version is 0.3.0.
$ sudo pip install --upgrade geofront-cli==0.3.0
Downloading/unpacking geofront-cli==0.3.0
  Could not find a version that satisfies the requirement geofront-cli==0.3.0 (from versions: 0.1.1, 0.2.0, 0.2.1, 0.1.0, 0.1.1, 0.2.0, 0.2.1, 0.2.2)
Cleaning up...
No distributions matching the version for geofront-cli==0.3.0
Storing debug log for failure in /Users/aioo/.pip/pip.log

AttributeError raised after cancel gfg command.

i got below error after cancel gfg choose nothing and press esc.

Total 33 remotes.
                                                         Traceback (most recent call last):
  File "~/.local/bin/gfg", line 11, in <module>
    sys.exit(main_go())
  File "~/.local/venvs/geofront-cli/lib/python2.7/site-packages/geofrontcli/cli.py", line 492, in main_go
    main(['go'])
  File "~/.local/venvs/geofront-cli/lib/python2.7/site-packages/geofrontcli/cli.py", line 475, in main
    args.function(args)
  File "~/.local/venvs/geofront-cli/lib/python2.7/site-packages/geofrontcli/cli.py", line 404, in go
    alias = chosen.split()[0]
AttributeError: 'NoneType' object has no attribute 'split'

geofront-cli version is 0.4.0.

No which command on Windows

I tried and got another error

Traceback (most recent call last):
  File "C:\Python27\Scripts\geofront-cli-script.py", line 9, in <module>
    load_entry_point('geofront-cli==0.2.2', 'console_scripts', 'geofront-cli')()
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 458, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 2545, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 2244, in load
    ['__name__'])
  File "C:\Python27\lib\site-packages\geofrontcli\cli.py", line 28, in <module>
    SSH_PROGRAM = subprocess.check_output(['which', 'ssh']).strip() or None
  File "C:\Python27\lib\subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 710, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 958, in _execute_child
    startupinfo)
WindowsError: [Error 2] The system cannot find the file specified

Windows doesn't have which command. I think it would be where instead on Windows

Jumphosts

Quite a few companies (including the one I work at) have issued work from home policies due to the recent outbreak. Unfortunately, quite a few companies also lack a proper VPN infrastructure - meaning most work needs to be done through a bastion server.

It would be super useful to have support for jump hosts. (it's a feature that is supported in modern versions of OpenSSH through the -J command line parameter.)

If the maintainers are willing to land a patch given a PR, I'd be happy to take a whack at this.

AttributeError: '_io.BytesIO' object has no attribute 'headers'

Traceback (most recent call last):
  File "/usr/bin/geofront-cli", line 9, in <module>
    load_entry_point('geofront-cli==0.2.2', 'console_scripts', 'geofront-cli')()
  File "/usr/lib/python3.4/site-packages/geofrontcli/cli.py", line 416, in main
    args.function(args)
  File "/usr/lib/python3.4/site-packages/geofrontcli/cli.py", line 354, in scp
    src_client, src_remote, src_path = parse_scp_path(args.source, args)
  File "/usr/lib/python3.4/site-packages/geofrontcli/cli.py", line 337, in parse_scp_path
    remote = client.authorize(alias)
  File "/usr/lib/python3.4/site-packages/geofrontcli/client.py", line 189, in authorize
    mimetype, _ = parse_mimetype(r.headers['Content-Type'])
AttributeError: '_io.BytesIO' object has no attribute 'headers'

misused attribute on io

$ geofront-cli start
Geofront server URL: http://ec2-54-199-24-79.ap-northeast-1.compute.amazonaws.com/
It is not a secure URL. https:// is preferred over http://. Continue (y/N)? y
Continue to authenticate in your web browser...
Press return to continue
Traceback (most recent call last):
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/bin/geofront-cli", line 9, in <module>
    load_entry_point('geofront-cli==0.2.1', 'console_scripts', 'geofront-cli')()
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/site-packages/geofrontcli/cli.py", line 413, in main
    args.function(args)
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/site-packages/geofrontcli/cli.py", line 101, in start
    authenticate.call(args)
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/site-packages/geofrontcli/cli.py", line 139, in authenticate
    if public_key and public_key.fingerprint not in client.public_keys:
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/_abcoll.py", line 369, in __contains__
    self[key]
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/site-packages/geofrontcli/client.py", line 236, in __getitem__
    code, body, error = self._request((fprint,))
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/site-packages/geofrontcli/client.py", line 214, in _request
    with self.client.request(method, path, data, headers) as resp:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/Users/leejaeyoung/Work/.py_envs/tmp-8a240c25debc26fe/lib/python2.7/site-packages/geofrontcli/client.py", line 113, in request
    buffered = io.ByteIO(read)
AttributeError: 'module' object has no attribute 'ByteIO'

scp command

Shortcut for geofront-cli authorize remote && scp file remote:path/.

module import error on Windows

I got following error when I tried to do geofront-cli start

Traceback (most recent call last):
  File "C:\Python27\Scripts\geofront-cli-script.py", line 9, in <module>
    load_entry_point('geofront-cli==0.2.2', 'console_scripts', 'geofront-cli')()
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 458, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 2545, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 2244, in load
    ['__name__'])
  File "C:\Python27\lib\site-packages\geofrontcli\cli.py", line 13, in <module>
    from dirspec.basedir import load_config_paths, save_config_path
  File "C:\Python27\lib\site-packages\dirspec\basedir.py", line 22, in <module>
    from dirspec.utils import (default_cache_home,
  File "C:\Python27\lib\site-packages\dirspec\utils.py", line 161, in <module>
    special_folders = get_special_folders()
  File "C:\Python27\lib\site-packages\dirspec\utils.py", line 138, in get_special_folders
    from win32com.shell import shell, shellcon
ImportError: No module named win32com.shell

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.