如何用面料做多跳SSH

编程入门 行业动态 更新时间:2024-10-28 16:27:40
本文介绍了如何用面料做多跳SSH的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个nat,它有各种服务器 所以我想从本地服务器转到nat,然后从nat到其他计算机ssh

I have a nat and it has various server So from my local server I want to go to nat and then from nat i have to ssh to other machines

本地-> NAT(密钥1的abcuser @ publicIP)->服务器1(密钥2的xyzuser @ localIP) nat有不同的ssh键 并且每个服务器都有不同的ssh密钥 我如何使用Fabric完成这种类型的多跳SSH 我尝试使用 env.roledefs 功能,但似乎不起作用 我也不确定如何定义两个ssh密钥.我知道我们可以定义一个带有env.key_filename的密钥列表,但是问题是它将检查每个服务器的每个密钥吗?如何更具体地将一个密钥与一个服务器匹配仅

Local-->NAT(abcuser@publicIP with key 1)-->server1(xyzuser@localIP with key 2) nat has different ssh key and each of the server has different ssh key how can i accomplish this type of multihop ssh using fabric I tried using env.roledefs feature but it doesnt seems to be working also I am not sure how to define two ssh keys.I know we can define a list of keys with env.key_filename but issue is will it check each key with each server?How can I be more specific and match a key with one server only

我尝试使用本地计算机上的命令 工厂部署-g'ec2-user@54.251.151.39'-i'/home/aman/Downloads/aws_oms.pem' 而我的脚本是

I have tried using command from my local machine fab deploy -g 'ec2-user@54.251.151.39' -i '/home/aman/Downloads/aws_oms.pem' and my script is

from __future__ import with_statement from fabric.api import local, run, cd, env, execute env.hosts=['ubuntu@10.0.0.77'] env.key_filename=['/home/ec2-user/varnish_cache.pem'] def deploy(): run("uname -a")

推荐答案

要通过中间服务器连接到远程主机,可以使用--gateway命令行选项:

In order to connect to remote hosts via an intermediate server, you can use the --gateway command-line option :

docs.fabfile/en /latest/usage/fab.html#cmdoption-g

或者,或者,在fabfile中设置env.gateway变量:

Or, alternatively, set the env.gateway variable inside your fabfile :

docs.fabfile/en/latest /usage/env.html#gateway

有关更多详细信息,请参阅:

For more detail information, see:

docs.fabfile/en /stable/concepts/networking.html#ssh-gateways

更多推荐

如何用面料做多跳SSH

本文发布于:2023-11-04 06:04:22,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557139.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何用   做多   面料   SSH

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!