cmdbox 0.5.2__py3-none-any.whl → 0.5.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cmdbox might be problematic. Click here for more details.

Files changed (51) hide show
  1. cmdbox/app/auth/signin.py +1 -0
  2. cmdbox/app/features/cli/audit_base.py +4 -1
  3. cmdbox/app/features/cli/cmdbox_audit_delete.py +27 -18
  4. cmdbox/app/features/cli/cmdbox_audit_search.py +128 -62
  5. cmdbox/app/features/cli/cmdbox_audit_write.py +27 -20
  6. cmdbox/app/features/web/cmdbox_web_audit.py +81 -0
  7. cmdbox/app/features/web/cmdbox_web_audit_metrics.py +72 -0
  8. cmdbox/app/features/web/cmdbox_web_exec_cmd.py +10 -5
  9. cmdbox/app/features/web/cmdbox_web_user_data.py +58 -0
  10. cmdbox/app/options.py +40 -19
  11. cmdbox/app/web.py +7 -1
  12. cmdbox/extensions/features.yml +7 -4
  13. cmdbox/extensions/user_list.yml +5 -0
  14. cmdbox/licenses/LICENSE.argcomplete.3.6.2(Apache Software License).txt +177 -0
  15. cmdbox/licenses/LICENSE.gevent.25.4.1(MIT).txt +25 -0
  16. cmdbox/licenses/LICENSE.greenlet.3.2.0(MIT AND Python-2.0).txt +30 -0
  17. cmdbox/licenses/LICENSE.pillow.11.2.1(UNKNOWN).txt +1200 -0
  18. cmdbox/licenses/LICENSE.prompt_toolkit.3.0.51(BSD License).txt +27 -0
  19. cmdbox/licenses/LICENSE.pydantic.2.11.3(MIT License).txt +21 -0
  20. cmdbox/licenses/LICENSE.pydantic_core.2.33.1(MIT License).txt +21 -0
  21. cmdbox/licenses/LICENSE.starlette.0.46.2(BSD License).txt +27 -0
  22. cmdbox/licenses/LICENSE.typing_extensions.4.13.2(UNKNOWN).txt +279 -0
  23. cmdbox/licenses/LICENSE.urllib3.2.4.0(UNKNOWN).txt +21 -0
  24. cmdbox/licenses/LICENSE.uvicorn.0.34.1(BSD License).txt +27 -0
  25. cmdbox/licenses/LICENSE.watchfiles.1.0.5(MIT License).txt +21 -0
  26. cmdbox/licenses/files.txt +12 -13
  27. cmdbox/version.py +2 -2
  28. cmdbox/web/assets/apexcharts/apexcharts.css +679 -0
  29. cmdbox/web/assets/apexcharts/apexcharts.min.js +38 -0
  30. cmdbox/web/assets/cmdbox/audit.js +340 -0
  31. cmdbox/web/assets/cmdbox/color_mode.css +4 -0
  32. cmdbox/web/assets/cmdbox/common.js +397 -24
  33. cmdbox/web/assets/cmdbox/filer_modal.js +1 -1
  34. cmdbox/web/assets/cmdbox/list_cmd.js +7 -271
  35. cmdbox/web/assets/cmdbox/list_pipe.js +3 -3
  36. cmdbox/web/assets/cmdbox/users.js +17 -17
  37. cmdbox/web/assets/cmdbox/view_raw.js +1 -1
  38. cmdbox/web/assets/cmdbox/view_result.js +11 -13
  39. cmdbox/web/assets/filer/filer.js +2 -2
  40. cmdbox/web/assets_license_list.txt +4 -1
  41. cmdbox/web/audit.html +268 -0
  42. cmdbox/web/filer.html +21 -10
  43. cmdbox/web/gui.html +21 -52
  44. cmdbox/web/result.html +9 -2
  45. cmdbox/web/users.html +7 -3
  46. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.dist-info}/METADATA +8 -5
  47. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.dist-info}/RECORD +51 -32
  48. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.dist-info}/LICENSE +0 -0
  49. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.dist-info}/WHEEL +0 -0
  50. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.dist-info}/entry_points.txt +0 -0
  51. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,72 @@
