cmdbox 0.5.2__py3-none-any.whl → 0.5.3.1__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 (114) hide show
  1. cmdbox/app/auth/signin.py +1 -0
  2. cmdbox/app/feature.py +2 -0
  3. cmdbox/app/features/cli/audit_base.py +5 -2
  4. cmdbox/app/features/cli/cmdbox_audit_createdb.py +1 -1
  5. cmdbox/app/features/cli/cmdbox_audit_delete.py +27 -18
  6. cmdbox/app/features/cli/cmdbox_audit_search.py +128 -62
  7. cmdbox/app/features/cli/cmdbox_audit_write.py +31 -20
  8. cmdbox/app/features/cli/cmdbox_client_file_copy.py +1 -1
  9. cmdbox/app/features/cli/cmdbox_client_file_download.py +1 -1
  10. cmdbox/app/features/cli/cmdbox_client_file_list.py +1 -1
  11. cmdbox/app/features/cli/cmdbox_client_file_mkdir.py +1 -1
  12. cmdbox/app/features/cli/cmdbox_client_file_move.py +1 -1
  13. cmdbox/app/features/cli/cmdbox_client_file_remove.py +1 -1
  14. cmdbox/app/features/cli/cmdbox_client_file_rmdir.py +1 -1
  15. cmdbox/app/features/cli/cmdbox_client_file_upload.py +1 -1
  16. cmdbox/app/features/cli/cmdbox_client_server_info.py +1 -1
  17. cmdbox/app/features/cli/cmdbox_gui_start.py +1 -1
  18. cmdbox/app/features/cli/cmdbox_server_start.py +1 -1
  19. cmdbox/app/features/cli/cmdbox_server_stop.py +1 -1
  20. cmdbox/app/features/cli/cmdbox_web_apikey_add.py +1 -1
  21. cmdbox/app/features/cli/cmdbox_web_apikey_del.py +1 -1
  22. cmdbox/app/features/cli/cmdbox_web_group_add.py +1 -1
  23. cmdbox/app/features/cli/cmdbox_web_group_del.py +1 -1
  24. cmdbox/app/features/cli/cmdbox_web_group_edit.py +1 -1
  25. cmdbox/app/features/cli/cmdbox_web_group_list.py +1 -1
  26. cmdbox/app/features/cli/cmdbox_web_start.py +1 -1
  27. cmdbox/app/features/cli/cmdbox_web_user_add.py +1 -1
  28. cmdbox/app/features/cli/cmdbox_web_user_del.py +1 -1
  29. cmdbox/app/features/cli/cmdbox_web_user_edit.py +1 -1
  30. cmdbox/app/features/cli/cmdbox_web_user_list.py +1 -1
  31. cmdbox/app/features/web/cmdbox_web_audit.py +87 -0
  32. cmdbox/app/features/web/cmdbox_web_audit_metrics.py +72 -0
  33. cmdbox/app/features/web/cmdbox_web_exec_cmd.py +10 -5
  34. cmdbox/app/features/web/cmdbox_web_user_data.py +58 -0
  35. cmdbox/app/options.py +49 -19
  36. cmdbox/app/server.py +15 -3
  37. cmdbox/app/web.py +7 -1
  38. cmdbox/extensions/features.yml +11 -8
  39. cmdbox/extensions/sample_project/sample/app/features/cli/sample_server_time.py +1 -1
  40. cmdbox/extensions/user_list.yml +5 -0
  41. cmdbox/licenses/LICENSE.Jinja2.3.1.4(BSD License).txt +28 -0
  42. cmdbox/licenses/LICENSE.Pygments.2.18.0(BSD License).txt +25 -0
  43. cmdbox/licenses/LICENSE.Sphinx.8.1.3(BSD License).txt +31 -0
  44. cmdbox/licenses/LICENSE.anyio.4.6.2.post1(MIT License).txt +20 -0
  45. cmdbox/licenses/LICENSE.argcomplete.3.5.1(Apache Software License).txt +177 -0
  46. cmdbox/licenses/LICENSE.argcomplete.3.6.2(Apache Software License).txt +177 -0
  47. cmdbox/licenses/LICENSE.babel.2.16.0(BSD License).txt +27 -0
  48. cmdbox/licenses/LICENSE.certifi.2024.8.30(Mozilla Public License 2.0 (MPL 2.0)).txt +20 -0
  49. cmdbox/licenses/LICENSE.charset-normalizer.3.4.0(MIT License).txt +21 -0
  50. cmdbox/licenses/LICENSE.click.8.1.7(BSD License).txt +28 -0
  51. cmdbox/licenses/LICENSE.cryptography.43.0.3(Apache Software License; BSD License).txt +3 -0
  52. cmdbox/licenses/LICENSE.fastapi.0.115.5(MIT License).txt +21 -0
  53. cmdbox/licenses/LICENSE.gevent.25.4.1(MIT).txt +25 -0
  54. cmdbox/licenses/LICENSE.greenlet.3.2.0(MIT AND Python-2.0).txt +30 -0
  55. cmdbox/licenses/LICENSE.importlib_metadata.8.5.0(Apache Software License).txt +202 -0
  56. cmdbox/licenses/LICENSE.keyring.25.5.0(MIT License).txt +17 -0
  57. cmdbox/licenses/LICENSE.more-itertools.10.5.0(MIT License).txt +19 -0
  58. cmdbox/licenses/LICENSE.nh3.0.2.18(MIT).txt +1 -0
  59. cmdbox/licenses/LICENSE.numpy.2.1.3(BSD License).txt +950 -0
  60. cmdbox/licenses/LICENSE.pillow.11.0.0(CMU License (MIT-CMU)).txt +1226 -0
  61. cmdbox/licenses/LICENSE.pillow.11.2.1(UNKNOWN).txt +1200 -0
  62. cmdbox/licenses/LICENSE.pkginfo.1.10.0(MIT License).txt +21 -0
  63. cmdbox/licenses/LICENSE.prettytable.3.12.0(BSD License).txt +30 -0
  64. cmdbox/licenses/LICENSE.prompt_toolkit.3.0.51(BSD License).txt +27 -0
  65. cmdbox/licenses/LICENSE.pydantic.2.10.2(MIT License).txt +21 -0
  66. cmdbox/licenses/LICENSE.pydantic.2.11.3(MIT License).txt +21 -0
  67. cmdbox/licenses/LICENSE.pydantic_core.2.27.1(MIT License).txt +21 -0
  68. cmdbox/licenses/LICENSE.pydantic_core.2.33.1(MIT License).txt +21 -0
  69. cmdbox/licenses/LICENSE.python-dotenv.1.0.1(BSD License).txt +27 -0
  70. cmdbox/licenses/LICENSE.python-multipart.0.0.17(Apache Software License).txt +14 -0
  71. cmdbox/licenses/LICENSE.redis.5.2.0(MIT License).txt +21 -0
  72. cmdbox/licenses/LICENSE.rich.13.9.4(MIT License).txt +19 -0
  73. cmdbox/licenses/LICENSE.six.1.16.0(MIT License).txt +18 -0
  74. cmdbox/licenses/LICENSE.sphinx-intl.2.3.0(BSD License).txt +25 -0
  75. cmdbox/licenses/LICENSE.starlette.0.41.3(BSD License).txt +27 -0
  76. cmdbox/licenses/LICENSE.starlette.0.46.2(BSD License).txt +27 -0
  77. cmdbox/licenses/LICENSE.tomli.2.1.0(MIT License).txt +21 -0
  78. cmdbox/licenses/LICENSE.twine.5.1.1(Apache Software License).txt +174 -0
  79. cmdbox/licenses/LICENSE.typing_extensions.4.12.2(Python Software Foundation License).txt +279 -0
  80. cmdbox/licenses/LICENSE.typing_extensions.4.13.2(UNKNOWN).txt +279 -0
  81. cmdbox/licenses/LICENSE.urllib3.2.2.3(MIT License).txt +21 -0
  82. cmdbox/licenses/LICENSE.urllib3.2.4.0(UNKNOWN).txt +21 -0
  83. cmdbox/licenses/LICENSE.uvicorn.0.32.1(BSD License).txt +27 -0
  84. cmdbox/licenses/LICENSE.uvicorn.0.34.1(BSD License).txt +27 -0
  85. cmdbox/licenses/LICENSE.watchfiles.1.0.0(MIT License).txt +21 -0
  86. cmdbox/licenses/LICENSE.watchfiles.1.0.5(MIT License).txt +21 -0
  87. cmdbox/licenses/LICENSE.websockets.14.1(BSD License).txt +24 -0
  88. cmdbox/licenses/LICENSE.zope.interface.7.1.1(Zope Public License).txt +44 -0
  89. cmdbox/licenses/files.txt +12 -13
  90. cmdbox/version.py +2 -2
  91. cmdbox/web/assets/apexcharts/apexcharts.css +679 -0
  92. cmdbox/web/assets/apexcharts/apexcharts.min.js +38 -0
  93. cmdbox/web/assets/cmdbox/audit.js +404 -0
  94. cmdbox/web/assets/cmdbox/color_mode.css +4 -0
  95. cmdbox/web/assets/cmdbox/common.js +397 -24
  96. cmdbox/web/assets/cmdbox/filer_modal.js +1 -1
  97. cmdbox/web/assets/cmdbox/list_cmd.js +7 -271
  98. cmdbox/web/assets/cmdbox/list_pipe.js +3 -3
  99. cmdbox/web/assets/cmdbox/users.js +17 -17
  100. cmdbox/web/assets/cmdbox/view_raw.js +1 -1
  101. cmdbox/web/assets/cmdbox/view_result.js +11 -13
  102. cmdbox/web/assets/filer/filer.js +2 -2
  103. cmdbox/web/assets_license_list.txt +4 -1
  104. cmdbox/web/audit.html +293 -0
  105. cmdbox/web/filer.html +21 -10
  106. cmdbox/web/gui.html +21 -52
  107. cmdbox/web/result.html +9 -2
  108. cmdbox/web/users.html +7 -3
  109. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/METADATA +13 -10
  110. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/RECORD +114 -59
  111. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/LICENSE +0 -0
  112. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/WHEEL +0 -0
  113. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/entry_points.txt +0 -0
  114. {cmdbox-0.5.2.dist-info → cmdbox-0.5.3.1.dist-info}/top_level.txt +0 -0
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,24 @@ 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_args') or self.audit_write_args is None:
717
+ return
718
+ yml = self.features_yml_data
719
+ if yml is None or 'audit' not in yml or 'enabled' not in yml['audit'] or not yml['audit']['enabled']:
720
+ return
721
+ if not hasattr(self, 'audit_write') or self.audit_write is None:
701
722
  raise Exception('audit write feature is not found.')
702
723
  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
724
+ opt = self.audit_write_args.copy()
725
+ opt['audit_type'] = audit_type
705
726
  opt['clmsg_id'] = str(uuid.uuid4())
706
727
  opt['clmsg_date'] = clmsg_date
707
728
  opt['clmsg_src'] = opt['clmsg_src'] if 'clmsg_src' in opt else None
729
+ opt['clmsg_title'] = opt['clmsg_title'] if 'clmsg_title' in opt else None
708
730
  opt['clmsg_user'] = user
709
731
  opt['clmsg_tag'] = tags
710
732
  opt['format'] = False if opt.get('format') is None else opt['format']
@@ -744,6 +766,10 @@ class Options:
744
766
  else:
745
767
  clmsg_body[key] = common.to_str(val, 100)
746
768
  opt[key] = val
769
+ if hasattr(arg, 'redis_host'): opt['host'] = arg.redis_host
770
+ if hasattr(arg, 'redis_port'): opt['port'] = arg.redis_port
771
+ if hasattr(arg, 'redis_password'): opt['password'] = arg.redis_password
772
+ if hasattr(arg, 'svname'): opt['svname'] = arg.svname
747
773
  if hasattr(arg, 'clmsg_id'): opt['clmsg_id'] = arg.clmsg_id
