diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-03-08 12:25:56 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-20 11:27:45 +0000 |
commit | ad57dab31f5d91327cadac196e8d620bc9df551e (patch) | |
tree | d029231ed449572f34095b9d2dd35e6b69baa78a /scripts | |
parent | cb4b07838c267a09ebedba6c30ec25bda2cd11be (diff) | |
download | poky-ad57dab31f5d91327cadac196e8d620bc9df551e.tar.gz |
devtool: deploy-target: allow disabling host key checking
If you're testing with multiple images/devices that have the same IP
address / hostname then it can be annoying to deal with host key
mismatches all of the time. As a MITM attack is unlikely in the local
test environment, provide a command line option to pass the appropriate
options to scp/ssh to disable the host key checking.
Note: if you wish to apply this permanently, the best way is to do it
through your ssh configuration e.g. by adding the following to your
~/.ssh/config:
Host 192.168.7.2
UserKnownHostsFile=/dev/null
StrictHostKeyChecking no
(From OE-Core rev: 81dd1319112a99bc38b7a7ced0663918ac5b09a4)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/devtool/deploy.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py index 896b618e80..d232d3179f 100644 --- a/scripts/lib/devtool/deploy.py +++ b/scripts/lib/devtool/deploy.py | |||
@@ -1,6 +1,6 @@ | |||
1 | # Development tool - deploy/undeploy command plugin | 1 | # Development tool - deploy/undeploy command plugin |
2 | # | 2 | # |
3 | # Copyright (C) 2014 Intel Corporation | 3 | # Copyright (C) 2014-2015 Intel Corporation |
4 | # | 4 | # |
5 | # This program is free software; you can redistribute it and/or modify | 5 | # This program is free software; you can redistribute it and/or modify |
6 | # it under the terms of the GNU General Public License version 2 as | 6 | # it under the terms of the GNU General Public License version 2 as |
@@ -50,7 +50,10 @@ def deploy(args, config, basepath, workspace): | |||
50 | 50 | ||
51 | stdout, stderr = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True) | 51 | stdout, stderr = exec_build_env_command(config.init_path, basepath, 'bitbake -e %s' % args.recipename, shell=True) |
52 | recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1) | 52 | recipe_outdir = re.search(r'^D="(.*)"', stdout, re.MULTILINE).group(1) |
53 | ret = subprocess.call('scp -qr %s/* %s:%s' % (recipe_outdir, args.target, destdir), shell=True) | 53 | extraoptions = '' |
54 | if args.no_host_check: | ||
55 | extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | ||
56 | ret = subprocess.call('scp -qr %s %s/* %s:%s' % (extraoptions, recipe_outdir, args.target, destdir), shell=True) | ||
54 | if ret != 0: | 57 | if ret != 0: |
55 | return ret | 58 | return ret |
56 | 59 | ||
@@ -77,12 +80,16 @@ def undeploy(args, config, basepath, workspace): | |||
77 | logger.error('%s has not been deployed' % args.recipename) | 80 | logger.error('%s has not been deployed' % args.recipename) |
78 | return -1 | 81 | return -1 |
79 | 82 | ||
80 | ret = subprocess.call("scp -q %s %s:/tmp" % (deploy_file, args.target), shell=True) | 83 | extraoptions = '' |
84 | if args.no_host_check: | ||
85 | extraoptions += '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' | ||
86 | |||
87 | ret = subprocess.call("scp -q %s %s %s:/tmp" % (extraoptions, deploy_file, args.target), shell=True) | ||
81 | if ret != 0: | 88 | if ret != 0: |
82 | logger.error('Failed to copy %s to %s' % (deploy, args.target)) | 89 | logger.error('Failed to copy %s to %s' % (deploy, args.target)) |
83 | return -1 | 90 | return -1 |
84 | 91 | ||
85 | ret = subprocess.call("ssh %s 'xargs -n1 rm -f </tmp/%s'" % (args.target, os.path.basename(deploy_file)), shell=True) | 92 | ret = subprocess.call("ssh %s %s 'xargs -n1 rm -f </tmp/%s'" % (extraoptions, args.target, os.path.basename(deploy_file)), shell=True) |
86 | if ret == 0: | 93 | if ret == 0: |
87 | logger.info('Successfully undeployed %s' % args.recipename) | 94 | logger.info('Successfully undeployed %s' % args.recipename) |
88 | os.remove(deploy_file) | 95 | os.remove(deploy_file) |
@@ -94,9 +101,11 @@ def register_commands(subparsers, context): | |||
94 | parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine') | 101 | parser_deploy = subparsers.add_parser('deploy-target', help='Deploy recipe output files to live target machine') |
95 | parser_deploy.add_argument('recipename', help='Recipe to deploy') | 102 | parser_deploy.add_argument('recipename', help='Recipe to deploy') |
96 | parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]') | 103 | parser_deploy.add_argument('target', help='Live target machine running an ssh server: user@hostname[:destdir]') |
104 | parser_deploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') | ||
97 | parser_deploy.set_defaults(func=deploy) | 105 | parser_deploy.set_defaults(func=deploy) |
98 | 106 | ||
99 | parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine') | 107 | parser_undeploy = subparsers.add_parser('undeploy-target', help='Undeploy recipe output files in live target machine') |
100 | parser_undeploy.add_argument('recipename', help='Recipe to undeploy') | 108 | parser_undeploy.add_argument('recipename', help='Recipe to undeploy') |
101 | parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname') | 109 | parser_undeploy.add_argument('target', help='Live target machine running an ssh server: user@hostname') |
110 | parser_undeploy.add_argument('-c', '--no-host-check', help='Disable ssh host key checking', action='store_true') | ||
102 | parser_undeploy.set_defaults(func=undeploy) | 111 | parser_undeploy.set_defaults(func=undeploy) |