70 Commits

Author SHA1 Message Date
Carlo Contavalli
66a0010405 Merge pull request #66 from zapp42/replace-distutils
Replace deprecated distutils usage with shutil.which(). Fixes Issue #65
2021-09-30 17:12:04 -07:00
Rolf Offermanns
436200a60c Replace deprecated distutils usage with shutil.which(). Fixes Issue #65 2021-10-01 01:01:27 +02:00
Carlo Contavalli
fbdcc65738 Merge pull request #39 from jsoref/spelling
Fix spelling of a few comments, thanks to jsoref.
2017-05-26 10:34:01 +02:00
Josh Soref
8c1465e8c4 spelling: specific 2017-05-26 06:42:45 +00:00
Josh Soref
6eeeb86f8c spelling: parameter 2017-05-26 06:42:19 +00:00
Carlo Contavalli
b6896bcf2a Merge pull request #33 from dracos/patch-1
Fix typo in two debug lines
2016-11-26 10:37:56 -08:00
Carlo Contavalli
e6145bdf0a Connect ssh-add to the session tty, allow ssh-ident to run with no tty.
Background:
when the 'ssh' command is run, its stdin and stdout are often connected
to pipes. Think about rsync, git, scp, ...

ssh-ident internally calls ssh-add. If ssh-add does not have a terminal
for stdin and stdout, it can't read a password, so it invokes ssh-askpass,
and FAILS if ssh-askpass cannot be found.

Which is annoying for a few reasons:
- ssh-askpass becomes a requirement to use ssh-ident.
  ssh-add will fail if it can't find it :(
- ssh-askpass is invoked even in cases where, well, a terminal
  would normally be used.

In this change:
- when running ssh-add, connect its stdin and stdout to a suitable
  terminal.
- add code to detect a 'suitable' terminal.

The logic to determine what 'suitable' here is more complex than
it should be. Normally one would just check if stdin / stdout are
terminals. But this does not work here (see background).

So instead the code checks if 1) there is a /dev/tty, and 2) this
/dev/tty is an usable tty. 2) is necessary because in some cases
/dev/tty exists, is readable and writable, it is a character device,
but using it as a terminal returns ENXIO or ENODEV.

So the detection code does a 'noop' tty ioctl, in order to detect
ENXIO and ENODEV. If no error is returned, then it is a dvice.

Terminals are black magic.
This (hopefully) closes #29, and closes #32.
2016-11-26 08:06:03 -08:00
Carlo Contavalli
9f3b145cf7 Fix steps to build a .deb file in documentation. Closes #27, finally.
Thanks to github.com/irnc for opening the bug and providing the fixed
instructions.
2016-11-26 06:33:32 -08:00
Carlo Contavalli
728d34bf44 Fix documentation to use VARIABLE = ASSIGNMENT rather than "DICT":
"ASSIGNMENT" syntax everywhere.

For some reason, when I wrote the documentation I was assuming a dict
was used for configuration parameters. Closes #20.
2016-11-26 06:30:56 -08:00
M Somerville
186c1ac367 Fix typo in two debug lines 2016-09-06 16:47:46 +01:00
Carlo Contavalli
ae7c6b3e6a Merge pull request #26 from adamglauser/ssh-ident-bug-25
Fix config file syntax in README
2016-07-30 12:54:43 -07:00
Adam Glauser
c5f4f8b5b1 Fix config file syntax in README
The syntax for the SSH_DEFAULT_OPTIONS setting is not correct in the
README file, and causes a runtime error as is.
2016-07-22 12:07:35 -04:00
Carlo Contavalli
ebf8282728 Don't clean the environment before running the ssh command.
Background:
Whenever ssh was run, before this change, ssh-ident cleaned the
environment.

However, this breaks users that set SSH_ASKPASS, or even things
like the LOCALE settings or DISPLAY.

After this change, the environment is no longer cleaned.
Thanks to eugenesvk for reporting the issue.

This should fix #18.
2016-04-21 10:17:00 -07:00
Carlo Contavalli
59ffe3a64c Updated README, after latest changes to the docstrings. 2016-04-21 10:16:37 -07:00
Carlo Contavalli
a7e695aa64 Explicitly number {} arguments to python .format.
python 2.6 and 3.0 require string.format() arguments to be
number explicitly, otherwise they raise ValueError.
Fixed code to number them.

This fixes #14.
2016-04-21 10:04:23 -07:00
Carlo Contavalli
5769cb0e39 Merge branch 'black2754-autodetect_binary' 2016-04-21 09:48:50 -07:00
Carlo Contavalli
945e11159e Disable BINARY_DIR by default, as it was meant to be.
Previous change had enabled BINARY_DIR by default
unintentionally.
2016-04-21 09:37:40 -07:00
Carlo Contavalli
3267764ee9 Add parameter 'BINARY_DIR'.
Background:
ssh-ident needs to determine which binary to run next
to complete the requested command. Generally, this binary
is 'ssh'.

With previous changes (thanks to black2754), code was added
to detect the binary to run based on argv[0], and to find
it in PATH.

Depending on the setup, this can be fragile as argv[0] may
not contain a path at all, or the path in $PATH may contain
symlinks or bind mounts, which would be difficult to exclude.

In this change:
- if BINARY_DIR is set, look for the next binary to run
  in that directory only. This could be set to "/usr/bin"
  on most unix systems.
  This is optional, the default is still to search in
  the path.

Additionally:
- be a bit more paranoid when searching in PATH. Specifically,
  handle relative paths without defaulting to the CWD.