748
774
  elif isinstance(arg, web.Web):
749
775
  opt['host'] = arg.redis_host
@@ -756,12 +782,16 @@ class Options:
756
782
  elif isinstance(arg, Request):
757
783
  if 'signin' in arg.session and arg.session['signin'] is not None and 'name' in arg.session['signin']:
758
784
  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
785
+ if opt['audit_type'] is None:
786
+ opt['audit_type'] = Options.AT_ADMIN if 'admin' in arg.session['signin']['groups'] else Options.AT_USER
760
787
  opt['clmsg_id'] = arg.session['signin']['clmsg_id'] if 'clmsg_id' in arg.session['signin'] else opt['clmsg_id']
761
788
  arg.session['signin']['clmsg_id'] = opt['clmsg_id']
762
789
  opt['clmsg_src'] = arg.url.path
763
790
  opt['clmsg_body'] = clmsg_body
791
+ opt['audit_type'] = opt['audit_type'] if opt['audit_type'] else Options.AT_EVENT
764
792
  if src is not None and src != "":
765
793
  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=[])
794
+ if title is not None and title != "":
795
+ opt['clmsg_title'] = title
796
+ audit_write_args = argparse.Namespace(**{k:common.chopdq(v) for k,v in opt.items()})
797
+ self.audit_write.apprun(logger, audit_write_args, tm=0.0, pf=[])
cmdbox/app/server.py CHANGED
@@ -133,6 +133,7 @@ class Server(filer.Filer):
133
133
 
134
134
  while self.is_running:
135
135
  try:
136
+ msg = None
136
137
  # ブロッキングリストから要素を取り出す
137
138
  ctime = time.time()
138
139
  self.redis_cli.hset(self.redis_cli.hbname, 'ctime', ctime)
@@ -186,18 +187,29 @@ class Server(filer.Filer):
186
187
  except exceptions.TimeoutError:
187
188
  pass
188
189
  except exceptions.ConnectionError as e:
189
- self.logger.warning(f"Connection to the server was lost. {e}", exec_info=True)
190
+ self.logger.warning(f"Connection to the server was lost. {e}", exc_info=True)
190
191
  if not self.redis_cli.check_server(find_svname=False, retry_count=self.retry_count, retry_interval=self.retry_interval, outstatus=True):
191
192
  self.is_running = False
192
193
  break
193
194
  except OSError as e:
194
- self.logger.warning(f"OSError. {e}", exec_info=True)
195
+ self.logger.warning(f"OSError. {e}. This message is not executable in the server environment. ({msg})", exc_info=True)
196
+ if msg is not None and len(msg) > 1:
197
+ self.redis_cli.rpush(msg[1], dict(warn=f"OSError. {e}. This message is not executable in the server environment. ({msg[0]})"))
198
+ error_cnt += 1
199
+ self.redis_cli.hset(self.redis_cli.hbname, 'error_cnt', error_cnt)
200
+ pass
201
+ except IndexError as e:
202
+ self.logger.warning(f"IndexError. {e}. The message received by the server is invalid. ({msg})", exc_info=True)
203
+ if msg is not None and len(msg) > 1:
204
+ self.redis_cli.rpush(msg[1], dict(warn=f"IndexError. {e}. The message received by the server is invalid. ({msg[0]})"))
205
+ error_cnt += 1
206
+ self.redis_cli.hset(self.redis_cli.hbname, 'error_cnt', error_cnt)
195
207
  pass
196
208
  except KeyboardInterrupt as e:
197
209
  self.is_running = False
198
210
  break
199
211
  except Exception as e:
200
- self.logger.warning(f"Unknown error occurred. {e}", exc_info=True)
212
+ self.logger.warning(f"Unknown error occurred. {e}. Service will be stopped due to unknown cause.({msg})", exc_info=True)
201
213
  self.is_running = False
202
214
  break
203
215
  self.redis_cli.delete(self.redis_cli.svname)
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,17 +39,20 @@ 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
- host: localhost # Specify the service host of the audit Redis server.
47
- port: 6379 # Specify the service port of the audit Redis server.
48
- password: password # Specify the access password of the audit Redis server.
49
- svname: server # Specify the audit service name of the inference server.
49
+ host: localhost # Specify the service host of the audit Redis server.However, if it is specified as a command line argument, it is ignored.
50
+ port: 6379 # Specify the service port of the audit Redis server.However, if it is specified as a command line argument, it is ignored.
51
+ password: password # Specify the access password of the audit Redis server.However, if it is specified as a command line argument, it is ignored.
52
+ svname: cmdbox # Specify the audit service name of the inference server.However, if it is specified as a command line argument, it is ignored.
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.
@@ -48,7 +48,7 @@ class ServerTime(feature.Feature):
48
48
  dict(opt="password", type=Options.T_STR, default=self.default_pass, required=True, multi=False, hide=True, choice=None,
49
49
  discription_ja="Redisサーバーのアクセスパスワード(任意)を指定します。省略時は `password` を使用します。",
50
50
  discription_en="Specify the access password of the Redis server (optional). If omitted, `password` is used."),
51
- dict(opt="svname", type=Options.T_STR, default="server", required=True, multi=False, hide=True, choice=None,
51
+ dict(opt="svname", type=Options.T_STR, default=self.default_svname, required=True, multi=False, hide=True, choice=None,
52
52
  discription_ja="サーバーのサービス名を指定します。省略時は `server` を使用します。",
53
53
  discription_en="Specify the service name of the inference server. If omitted, `server` is used."),
54
54
  dict(opt="timedelta", type=Options.T_INT, default=9, required=False, multi=False, hide=False, choice=None,
@@ -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,28 @@
1
+ Copyright 2007 Pallets
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of the copyright holder nor the names of its
15
+ contributors may be used to endorse or promote products derived from
16
+ this software without specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21
+ PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2006-2022 by the respective authors (see AUTHORS file).
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are
6
+ met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,31 @@
1
+ License for Sphinx
2
+ ==================
3
+
4
+ Unless otherwise indicated, all code in the Sphinx project is licenced under the
5
+ two clause BSD licence below.
6
+
7
+ Copyright (c) 2007-2024 by the Sphinx team (see AUTHORS file).
8
+ All rights reserved.
9
+
10
+ Redistribution and use in source and binary forms, with or without
11
+ modification, are permitted provided that the following conditions are
12
+ met:
13
+
14
+ * Redistributions of source code must retain the above copyright
15
+ notice, this list of conditions and the following disclaimer.
16
+
17
+ * Redistributions in binary form must reproduce the above copyright
18
+ notice, this list of conditions and the following disclaimer in the
19
+ documentation and/or other materials provided with the distribution.
20
+
21
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Alex Grönholm
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -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