1
+ from cmdbox.app import common, feature
2
+ from cmdbox.app.web import Web
3
+ from fastapi import FastAPI, Request, Response, HTTPException
4
+ from typing import Dict, Any
5
+ import json
6
+
7
+
8
+ class AuditMetrics(feature.WebFeature):
9
+ def route(self, web:Web, app:FastAPI) -> None:
10
+ """
11
+ webモードのルーティングを設定します
12
+
13
+ Args:
14
+ web (Web): Webオブジェクト
15
+ app (FastAPI): FastAPIオブジェクト
16
+ """
17
+ @app.post('/audit/metrics/save')
18
+ async def save_metrics(req:Request, res:Response):
19
+ signin = web.signin.check_signin(req, res)
20
+ if signin is not None:
21
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
22
+ form = await req.form()
23
+ title = form.get('title')
24
+ opt = json.loads(form.get('opt'))
25
+ if common.check_fname(title):
26
+ return dict(warn=f'The title contains invalid characters."{title}"')
27
+ opt_path = web.audit_path / f"metrics-{title}.json"
28
+ web.logger.info(f"save_metrics: opt_path={opt_path}, opt={opt}")
29
+ common.saveopt(opt, opt_path, True)
30
+ ret = dict(success=f'Metrics "{title}" saved in "{opt_path}".')
31
+ web.options.audit_exec(req, res, web, title=title)
32
+ return ret
33
+
34
+ @app.post('/audit/metrics/load')
35
+ async def load_metrics(req:Request, res:Response):
36
+ signin = web.signin.check_signin(req, res)
37
+ if signin is not None:
38
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
39
+ form = await req.form()
40
+ title = form.get('title')
41
+ opt_path = web.audit_path / f"metrics-{title}.json"
42
+ if not opt_path.is_file():
43
+ return dict(warn=f'The metrics file is not found."{opt_path}"')
44
+ with open(opt_path, 'r', encoding='utf-8') as f:
45
+ opt = json.load(f)
46
+ return dict(success=opt)
47
+
48
+ @app.post('/audit/metrics/delete')
49
+ async def delete_metrics(req:Request, res:Response):
50
+ signin = web.signin.check_signin(req, res)
51
+ if signin is not None:
52
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
53
+ form = await req.form()
54
+ title = form.get('title')
55
+ opt_path = web.audit_path / f"metrics-{title}.json"
56
+ if not opt_path.is_file():
57
+ return dict(warn=f'The metrics file is not found."{opt_path}"')
58
+ opt_path.unlink()
59
+ return dict(success=f'Metrics "{title}" deleted.')
60
+
61
+ @app.post('/audit/metrics/list')
62
+ async def list_metrics(req:Request, res:Response):
63
+ signin = web.signin.check_signin(req, res)
64
+ if signin is not None:
65
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
66
+ files = web.audit_path.glob('metrics-*.json')
67
+ ret = []
68
+ for f in files:
69
+ with open(f, 'r', encoding='utf-8') as f:
70
+ opt = json.load(f)
71
+ ret.append(opt)
72
+ return dict(success=ret)
@@ -1,6 +1,6 @@
1
1
  from cmdbox.app import app, client, common, options, server, web as _web
2
2
  from cmdbox.app.commons import convert, loghandler
3
- from cmdbox.app.features.cli import audit_base
3
+ from cmdbox.app.features.cli import cmdbox_audit_search, cmdbox_audit_write
4
4
  from cmdbox.app.features.web import cmdbox_web_load_cmd
5
5
  from cmdbox.app.web import Web
6
6
  from fastapi import FastAPI, Request, Response, HTTPException
@@ -96,7 +96,6 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
96
96
  return True, output
97
97
  return False, None
98
98
 
99
- @options.Options.audit()
100
99
  def exec_cmd(self, req:Request, res:Response, web:Web,
101
100
  title:str, opt:Dict[str, Any], nothread:bool=False, appcls=None) -> List[Dict[str, Any]]:
102
101
  """
@@ -113,6 +112,10 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
113
112
  Returns:
114
113
  list: コマンド実行結果
115
114
  """
115
+ tags = []
116
+ if 'tag' in opt and isinstance(opt['tag'], list):
117
+ tags = [t for t in opt['tag'] if t is not None and t != '']
118
+ web.options.audit_exec(req, res, web, tags=tags, title=title)
116
119
  appcls = self.appcls if appcls is None else appcls
117
120
  appcls = app.CmdBoxApp if appcls is None else appcls
118
121
  web.container['cmdbox_app'] = ap = appcls.getInstance(appcls=appcls, ver=self.ver)
@@ -133,8 +136,10 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
133
136
  found = True
134
137
  if not found or o not in loaded: continue
135
138
  opt[o] = loaded[o]
136
- if isinstance(feat, audit_base.AuditBase) and o in _options.audit_args:
137
- opt[o] = _options.audit_args[o]
139
+ if isinstance(feat, cmdbox_audit_write.AuditWrite) and o in _options.audit_write_args:
140
+ opt[o] = _options.audit_write_args[o]
141
+ elif isinstance(feat, cmdbox_audit_search.AuditSearch) and o in _options.audit_search_args:
142
+ opt[o] = _options.audit_search_args[o]
138
143
  except:
139
144
  pass
140
145
  if 'host' in opt: opt['host'] = web.redis_host
@@ -175,7 +180,7 @@ class ExecCmd(cmdbox_web_load_cmd.LoadCmd):
175
180
  logsize = 1024
176
181
  try:
177
182
  old_stdout.write(loghandler.colorize_msg(f'EXEC: {opt_list}\n'[:logsize]))
178
- status, ret_main, obj = cmdbox_app.main(args_list=opt_list, file_dict=file_dict, webcall=True)
183
+ status, ret_main, obj = cmdbox_app.main(args_list=[common.chopdq(o) for o in opt_list], file_dict=file_dict, webcall=True)
179
184
  if isinstance(obj, server.Server):
180
185
  cmdbox_app.sv = obj
181
186
  elif isinstance(obj, client.Client):
@@ -0,0 +1,58 @@
1
+ from cmdbox.app import common, feature
2
+ from cmdbox.app.web import Web
3
+ from fastapi import FastAPI, Request, Response, HTTPException
4
+ from typing import Dict, Any
5
+
6
+
7
+ class UserData(feature.WebFeature):
8
+ def route(self, web:Web, app:FastAPI) -> None:
9
+ """
10
+ webモードのルーティングを設定します
11
+
12
+ Args:
13
+ web (Web): Webオブジェクト
14
+ app (FastAPI): FastAPIオブジェクト
15
+ """
16
+ @app.post('/gui/user_data/load')
17
+ async def load(req:Request, res:Response):
18
+ signin = web.signin.check_signin(req, res)
19
+ if signin is not None:
20
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
21
+ if 'signin' not in req.session or req.session['signin'] is None:
22
+ return dict(warn='Please sign in.')
23
+ form = await req.form()
24
+ categoly = form.get('categoly')
25
+ key = form.get('key')
26
+ sess = req.session['signin']
27
+ ret = web.user_data(req, sess['uid'], sess['name'], categoly, key)
28
+ return dict(success=ret)
29
+
30
+ @app.post('/gui/user_data/save')
31
+ async def save(req:Request, res:Response):
32
+ signin = web.signin.check_signin(req, res)
33
+ if signin is not None:
34
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
35
+ if 'signin' not in req.session or req.session['signin'] is None:
36
+ return dict(warn='Please sign in.')
37
+ form = await req.form()
38
+ categoly = form.get('categoly')
39
+ key = form.get('key')
40
+ val = form.get('val')
41
+ sess = req.session['signin']
42
+ web.user_data(req, sess['uid'], sess['name'], categoly, key, val)
43
+ return dict(success=f'user_data "{categoly}:{key}:val" saved.')
44
+
45
+ @app.post('/gui/user_data/delete')
46
+ async def delete(req:Request, res:Response):
47
+ signin = web.signin.check_signin(req, res)
48
+ if signin is not None:
49
+ raise HTTPException(status_code=401, detail=self.DEFAULT_401_MESSAGE)
50
+ if 'signin' not in req.session or req.session['signin'] is None:
51
+ return dict(warn='Please sign in.')
52
+ form = await req.form()
53
+ categoly = form.get('categoly')
54
+ key = form.get('key')
55
+ val = form.get('val')
56
+ sess = req.session['signin']
57
+ web.user_data(req, sess['uid'], sess['name'], categoly, key, delkey=True)
58
+ return dict(success=f'user_data "{categoly}:{key}:val" deleted.')
cmdbox/app/options.py CHANGED
@@ -627,20 +627,35 @@ class Options:
627
627
  if 'enabled' not in yml['audit']:
628
628
  raise Exception('features.yml is invalid. (The audit element must have "enabled" specified.)')
629
629
  if not yml['audit']['enabled']: return
630
- if 'feature' not in yml['audit']:
631
- raise Exception('features.yml is invalid. (The audit element must have "feature" specified.)')
632
- if 'mode' not in yml['audit']['feature']:
633
- raise Exception('features.yml is invalid. (The audit.feature element must have "mode" specified.)')
634
- mode = yml['audit']['feature']['mode']
635
- if 'cmd' not in yml['audit']['feature']:
636
- raise Exception('features.yml is invalid. (The audit.feature element must have "cmd" specified.)')
637
- cmd = yml['audit']['feature']['cmd']
638
- self.audit_func:feature.Feature = self.get_cmd_attr(mode, cmd, 'feature')
630
+ # writeフューチャー
631
+ if 'write' not in yml['audit']:
632
+ raise Exception('features.yml is invalid. (The audit element must have "write" specified.)')
633
+ if 'mode' not in yml['audit']['write']:
634
+ raise Exception('features.yml is invalid. (The audit.write element must have "mode" specified.)')
635
+ mode = yml['audit']['write']['mode']
636
+ if 'cmd' not in yml['audit']['write']:
637
+ raise Exception('features.yml is invalid. (The audit.write element must have "cmd" specified.)')
638
+ cmd = yml['audit']['write']['cmd']
639
+ self.audit_write:feature.Feature = self.get_cmd_attr(mode, cmd, 'feature')
640
+ # searchフューチャー
641
+ if 'search' not in yml['audit']:
642
+ raise Exception('features.yml is invalid. (The audit element must have "search" specified.)')
643
+ if 'mode' not in yml['audit']['search']:
644
+ raise Exception('features.yml is invalid. (The audit.search element must have "mode" specified.)')
645
+ mode = yml['audit']['search']['mode']
646
+ if 'cmd' not in yml['audit']['search']:
647
+ raise Exception('features.yml is invalid. (The audit.search element must have "cmd" specified.)')
648
+ cmd = yml['audit']['search']['cmd']
649
+ self.audit_search:feature.Feature = self.get_cmd_attr(mode, cmd, 'feature')
650
+ # フューチャーのoptions
639
651
  if 'options' not in yml['audit']:
640
652
  raise Exception('features.yml is invalid. (The audit element must have "options" specified.)')
641
- self.audit_args = yml['audit']['options'].copy()
642
- self.audit_args['mode'] = mode
643
- self.audit_args['cmd'] = cmd
653
+ self.audit_write_args = yml['audit']['options'].copy()
654
+ self.audit_write_args['mode'] = mode
655
+ self.audit_write_args['cmd'] = cmd
656
+ self.audit_search_args = yml['audit']['options'].copy()
657
+ self.audit_search_args['mode'] = mode
658
+ self.audit_search_args['cmd'] = cmd
644
659
  self.audit_loaded = True
