Giter VIP home page Giter VIP logo

lssh's Introduction

lssh - Leitwerk SSH Wrapper

This wrapper-tool is suitable to be used in organizations for accessing ssh hosts.

A central git repository contains the ssh configuration for all your hosts and will be accessed by all users of lssh.

Features

  • Searching hosts by specifying keywords (matching hostname, or the filename that contains the host)
  • Possibility to specify multiple keywords for filtering hosts
  • A tui dialog to choose one of the hosts matching the given keywords
  • Checks additional keywords that are given in your central configuration (per file or per host)
  • Automatic session recording of each ssh session in the home directory of the calling user with a replay command option
  • SSH command options are passed through
  • Tab-completion for Bash
  • Automatically starts and uses an ssh-agent if not already started
  • The ssh configuration of the git repository is included in the official ssh configuration file, so all hosts are also accessible using ssh, without the wrapper.
  • The include of the ssh configuration is protected by a security validation to prevent code execution.

Install

Requirements

The following Python packages have to be installed via pip or or package manager: xgd, cui

Debian

For the debian linux distribution, there is an install-script that installs lssh for all users and must be run as root:
./install/debian-systemwide-install <git_repo_url>
Replace <git_repo_url> with the clone url of your ssh configuration repository, that must be formatted as described in SSH config format

There is also a corresponding uninstaller:
./install/debian-systemwide-uninstall

Other distributions

If you use another distribution or want custom settings, you can also install and configure lssh manually.
See Installing lssh manually.

Using lssh

After successful installation, run lssh --help to see the possible commands and options.

lssh's People

Contributors

lfuerderer avatar leitwerk-ag avatar cfrietschy avatar

Stargazers

 avatar Sebastian avatar  avatar Daniel Haas avatar

Watchers

 avatar

Forkers

twoface24

lssh's Issues

config_validation.py fails when "Host" contains a whitespace

example excerpt from config:

Host best host
    HostName 1.2.3.4
    User admin

results in this output when running /var/local/lssh/pull.sh:

example-file.txt: Option HostName is not allowed on line 1114, only allowed in an explicit Host section (one host, no wildcards)
Could not completely import the new config because of this error
Files containing errors will not be updated.

modifying the config to look like this (no whitespace in hostname), all is fine:

Host best_host
    HostName 1.2.3.4
    User admin

Support Python 3.9

os.environ.putenv("TERM", "xterm-256color")

lssh throws the following error if is it started inside tmux

Traceback (most recent call last):
  File "/usr/local/bin/lssh", line 14, in <module>
    main.main(hosts_dir, update_hosts)
  File "/usr/local/lib/lssh/main.py", line 20, in main
    cli.main(hosts_dir, update_hosts, attributes)
  File "/usr/local/lib/lssh/cli.py", line 113, in main
    connect(args, user, substring, additional_substrings, hosts_dir)
  File "/usr/local/lib/lssh/cli.py", line 169, in connect
    selected, proxy_chain = select_host(substring, additional_substrings, hosts_dir)
  File "/usr/local/lib/lssh/cli.py", line 159, in select_host
    choice = tui_dialog.hierarchical_option_dialog(options, displaynames, 'select customer', 'select host')
  File "/usr/local/lib/lssh/tui_dialog.py", line 58, in hierarchical_option_dialog
    term_variable_workaround()
  File "/usr/local/lib/lssh/tui_dialog.py", line 9, in term_variable_workaround
    os.environ.putenv("TERM", "xterm-256color")
AttributeError: '_Environ' object has no attribute 'putenv'

Support Python 3.12

Lssh throws the following errors in a python3.12 environment:

/usr/local/lib/lssh/hostlist.py:40: SyntaxWarning: invalid escape sequence '\s'
m = re.match('^\sHost\s+([\S]+)\s$', line, re.IGNORECASE)
/usr/local/lib/lssh/hostlist.py:48: SyntaxWarning: invalid escape sequence '\s'
m = re.match('^\sproxyjump\s+([\S]+)\s$', line, re.IGNORECASE)
/usr/local/lib/lssh/hostlist.py:51: SyntaxWarning: invalid escape sequence '\s'
m = re.match('^\s*#\slssh:(file)?keywords\s(.)$', line, re.IGNORECASE)
/usr/local/lib/lssh/hostlist.py:61: SyntaxWarning: invalid escape sequence '\s'
m = re.match('^\s*#\slssh:displayname\s+(\S.)$', line, re.IGNORECASE)
/usr/local/lib/lssh/hostlist.py:64: SyntaxWarning: invalid escape sequence '\s'
m = re.match('^\s*#\slssh:assignedcustomer\s+(\S.)$', line, re.IGNORECASE)
/usr/local/lib/lssh/config_validation.py:264: SyntaxWarning: invalid escape sequence '\S'
m = re.match('^(\s*)([a-zA-Z]+)(\s+)(\S.*)$', line)

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.