Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
5579d3f0
Commit
5579d3f0
authored
Jun 08, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修复测试网关连接known_host问题
parent
5464ac81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
utils.py
apps/assets/utils.py
+0
-1
inventory.py
apps/ops/inventory.py
+2
-1
No files found.
apps/assets/utils.py
View file @
5579d3f0
...
@@ -51,7 +51,6 @@ def test_gateway_connectability(gateway):
...
@@ -51,7 +51,6 @@ def test_gateway_connectability(gateway):
client
=
paramiko
.
SSHClient
()
client
=
paramiko
.
SSHClient
()
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
client
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
proxy
=
paramiko
.
SSHClient
()
proxy
=
paramiko
.
SSHClient
()
proxy
.
load_host_keys
(
os
.
path
.
expanduser
(
'~/.ssh/known_hosts'
))
proxy
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
proxy
.
set_missing_host_key_policy
(
paramiko
.
AutoAddPolicy
())
try
:
try
:
...
...
apps/ops/inventory.py
View file @
5579d3f0
...
@@ -86,6 +86,7 @@ class JMSInventory(BaseInventory):
...
@@ -86,6 +86,7 @@ class JMSInventory(BaseInventory):
gateway
=
asset
.
domain
.
random_gateway
()
gateway
=
asset
.
domain
.
random_gateway
()
proxy_command_list
=
[
proxy_command_list
=
[
"ssh"
,
"-p"
,
str
(
gateway
.
port
),
"ssh"
,
"-p"
,
str
(
gateway
.
port
),
"-o"
,
"StrictHostKeyChecking=no"
,
"{}@{}"
.
format
(
gateway
.
username
,
gateway
.
ip
),
"{}@{}"
.
format
(
gateway
.
username
,
gateway
.
ip
),
"-W"
,
"
%
h:
%
p"
,
"-q"
,
"-W"
,
"
%
h:
%
p"
,
"-q"
,
]
]
...
@@ -97,7 +98,7 @@ class JMSInventory(BaseInventory):
...
@@ -97,7 +98,7 @@ class JMSInventory(BaseInventory):
if
gateway
.
private_key
:
if
gateway
.
private_key
:
proxy_command_list
.
append
(
"-i {}"
.
format
(
gateway
.
private_key_file
))
proxy_command_list
.
append
(
"-i {}"
.
format
(
gateway
.
private_key_file
))
proxy_command
=
"'-o ProxyCommand={}
'
"
.
format
(
proxy_command
=
"'-o ProxyCommand={}"
.
format
(
" "
.
join
(
proxy_command_list
)
" "
.
join
(
proxy_command_list
)
)
)
return
{
"ansible_ssh_common_args"
:
proxy_command
}
return
{
"ansible_ssh_common_args"
:
proxy_command
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment