Commit Graph

29 Commits (e8897a9b917be47431df68141c3977f3ab57942e)

Author SHA1 Message Date
Alexey Shabalin 9be8ecda06 Add support ssh configs from /etc/openssh.
In Altlinux system config dir for openssh is /etc/openssh.
2016-01-14 13:01:49 +03:00
Yannig Perré be4d1f9ee3 Fix a part of python 3 tests (make tests-py3, see https://github.com/ansible/ansible/issues/13553 for more details). 2015-12-15 13:37:35 +01:00
Michael Scherer a7ac98262d Make module_utils.known_hosts.get_fqdn work on ipv6 2015-12-14 19:30:54 +01:00
James Cammarata 80d23d639c Use an octal representation that works from 2.4->3+ for known_hosts 2015-12-14 10:43:30 -05:00
James Cammarata 6312e38133 Fixing up some non-py3 things for unit tests 2015-12-14 10:35:58 -05:00
Toshio Kuratomi 9ce3adbeb1 remove assigned but unused variables in module_utils.
These were mostly saving exceptions but not using them.  Getting rid of
those will help with eventually running modules via either python2.4 or
python3.x.
2015-11-03 09:53:18 -08:00
Toshio Kuratomi 1bc75374dc Add imports for stdlib modules that are used.
This is cleanup that will aid us when we get ziploader implemented for 2.1
2015-11-02 12:02:26 -08:00
Desmond O. Chang 58c3539196 Add host key for ssh url only.
Rewrite function `get_fqdn`.  It returns fqdn for all kinds of urls now.

`add_git_host_key` determines whether a url is ssh and whether its host
key should be added.
2015-08-31 13:42:32 -07:00
Toshio Kuratomi 3b80f63e22 Have known_hosts function use the url parameter instead of getting a specific attribute out of the module dict.
This makes the function useful in more places
2014-12-04 11:39:35 -08:00
Matt Coddington 10113e6a67 python2.4 compatibility issue with urlparse 2014-10-13 16:07:06 -04:00
Casey Fitzpatrick 7115cb1f37 removed port from domain name qualification, fixes 7941 2014-07-02 19:54:50 -04:00
James Cammarata 360d8b0fc2 Don't try to scan SSH signatures for non-ssh urls
Fixes #7812
2014-06-18 14:22:20 -05:00
Matt Bray 578e881142 fix for urls like ssh://git@github.com/ansible/ansible.git 2014-06-16 11:58:59 +01:00
James Cammarata 3fb3e7e6dc Properly parse urls for ssh-keyscan use
Previously, the get_fqdn() function in known_hosts.py only worked
with urls that started with git@, and ignored any urls that started
with a normal schema type (ie. http:// or ssh://). This patch corrects
that by using urlparse to parse the hostname portion out of urls that
have a proper schema.

Fixes #7474
2014-06-12 16:16:42 -05:00
Michal Mach 60451c20ab Fix known_hosts.py to work on older versions of python 2014-05-14 22:36:32 +02:00
James Cammarata b698f7a44b Add option to create host_key directory if it doesn't exist
Fixes #6731
2014-03-30 01:34:33 -05:00
Cristian Ciupitu 1eaf85b89f Micro-optimization: replace s.find(x)!=-1 with x in s
timeit shows a speedup of ~3x on Python 2.7.5 x86_64.
It also makes the code a bit shorter.
2014-03-27 20:35:20 +02:00
James Cammarata bc93732b1d Catch permissions errors related to opening a known_hosts file in modules
Fixes #6644
2014-03-24 16:32:31 -05:00
Francisco José Marques Vieira e9d7476c28 Add missing sha1 import on known_hosts.py 2014-03-23 17:19:23 +00:00
patrickheeney a9aab23f11 Fix for hostkey directory 2014-03-17 09:00:08 -07:00
Michael DeHaan d37f0c6d12 Use same implementation as ssh.py for "is in host file" checks in module code, prevents git module from adding keys more than once. 2014-03-12 14:11:45 -04:00
Michael DeHaan cfabc2e28a module.run_command is intended to bypass the shell here, so can't do ">>" 2014-03-12 10:57:49 -04:00
James Cammarata 9730157525 Validate SSL certs accessed through urllib*
* Adds another module utility file which generalizes the
  access of urls via the urllib* libraries.
* Adds a new spec generator for common arguments.
* Makes the user-agent string configurable.

Fixes #6211
2014-03-10 16:06:52 -05:00
James Tanner 3ec043ec17 Fixes #5750 Fail on missing ~/.ssh and ignore accept_hostkey if stricthoskeychecking is off 2014-01-28 11:49:35 -05:00
Rob Smith 953dc6b345 When not finding a host in ~/.ssh/known_hosts, the return value is 0 if the host just is not found. We then never check the system host file in /etc. This fixes the code to check /etc on any failure, not just a bad return code. 2014-01-20 18:56:39 -08:00
Rob Smith c15cffabdd This fixes bugs added as a part of 8665b0638a
1. if accept_hostkey is false, no matter if the host key is known or not, it will fail.

2. We don't check for the host key in /etc/ssh/ssh_known_hosts

This fixes both of those issues.
2014-01-12 02:12:44 -08:00
James Tanner 3719f3f496 Do not fetch or add keys for http based git urls 2014-01-11 15:15:23 -05:00
James Tanner eeee1e1c5a Set accept_hostkey to False by default in the git module and fail
early if the key is unknown
2014-01-11 11:02:01 -05:00
James Tanner 8665b0638a Add an "accept_hostkey" parameter to the git module to help automatically
accept hostkeys for git repos and prevent task hangs when the key is unknown
2014-01-11 10:36:45 -05:00