Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
c6644338
Commit
c6644338
authored
Nov 21, 2014
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
96d9c067
5e98cfed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
weblate/trans/admin_views.py
weblate/trans/admin_views.py
+23
-7
No files found.
weblate/trans/admin_views.py
View file @
c6644338
...
...
@@ -45,6 +45,21 @@ KNOWN_HOSTS_FILE = os.path.expanduser('~/.ssh/known_hosts')
RSA_KEY_FILE
=
os
.
path
.
expanduser
(
'~/.ssh/id_rsa.pub'
)
def
is_key_line
(
key
):
"""
Checks whether this line looks like a valid known_hosts line.
"""
if
not
key
:
return
False
if
key
[
0
]
==
'#'
:
return
False
return
(
' ssh-rsa '
in
key
or
' ecdsa-sha2-nistp256 '
in
key
or
' ssh-ed25519 '
in
key
)
@
staff_member_required
def
report
(
request
):
"""
...
...
@@ -214,7 +229,8 @@ def get_host_keys():
result
=
[]
with
open
(
KNOWN_HOSTS_FILE
,
'r'
)
as
handle
:
for
line
in
handle
:
if
' ssh-rsa '
in
line
or
' ecdsa-sha2-nistp256 '
in
line
:
line
=
line
.
strip
()
if
is_key_line
(
line
):
result
.
append
(
parse_hosts_line
(
line
))
except
IOError
:
return
[]
...
...
@@ -291,12 +307,12 @@ def add_host_key(request):
stderr
=
subprocess
.
STDOUT
,
env
=
get_clean_env
(),
)
keys
=
[
line
for
line
in
output
.
splitlines
()
if
' ssh-rsa '
in
line
or
' ecdsa-sha2-nistp256 '
in
line
]
for
key
in
keys
:
keys
=
[
]
for
key
in
output
.
splitlines
():
key
=
key
.
strip
()
if
not
is_key_line
(
key
):
continue
keys
.
append
(
key
)
host
,
keytype
,
fingerprint
=
parse_hosts_line
(
key
)
messages
.
warning
(
request
,
...
...
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