645
660
 
646
661
  AT_USER = 'user'
@@ -684,7 +699,7 @@ class Options:
684
699
  return _wrapper
685
700
  return _audit_write
686
701
 
687
- def audit_exec(self, *args, body:Dict[str, Any]=None, audit_type:str=None, tags:List[str]=None, src:str=None, user:str=None, **kwargs) -> None:
702
+ def audit_exec(self, *args, body:Dict[str, Any]=None, audit_type:str=None, tags:List[str]=None, src:str=None, title:str=None, user:str=None, **kwargs) -> None:
688
703
  """
689
704
  監査ログを書き込みます。
690
705
 
@@ -694,17 +709,19 @@ class Options:
694
709
  audit_type (str): 監査の種類
695
710
  tags (List[str]): メッセージのタグ
696
711
  src (str): メッセージの発生源
712
+ title (str): メッセージのタイトル
697
713
  user (str): メッセージを発生させたユーザー名
698
714
  kwargs (Any): 呼び出し元で使用しているキーワード引数
699
715
  """
700
- if not hasattr(self, 'audit_func') or self.audit_func is None:
716
+ if not hasattr(self, 'audit_write') or self.audit_write is None:
701
717
  raise Exception('audit write feature is not found.')
702
718
  clmsg_date = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + common.get_tzoffset_str()
703
- opt = self.audit_args.copy()
704
- opt['audit_type'] = audit_type if audit_type is not None else Options.AT_EVENT
719
+ opt = self.audit_write_args.copy()
720
+ opt['audit_type'] = audit_type
705
721
  opt['clmsg_id'] = str(uuid.uuid4())
706
722
  opt['clmsg_date'] = clmsg_date
707
723
  opt['clmsg_src'] = opt['clmsg_src'] if 'clmsg_src' in opt else None
724
+ opt['clmsg_title'] = opt['clmsg_title'] if 'clmsg_title' in opt else None
708
725
  opt['clmsg_user'] = user
709
726
  opt['clmsg_tag'] = tags
710
727
  opt['format'] = False if opt.get('format') is None else opt['format']
@@ -756,12 +773,16 @@ class Options:
756
773
  elif isinstance(arg, Request):
757
774
  if 'signin' in arg.session and arg.session['signin'] is not None and 'name' in arg.session['signin']:
758
775
  opt['clmsg_user'] = arg.session['signin']['name']
759
- opt['audit_type'] = Options.AT_ADMIN if 'admin' in arg.session['signin']['groups'] else Options.AT_USER
776
+ if opt['audit_type'] is None:
777
+ opt['audit_type'] = Options.AT_ADMIN if 'admin' in arg.session['signin']['groups'] else Options.AT_USER
760
778
  opt['clmsg_id'] = arg.session['signin']['clmsg_id'] if 'clmsg_id' in arg.session['signin'] else opt['clmsg_id']
761
779
  arg.session['signin']['clmsg_id'] = opt['clmsg_id']
762
780
  opt['clmsg_src'] = arg.url.path
763
781
  opt['clmsg_body'] = clmsg_body
782
+ opt['audit_type'] = opt['audit_type'] if opt['audit_type'] else Options.AT_EVENT
764
783
  if src is not None and src != "":
765
784
  opt['clmsg_src'] = src
766
- audit_args = argparse.Namespace(**{k:common.chopdq(v) for k,v in opt.items()})
767
- self.audit_func.apprun(logger, audit_args, tm=0.0, pf=[])
785
+ if title is not None and title != "":
786
+ opt['clmsg_title'] = title
787
+ audit_write_args = argparse.Namespace(**{k:common.chopdq(v) for k,v in opt.items()})
788
+ self.audit_write.apprun(logger, audit_write_args, tm=0.0, pf=[])
cmdbox/app/web.py CHANGED
@@ -31,7 +31,7 @@ class Web:
31
31
  def __init__(self, logger:logging.Logger, data:Path, appcls=None, ver=None,
32
32
  redis_host:str = "localhost", redis_port:int = 6379, redis_password:str = None, svname:str = 'server',
33
33
  client_only:bool=False, doc_root:Path=None, gui_html:str=None, filer_html:str=None, result_html:str=None, users_html:str=None,
34
- assets:List[str]=None, signin_html:str=None, signin_file:str=None, gui_mode:bool=False,
34
+ audit_html:str=None, assets:List[str]=None, signin_html:str=None, signin_file:str=None, gui_mode:bool=False,
35
35
  web_features_packages:List[str]=None, web_features_prefix:List[str]=None):
36
36
  """
37
37
  cmdboxクライアント側のwebapiサービス
@@ -51,6 +51,7 @@ class Web:
51
51
  filer_html (str, optional): ファイラーのHTMLファイル. Defaults to None.
52
52
  result_html (str, optional): 結果のHTMLファイル. Defaults to None.
53
53
  users_html (str, optional): ユーザーのHTMLファイル. Defaults to None.
54
+ audit_html (str, optional): 監査のHTMLファイル. Defaults to None.
54
55
  assets (List[str], optional): 静的ファイルのリスト. Defaults to None.
55
56
  signin_html (str, optional): ログイン画面のHTMLファイル. Defaults to None.
56
57
  signin_file (str, optional): ログイン情報のファイル. Defaults to args.signin_file.
@@ -76,6 +77,7 @@ class Web:
76
77
  self.filer_html = Path(filer_html) if filer_html is not None else Path(__file__).parent.parent / 'web' / 'filer.html'
77
78
  self.result_html = Path(result_html) if result_html is not None else Path(__file__).parent.parent / 'web' / 'result.html'
78
79
  self.users_html = Path(users_html) if users_html is not None else Path(__file__).parent.parent / 'web' / 'users.html'
80
+ self.audit_html = Path(audit_html) if audit_html is not None else Path(__file__).parent.parent / 'web' / 'audit.html'
79
81
  self.assets = []
80
82
  if assets is not None:
81
83
  if not isinstance(assets, list):
@@ -94,6 +96,7 @@ class Web:
94
96
  self.filer_html_data = None
95
97
  self.result_html_data = None
96
98
  self.users_html_data = None
99
+ self.audit_html_data = None
97
100
  self.assets_data = None
98
101
  self.signin_html_data = None
99
102
  self.gui_mode = gui_mode
@@ -102,10 +105,12 @@ class Web:
102
105
  self.cmds_path = self.data / ".cmds"
103
106
  self.pipes_path = self.data / ".pipes"
104
107
  self.users_path = self.data / ".users"
108
+ self.audit_path = self.data / '.audit'
105
109
  self.static_root = Path(__file__).parent.parent / 'web'
106
110
  common.mkdirs(self.cmds_path)
107
111
  common.mkdirs(self.pipes_path)
108
112
  common.mkdirs(self.users_path)
113
+ common.mkdirs(self.audit_path)
109
114
  self.pipe_th = None
110
115
  self.img_queue = queue.Queue(1000)
111
116
  self.cb_queue = queue.Queue(1000)
@@ -125,6 +130,7 @@ class Web:
125
130
  self.logger.debug(f"web init parameter: filer_html={self.filer_html} -> {self.filer_html.absolute() if self.filer_html is not None else None}")
126
131
  self.logger.debug(f"web init parameter: result_html={self.result_html} -> {self.result_html.absolute() if self.result_html is not None else None}")
127
132
  self.logger.debug(f"web init parameter: users_html={self.users_html} -> {self.users_html.absolute() if self.users_html is not None else None}")
133
+ self.logger.debug(f"web init parameter: audit_html={self.audit_html} -> {self.audit_html.absolute() if self.audit_html is not None else None}")
128
134
  self.logger.debug(f"web init parameter: assets={self.assets} -> {[a.absolute() for a in self.assets] if self.assets is not None else None}")
129
135
  self.logger.debug(f"web init parameter: signin_html={self.signin_html} -> {self.signin_html.absolute() if self.signin_html is not None else None}")
130
136
  self.logger.debug(f"web init parameter: signin_file={self.signin_file} -> {self.signin_file.absolute() if self.signin_file is not None else None}")
@@ -39,9 +39,12 @@ aliases: # Specify the alias for the specified co
39
39
  # e.g. true
40
40
  audit:
41
41
  enabled: true # Specify whether to enable the audit function.
42
- feature:
43
- mode: audit # Specify the mode of the feature to be audited.
44
- cmd: write # Specify the command to be audited.
42
+ write:
43
+ mode: audit # Specify the mode of the feature to be writed.
44
+ cmd: write # Specify the command to be writed.
45
+ search:
46
+ mode: audit # Specify the mode of the feature to be searched.
47
+ cmd: search # Specify the command to be searched.
45
48
  options: # Specify the options for the audit function.
46
49
  host: localhost # Specify the service host of the audit Redis server.
47
50
  port: 6379 # Specify the service port of the audit Redis server.
@@ -49,7 +52,7 @@ audit:
49
52
  svname: server # Specify the audit service name of the inference server.
50
53
  retry_count: 3 # Specifies the number of reconnections to the audit Redis server.If less than 0 is specified, reconnection is forever.
51
54
  retry_interval: 1 # Specifies the number of seconds before reconnecting to the audit Redis server.
52
- timeout: 1 # Specify the maximum waiting time until the server responds.
55
+ timeout: 15 # Specify the maximum waiting time until the server responds.
53
56
  pg_enabled: False # Specify True if using the postgresql database server.
54
57
  pg_host: localhost # Specify the postgresql host.
55
58
  pg_port: 5432 # Specify the postgresql port.
@@ -49,6 +49,10 @@ cmdrule: # A list of command rules, Specify a rule that de
49
49
  mode: server
50
50
  cmds: [list]
51
51
  rule: allow
52
+ - groups: [user, guest]
53
+ mode: audit
54
+ cmds: [write]
55
+ rule: allow
52
56
  - groups: [user, guest]
53
57
  mode: web
54
58
  cmds: [genpass]
@@ -69,6 +73,7 @@ pathrule: # List of RESTAPI rules, rules that determine whe
69
73
  rule: allow
70
74
  - groups: [user]
71
75
  paths: [/signin, /assets, /bbforce_cmd, /copyright, /dosignin, /dosignout, /password/change,
76
+ /gui/user_data/load, /gui/user_data/save, /gui/user_data/delete,
72
77
  /exec_cmd, /exec_pipe, /filer, /gui, /get_server_opt, /usesignout, /versions_cmdbox, /versions_used]
73
78
  rule: allow
74
79
  - groups: [readonly]
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,25 @@
1
+ MIT License
2
+
3
+ Except when otherwise stated (look at the beginning of each file) the software
4
+ and the documentation in this project are copyrighted by:
5
+
6
+ Denis Bilenko and the contributors, http://www.gevent.org
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining
9
+ a copy of this software and associated documentation files (the
10
+ "Software"), to deal in the Software without restriction, including
11
+ without limitation the rights to use, copy, modify, merge, publish,
12
+ distribute, sublicense, and/or sell copies of the Software, and to
13
+ permit persons to whom the Software is furnished to do so, subject to
14
+ the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be
17
+ included in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ The following files are derived from Stackless Python and are subject to the
2
+ same license as Stackless Python:
3
+
4
+ src/greenlet/slp_platformselect.h
5
+ files in src/greenlet/platform/ directory
6
+
7
+ See LICENSE.PSF and http://www.stackless.com/ for details.
8
+
9
+ Unless otherwise noted, the files in greenlet have been released under the
10
+ following MIT license:
11
+
12
+ Copyright (c) Armin Rigo, Christian Tismer and contributors
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in
22
+ all copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30
+ THE SOFTWARE.