- add more verbose messages, as those problems may be difficult
  or obscure to debug.
2016-04-21 09:30:29 -07:00
Carlo Contavalli
225c959818 Make the code tolerant to PATH with repeated directories.
... additionally, comment on the need for some path cleansing.
2016-04-17 06:49:03 -07:00
Black
77d2f3f382 Automatically detect the ssh/scp/... binary to use 2016-03-20 17:08:57 +01:00
Carlo Contavalli
bc00a5919b Updated CREDITS and README file. 2016-01-20 22:22:39 -08:00
Carlo Contavalli
c241e0801a Pass -oUseRoaming=no by default, provide facilities to pass different
options per identity, and to debug the generated command.

In this change:

- introduced a few more configuration parameters to have
  default flags passed to ssh, and per identity flags.

- when VERBOSITY=LOG_DEBUG ssh-ident is called, the generated
  ssh command is now displayed. Used to verify correct
  behavior of code.
2016-01-20 22:14:36 -08:00
Carlo Contavalli
5a86bc9218 Merge pull request #11 from drougge/default_config
Don't ignore global ssh_config by default.

From pull request:
"""
Specifying a config file to ssh makes it impossible to also read the global
config. Which is daft, but that's what ssh does. So I've removed ~/.ssh as
a place to look for configs, on the principle that not specifying any
config will read both the global ssh_config and ~/.ssh/config, and that's
the expected default behaviour.
"""
Any identity specific config will still ignore the global config, but that
seems fine to me.
2016-01-20 21:31:47 -08:00
Carlo Contavalli
751622b61e Merge pull request #10 from drougge/python_location
Don't assume python is in /usr/bin
2016-01-20 21:27:32 -08:00
Carl Drougge
ba057ba296 Don't ignore global ssh_config by default.
Specifying a config file to ssh makes it impossible to also read the global
config. Which is daft, but that's what ssh does. So I've removed ~/.ssh as
a place to look for configs, on the principle that not specifying any
config will read both the global ssh_config and ~/.ssh/config, and that's
the expected default behaviour.

Any identity specific config will still ignore the global config, but that
seems fine to me.
2016-01-13 15:57:52 +01:00
Carl Drougge
8bba760bd9 Don't assume python is in /usr/bin 2016-01-10 15:36:19 +01:00
Carlo Contavalli
9d4658cb4e Merge branch 'mheap-master' 2015-12-11 17:28:07 -08:00
Michael Heap
5a994d1d33 New: Added support for per-identity SSH config files 2015-11-17 21:31:48 +00:00
Black
9682500d7d Added VERBOSITY option to control the output verbosity 2015-01-27 20:49:32 +01:00
Black
05806d7468 Added support for BatchMode: ssh-ident will not load keys or output anything in this mode 2015-01-25 15:05:12 +01:00
Black
acde54bb65 Added modeline for vim 2015-01-25 15:04:35 +01:00
Carlo Contavalli
d111e2fbc5 Update documentation to mention the 7200s life time for keys, by
default.
2014-11-07 18:48:04 -08:00
Carlo Contavalli
1cef4098c6 By default, don't keep keys in memory for more than two hours. 2014-11-07 18:45:47 -08:00
Carlo Contavalli
e93963de5a Provide simple installation instrucitons. 2014-11-07 18:42:22 -08:00
Carlo Contavalli
816354cd40 GIT Ignore ssh-identc (compiled ssh-ident). 2014-10-09 21:54:05 -07:00
Carlo Contavalli
3cdd9a4fe2 Remove whitespaces at the end of line, move "Requirements" section to
ssh-ident, where it was supposed to be to begin with, move from future
... after the file docstring (otherwise pydoc doesn't generate / show
the documentation correctly), and update the README with pydoc ssh-ident
> README.
2014-10-09 21:52:13 -07:00
Carlo Contavalli
e4b0c34e82 Removed extra spaces at the end of each line. 2014-10-09 21:46:53 -07:00
Carlo Contavalli
0f53957696 Added requirements section in README. 2014-10-09 21:46:09 -07:00
Carlo Contavalli
db17400360 Break some long lines into shorter ones. 2014-10-09 21:41:22 -07:00
Carlo Contavalli
c6c8674ab7 Merge branch 'scholarly-python3' 2014-10-09 21:40:35 -07:00
Terrel Shumway
239a4e3261 revert to /usr/bin/python
see http://legacy.python.org/dev/peps/pep-0394/ for rationale
2014-10-09 20:58:34 -06:00
Terrel Shumway
851acc1629 add to credits 2014-10-09 20:52:43 -06:00
Terrel Shumway
2b81a343b3 fix parenthesis
make it work on python2
2014-10-09 20:52:15 -06:00
Terrel Shumway
346698324a ignore vim droppings 2014-10-09 20:41:40 -06:00
Terrel Shumway
f4ea5582db update % interpolation to .format(...) 2014-10-09 20:40:53 -06:00
Terrel Shumway
a47b838f36 run 2to3
decode output from subprocess commands
2014-10-09 20:31:40 -06:00
Carlo Contavalli
c79954295f Updated README. 2014-06-23 00:58:16 -07:00
Carlo Contavalli
051e0fb4a1 Merge pull request #3 from fliphess/debian
add a dir structure for building .deb package
2014-06-23 00:38:10 -07:00
Flip Hess
d963a83a4a add a dir structure for building .deb package 2014-06-19 23:41:44 +02:00
Carlo Contavalli
d04467f8f3 Update README file as per last commit. 2014-05-02 09:05:10 -07:00