Commit 6b60789b authored by ibuler's avatar ibuler

删除node modules

parent 05940a90
......@@ -3,3 +3,5 @@
*.pyo
.access_key
logs/*.log
luna.iml
node_modules
\ No newline at end of file
FROM jumpserver/base-env-alpine:latest
MAINTAINER Jumpserver Team <ibuler@qq.com>
FROM jumpserver/python:v3.6.1
LABEL MAINTAINER Jumpserver Team <ibuler@qq.com>
COPY . /opt/jumpserver-web-terminal
WORKDIR /opt/jumpserver-web-terminal
COPY . /opt/luna
WORKDIR /opt/luna
RUN cd requirements && yum -y install $(cat rpm_requirements.txt)
RUN cd requirements && pip install -r requirements.txt
RUN yum clean all
VOLUME /opt/luna/logs
VOLUME /opt/luna/keys
RUN rm -r .git
RUN rm -f keys/.access_key
RUN cp config_docker.py config.py
RUN pip install -r requirements.txt -i https://pypi.doubanio.com/simple
EXPOSE 5000
ENV JUMPSERVER_ENDPOINT ''
ENV LUNA_ACCESS_KEY ''
ENV ACCESS_KEY_ENV ''
ENV ACCESS_KEY_STORE ''
CMD python run_server.py
\ No newline at end of file
......@@ -12,13 +12,10 @@ module.exports = function(grunt) {
'luna/src/js/jquery-ui.min.js',
'luna/src/js/logo.js',
'luna/src/js/term.js',
// 'node_modules/jquery.fancytree/dist/jquery.fancytree.min.js',
'node_modules/jquery.fancytree/dist/jquery.fancytree-all.min.js',
'node_modules/jquery.fancytree/dist/jquery.fancytree.glyph.js',
'node_modules/ui-contextmenu/jquery.ui-contextmenu.min.js',
'node_modules/socket.io-client/dist/socket.io.js',
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js',
......@@ -28,22 +25,6 @@ module.exports = function(grunt) {
'luna/src/js/config.js',
'node_modules/clipboard/dist/clipboard.min.js'
// 'node_modules/es6-shim/es6-shim.min.js',
// 'node_modules/systemjs/dist/system-polyfills.js',
// 'node_modules/angular2/es6/dev/src/testing/shims_for_IE.js',
// 'node_modules/angular2/bundles/angular2-polyfills.min.js',
//
// 'node_modules/systemjs/dist/system.js',
// 'node_modules/typescript/lib/typescript.js',
// 'node_modules/rxjs/bundles/Rx.min.js'
// 'node_modules/angular2/bundles/angular2.dev.js',
// 'node_modules/angular2/bundles/router.dev.js',
// 'node_modules/angular2/bundles/http.dev.js',
// 'node_modules/angular2-websocket/angular2-websocket.js'
// 'node_modules/reflect-metadata/Reflect.js',
],
dest: 'luna/src/js/main.js' //合并不压缩
}
......@@ -52,53 +33,15 @@ module.exports = function(grunt) {
options: {},
dist: {
files: {
// 'luna/dist/main.min.js': 'luna/src/js/main.js',
// 'luna/dist/ts/index.js': 'luna/src/ts/index.js',
// 'luna/dist/ts/leftbar.js': 'luna/src/ts/leftbar.js',
// 'luna/dist/ts/nav.js': 'luna/src/ts/nav.js',
// 'luna/dist/ts/terminal.js': 'luna/src/ts/terminal.js',
// 'luna/dist/ts/service.js': 'luna/src/ts/service.js',
// 'luna/dist/ts/login.js': 'luna/src/ts/login.js',
// 'luna/dist/ts/hostedit.js': 'luna/src/ts/hostedit.js'
'luna/src/js/main.min.js': 'luna/src/js/main.js'
}
}
},
copy: {
main: {
dest: 'luna/dist/main.min.js',
src: 'luna/src/js/main.js'
// files: [
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/luna/src/ts/index.ts' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/leftbar.ts' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/nav.ts' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/terminal.ts' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/service.ts' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/login.ts' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/hostedit.ts' },
// { filter: 'isFile', dest: 'luna/dist/', src: 'luna/src/js/main.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/index.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/leftbar.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/nav.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/terminal.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/service.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/login.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/hostedit.js' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/index.js.map' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/leftbar.js.map' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/nav.js.map' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/terminal.js.map' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/service.js.map' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/login.js.map' },
// { filter: 'isFile', dest: 'luna/dist/ts/', src: 'luna/src/ts/hostedit.js.map' }
// ]
src: 'luna/src/js/main.min.js'
},
// ts: {
// dest: 'luna/dist/ts/**',
// src: 'luna/src/ts/**'
// }
ts: {
files: [{
expand: true,
......
......@@ -4,7 +4,7 @@ DEBUG = True
# NAME = 'luna'
# BIND_HOST = '0.0.0.0'
# LISTEN_PORT = 5000
# JUMPSERVER_ENDPOINT = 'http://localhost:8080/'
JUMPSERVER_ENDPOINT = 'http://127.0.0.1:8080/'
# ACCESS_KEY = None
# ACCESS_KEY_ENV = 'LUNA_ACCESS_KEY'
# ACCESS_KEY_STORE = os.path.join(BASE_DIR, 'luna', 'keys', '.access_key')
......
# ~*~ coding: utf-8 ~*~
import os
DEBUG = True
# NAME = 'luna'
# BIND_HOST = '0.0.0.0'
# LISTEN_PORT = 5000
JUMPSERVER_ENDPOINT = os.environ.get("JUMPSERVER_ENDPOINT") or 'http://jumpserver:8080/'
# ACCESS_KEY = None
# ACCESS_KEY_ENV = 'LUNA_ACCESS_KEY'
# ACCESS_KEY_STORE = os.path.join(BASE_DIR, 'luna', 'keys', '.access_key')
# LOG_DIR = os.path.join(BASE_DIR, 'luna', 'logs')
# LOG_LEVEL = 'DEBUG'
# ASSET_LIST_SORT_BY = 'ip'
# HEATBEAT_INTERVAL = 5
......@@ -6,6 +6,4 @@ BASE_DIR = os.path.abspath(os.path.dirname(__file__))
from .app import app, socket_io
from . import authentication, views
import logger
from flask import request
from . import logger
......@@ -3,12 +3,14 @@
import logging
import time
import threading
from gevent import monkey
from flask import Flask
from flask_socketio import SocketIO
from .conf import config
from .service import service
monkey.patch_all()
logger = logging.getLogger(__file__)
......@@ -63,7 +65,6 @@ class Luna(Flask):
tasks = result.get('tasks')
if tasks:
logger.info('Receive task: %s' % tasks)
print(tasks)
self.handle_task(tasks)
time.sleep(config.HEATBEAT_INTERVAL)
......
......@@ -23,13 +23,11 @@ def login_required(func=None, login_url=None):
csrf_token = request.cookies.get('csrftoken', '')
if '' in [session_id, csrf_token]:
print(session_id, csrf_token)
return redirect(url)
g.user_service = UserService(endpoint=app.config['JUMPSERVER_ENDPOINT'])
g.user_service.auth_from_session(session_id, csrf_token)
user = g.user_service.is_authenticated()
print(user)
if user:
g.user = user
assets = g.user_service.get_my_assets()
......@@ -38,8 +36,6 @@ def login_required(func=None, login_url=None):
assets_dict[asset['id']] = asset
g.assets = assets_dict
return func(*args, **kwargs)
else:
print('hello')
return wrapper
......
......@@ -16,6 +16,8 @@ class ProxyChannel(object):
def send(self, s):
"""Proxy server中使用select, 通过socketio发送给用户"""
if isinstance(s, bytes):
s = s.decode("utf-8")
return socket_io.emit('data', s, room=self.sid)
def recv(self, size):
......
......@@ -6,6 +6,7 @@
<base href="/luna/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="main.min.css"/>
<link rel="shortcut icon" href="/luna/imgs/facio.ico" type="image/x-icon">
<!--script src="node_modules/requirejs/require.js"></script-->
<script src="main.min.js"></script>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -28,7 +28,7 @@ class ProxyServer(object):
We also record the command and result to database for audit
"""
ENTER_CHAR = ['\r', '\n', '\r\n']
ENTER_CHAR = ('\r', '\n', '\r\n')
OUTPUT_END_PATTERN = re.compile(r'\x1b]0;.+@.+:.+\x07.*')
VIM_PATTERN = re.compile(r'\x1b\[\?1049', re.X)
IGNORE_OUTPUT_COMMAND = [re.compile(r'^cat\s+'),
......@@ -61,7 +61,7 @@ class ProxyServer(object):
def is_finish_input(self, s):
for char in s:
if char in self.ENTER_CHAR:
if chr(char) in self.ENTER_CHAR:
return True
return False
......@@ -97,7 +97,7 @@ class ProxyServer(object):
def get_asset_auth(self, system_user):
return self.service.get_system_user_auth_info(system_user)
def connect(self, term=b'xterm', width=80, height=24, timeout=10):
def connect(self, term='xterm', width=80, height=24, timeout=10):
user = self.user
asset = self.asset
system_user = self.system_user
......@@ -105,7 +105,6 @@ class ProxyServer(object):
try:
width = int(client_channel.win_width)
height = int(client_channel.win_height)
print('term %s*%s' % (width, height))
except TypeError:
pass
if not self.validate_user_asset_permission():
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -54,11 +54,15 @@ def leftbar():
asset_groups_assets = user_service.get_my_asset_groups_assets()
for asset_group in asset_groups_assets:
asset_group = asset_group.toDict()
asset_group['title'] = asset_group['name']
asset_group['children'] = asset_group['assets']
asset_group['children'] = asset_group["assets"]
asset_group['folder'] = True
del asset_group['assets']
del asset_group['name']
for asset in asset_group['children']:
asset['title'] = asset['hostname']
del asset['hostname']
response.append(asset_group)
return jsonify(response)
......
......@@ -48,7 +48,6 @@ def get_asset_system_user(asset_id, system_user_id):
@login_required
def handle_machine(message):
sid = request.sid
print('Get message: {}'.format(message))
asset_id = message.get('assetId')
system_user_id = message.get('sysUserId')
if not asset_id or not system_user_id:
......@@ -86,7 +85,8 @@ def handle_data(message):
@socket_io.on('disconnect')
def handle_term_disconnect():
sid = request.sid
del clients[sid]
if sid in clients:
del clients[sid]
disconnect()
print('term disconnect')
......
......@@ -16,7 +16,7 @@
"type": "git",
"url": "https://github.com/jumpserver/luna.git"
},
"author": "liuzheng712,sofia",
"author": "liuzheng712,sofia,ibuler",
"license": "ISC",
"dependencies": {
"@angular/common": "2.0.0-rc.4",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment