Git Product home page Git Product logo

tmuxpair's Introduction

tmuxpair

Build Status

Command line script for setting up a temporary tmux session for pair programming.

© 2016 by Michael Goerz. This software is available under the terms of the MIT license.

Installation & Usage

Using virtualenv/pipsi/conda env is recommended. Install the tmuxpair executable with

pip install tmuxpair

Run tmuxpair -h for usage details.

Reasonably Secure Pair Programming

A simple yet powerful way for pair programming is to have a partner connect to a tmux session on your machine. However, this implies that you give them SSH access, with the obvious security implications: Your partner now has complete control over your user account. They could use scp to copy any of your files, read your email, or pull a prank on you by messing with your .bashrc.

While you should probably only engage in pair programming with people that you place a certain minimum amount of trust in, it would be nice to eliminate at least the obvious ways for your partner to do anything behind your back. tmuxpair achieves this by using key-based authentication together with the feature of SSH to limit a key to a specific command. This follows the approach outlined in Tres Trantham’s blog post. Note that we also lock down scp access and port forwarding (which could allow your partner to access any firewalled server on your network).

We can go a little further in ensuring only supervised access by strictly limiting your partner’s connection to the duration of the pair-programming session.tmuxpair does this by by wrapping tmux; when you run e.g.

tmuxpair partner_key.pub

the public key in the file partner_key.pub is temporarily appended to your ~/.ssh/authorized_keys file (with the appropriate options), and tmuxpair attaches to a tmux session “pair”. As soon as the session ends – or you detach from it! – your partner’s SSH connection is closed and the original authorized_keys file is restored.

Of course, if your partner were sufficiently determined to break into your system, they could still manage to do so. Our assumption here is that supervised access is “reasonably secure” in most environments. If your partner does not need write access, tmuxpair provides a view-only mode that should not leave any security loopholes.

Security could be enhanced further by running the tmux session under a separate and dedicated account instead of your normal user account. However, the purpose of the tmuxpair script is to provide a robust solution that allows you to quickly share a terminal with a colleague, without any further setup.

tmuxpair's People

Contributors

goerz 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

Watchers

 avatar  avatar

Forkers

doytsujin

tmuxpair's Issues

Empty key error if file has blank line at the end

Hello, nice library :)
I was going to play with tmuxpair and running the commando to startup throws this error:

~/Documents/keys $ tmuxpair windows_key.pub                                                                                        
Cleaning up, restoring /Users/myuser/.ssh/authorized_keys...
Done.
Traceback (most recent call last):
  File "/usr/local/bin/tmuxpair", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/tmuxpair.py", line 212, in main
    keys_data = AuthorizedKeys.read(file)
  File "/usr/local/lib/python2.7/site-packages/tmuxpair.py", line 71, in read
    key = sshkeys.Key.from_pubkey_line(line)
  File "/usr/local/lib/python2.7/site-packages/sshkeys/__init__.py", line 146, in from_pubkey_line
    raise ValueError("Empty key")
ValueError: Empty key

the problem was basically the blank line added from a copy-paste, after deleting the command worked great.

I think the lib should strip the entire file before try to load it.
I'm no good at python, but I suspect we could strip at this line(or create one before):
https://github.com/goerz/tmuxpair/blob/develop/tmuxpair.py#L73

I can make a PR if you want.
Thanks

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.