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
4e0f81e4
Commit
4e0f81e4
authored
Mar 07, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
629ff390
51d7e511
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
api.py
apps/terminal/api.py
+8
-6
No files found.
apps/terminal/api.py
View file @
4e0f81e4
...
...
@@ -4,12 +4,15 @@ from collections import OrderedDict
import
logging
import
os
import
uuid
import
boto3
# AWS S3 sdk
from
django.core.cache
import
cache
from
django.shortcuts
import
get_object_or_404
,
redirect
from
django.utils
import
timezone
from
django.core.files.storage
import
default_storage
from
django.http
import
HttpResponseNotFound
from
django.conf
import
settings
from
rest_framework
import
viewsets
,
serializers
from
rest_framework.views
import
APIView
,
Response
from
rest_framework.permissions
import
AllowAny
...
...
@@ -23,7 +26,6 @@ from .hands import IsSuperUserOrAppUser, IsAppUser, \
IsSuperUserOrAppUserOrUserReadonly
from
.backends
import
get_command_store
,
get_multi_command_store
,
\
SessionCommandSerializer
import
boto3
# AWS S3 sdk
logger
=
logging
.
getLogger
(
__file__
)
...
...
@@ -280,11 +282,11 @@ class SessionReplayViewSet(viewsets.ViewSet):
url
=
default_storage
.
url
(
path
)
return
redirect
(
url
)
else
:
config
=
se
lf
.
app
.
config
.
get
(
"REPLAY_STORAGE"
,
None
)
config
=
se
ttings
.
TERMINAL_REPLAY_STORAGE
.
items
(
)
if
config
:
for
name
in
config
.
keys
()
:
if
config
[
name
]
.
get
(
"TYPE"
,
''
)
==
"s3"
:
client
,
bucket
=
self
.
s3Client
(
config
[
name
]
)
for
name
,
value
in
config
:
if
value
.
get
(
"TYPE"
,
''
)
==
"s3"
:
client
,
bucket
=
self
.
s3Client
(
value
)
try
:
client
.
head_object
(
Bucket
=
bucket
,
Key
=
path
)
client
.
download_file
(
bucket
,
path
,
default_storage
.
base_location
+
'/'
+
path
)
...
...
@@ -298,7 +300,7 @@ class SessionReplayViewSet(viewsets.ViewSet):
REGION
=
config
.
get
(
"REGION"
,
None
)
ACCESS_KEY
=
config
.
get
(
"ACCESS_KEY"
,
None
)
SECRET_KEY
=
config
.
get
(
"SECRET_KEY"
,
None
)
if
self
.
ACCESS_KEY
and
REGION
and
SECRET_KEY
:
if
ACCESS_KEY
and
REGION
and
SECRET_KEY
:
s3
=
boto3
.
client
(
's3'
,
region_name
=
REGION
,
aws_access_key_id
=
ACCESS_KEY
,
...
...
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