mirror of https://github.com/midoks/mdserver-web
parent
5588a11ea5
commit
5b9b466cb9
@ -0,0 +1,162 @@ |
||||
# ---> Python |
||||
# Byte-compiled / optimized / DLL files |
||||
__pycache__/ |
||||
*.py[cod] |
||||
*$py.class |
||||
|
||||
# C extensions |
||||
*.so |
||||
|
||||
# Distribution / packaging |
||||
.Python |
||||
build/ |
||||
develop-eggs/ |
||||
dist/ |
||||
downloads/ |
||||
eggs/ |
||||
.eggs/ |
||||
lib/ |
||||
lib64/ |
||||
parts/ |
||||
sdist/ |
||||
var/ |
||||
wheels/ |
||||
share/python-wheels/ |
||||
*.egg-info/ |
||||
.installed.cfg |
||||
*.egg |
||||
MANIFEST |
||||
|
||||
# PyInstaller |
||||
# Usually these files are written by a python script from a template |
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it. |
||||
*.manifest |
||||
*.spec |
||||
|
||||
# Installer logs |
||||
pip-log.txt |
||||
pip-delete-this-directory.txt |
||||
|
||||
# Unit test / coverage reports |
||||
htmlcov/ |
||||
.tox/ |
||||
.nox/ |
||||
.coverage |
||||
.coverage.* |
||||
.cache |
||||
nosetests.xml |
||||
coverage.xml |
||||
*.cover |
||||
*.py,cover |
||||
.hypothesis/ |
||||
.pytest_cache/ |
||||
cover/ |
||||
|
||||
# Translations |
||||
*.mo |
||||
*.pot |
||||
|
||||
# Django stuff: |
||||
*.log |
||||
local_settings.py |
||||
db.sqlite3 |
||||
db.sqlite3-journal |
||||
|
||||
# Flask stuff: |
||||
instance/ |
||||
.webassets-cache |
||||
|
||||
# Scrapy stuff: |
||||
.scrapy |
||||
|
||||
# Sphinx documentation |
||||
docs/_build/ |
||||
|
||||
# PyBuilder |
||||
.pybuilder/ |
||||
target/ |
||||
|
||||
# Jupyter Notebook |
||||
.ipynb_checkpoints |
||||
|
||||
# IPython |
||||
profile_default/ |
||||
ipython_config.py |
||||
|
||||
# pyenv |
||||
# For a library or package, you might want to ignore these files since the code is |
||||
# intended to run in multiple environments; otherwise, check them in: |
||||
# .python-version |
||||
|
||||
# pipenv |
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. |
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies |
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not |
||||
# install all needed dependencies. |
||||
#Pipfile.lock |
||||
|
||||
# poetry |
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. |
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more |
||||
# commonly ignored for libraries. |
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control |
||||
#poetry.lock |
||||
|
||||
# pdm |
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. |
||||
#pdm.lock |
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it |
||||
# in version control. |
||||
# https://pdm.fming.dev/#use-with-ide |
||||
.pdm.toml |
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm |
||||
__pypackages__/ |
||||
|
||||
# Celery stuff |
||||
celerybeat-schedule |
||||
celerybeat.pid |
||||
|
||||
# SageMath parsed files |
||||
*.sage.py |
||||
|
||||
# Environments |
||||
.env |
||||
.venv |
||||
env/ |
||||
venv/ |
||||
ENV/ |
||||
env.bak/ |
||||
venv.bak/ |
||||
|
||||
# Spyder project settings |
||||
.spyderproject |
||||
.spyproject |
||||
|
||||
# Rope project settings |
||||
.ropeproject |
||||
|
||||
# mkdocs documentation |
||||
/site |
||||
|
||||
# mypy |
||||
.mypy_cache/ |
||||
.dmypy.json |
||||
dmypy.json |
||||
|
||||
# Pyre type checker |
||||
.pyre/ |
||||
|
||||
# pytype static type analyzer |
||||
.pytype/ |
||||
|
||||
# Cython debug symbols |
||||
cython_debug/ |
||||
|
||||
# PyCharm |
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can |
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore |
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear |
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder. |
||||
#.idea/ |
||||
|
@ -0,0 +1,73 @@ |
||||
Apache License |
||||
Version 2.0, January 2004 |
||||
http://www.apache.org/licenses/ |
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
||||
|
||||
1. Definitions. |
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. |
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. |
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. |
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. |
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. |
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. |
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). |
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. |
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." |
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. |
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. |
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. |
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: |
||||
|
||||
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and |
||||
|
||||
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and |
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and |
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. |
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. |
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. |
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. |
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. |
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. |
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. |
||||
|
||||
END OF TERMS AND CONDITIONS |
||||
|
||||
APPENDIX: How to apply the Apache License to your work. |
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. |
||||
|
||||
Copyright [yyyy] [name of copyright owner] |
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); |
||||
you may not use this file except in compliance with the License. |
||||
You may obtain a copy of the License at |
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0 |
||||
|
||||
Unless required by applicable law or agreed to in writing, software |
||||
distributed under the License is distributed on an "AS IS" BASIS, |
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
See the License for the specific language governing permissions and |
||||
limitations under the License. |
@ -0,0 +1,19 @@ |
||||
# plugins_system_safe |
||||
|
||||
系统加固插件 |
||||
|
||||
# DEBUG |
||||
``` |
||||
|
||||
https://code_hosting_007.midoks.me/midoks/plugins_system_safe |
||||
|
||||
ln -s /www/git/midoks/plugins_system_safe /www/server/mdserver-web/plugins/system_safe |
||||
|
||||
ln -s /www/wwwroot/midoks/plugins_system_safe /www/server/mdserver-web/plugins/system_safe |
||||
|
||||
|
||||
python3 /www/server/mdserver-web/plugins/system_safe/index.py bg_start |
||||
|
||||
systemctl daemon-reload |
||||
``` |
||||
|
@ -0,0 +1,958 @@ |
||||
{ |
||||
"open": false, |
||||
"service": { |
||||
"open": true, |
||||
"name": "服务加固", |
||||
"ps": "保护系统服务,开启后将无法添加和删除服务,部分软件无法安装!", |
||||
"paths": [ |
||||
{ |
||||
"path": "/etc/rc.d", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 509 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/init.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc0.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc1.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc2.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc3.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc4.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc5.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc6.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc.d/rc.local", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/init.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc0.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc1.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc2.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc3.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc4.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc5.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rc6.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/rcS.d", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/etc/systemd", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
}, |
||||
{ |
||||
"path": "/lib/systemd", |
||||
"chattr": "i", |
||||
"s_mode": 493, |
||||
"d_mode": 493 |
||||
} |
||||
] |
||||
}, |
||||
"home": { |
||||
"open": true, |
||||
"name": "环境变量加固", |
||||
"ps": "保护用户环境变量不被修改,开启后无法自定义用户环境变量!", |
||||
"paths": [ |
||||
{ |
||||
"path": "/root/.bash_history", |
||||
"chattr": "a", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/root/.bashrc", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/root/.bash_logout", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/root/.bash_profile", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/root/.profile", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/profile", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/bash.bashrc", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/sysctl.conf", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/sysctl.d", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
} |
||||
] |
||||
}, |
||||
"user": { |
||||
"open": true, |
||||
"name": "用户加固", |
||||
"ps": "保护用户,开启后将无法添加删除用户和修改用户密码!", |
||||
"paths": [ |
||||
{ |
||||
"path": "/etc/passwd", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/group", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/usr/sbin/groupadd", |
||||
"chattr": "i", |
||||
"s_mode": 488, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/usr/sbin/useradd", |
||||
"chattr": "i", |
||||
"s_mode": 488, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/usr/bin/passwd", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 420 |
||||
} |
||||
] |
||||
}, |
||||
"bin": { |
||||
"open": true, |
||||
"name": "关键目录加固", |
||||
"ps": "保护系统关键文件不被修改替换!", |
||||
"paths": [ |
||||
{ |
||||
"path": "/usr/bin", |
||||
"chattr": "i", |
||||
"s_mode": 365, |
||||
"d_mode": 365 |
||||
}, |
||||
{ |
||||
"path": "/usr/sbin", |
||||
"chattr": "i", |
||||
"s_mode": 365, |
||||
"d_mode": 365 |
||||
}, |
||||
{ |
||||
"path": "/etc/bashrc", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/usr/local/bin", |
||||
"chattr": "i", |
||||
"s_mode": 365, |
||||
"d_mode": 365 |
||||
}, |
||||
{ |
||||
"path": "/usr/local/sbin", |
||||
"chattr": "i", |
||||
"s_mode": 365, |
||||
"d_mode": 365 |
||||
}, |
||||
{ |
||||
"path": "/sbin", |
||||
"chattr": "i", |
||||
"s_mode": 365, |
||||
"d_mode": 365 |
||||
}, |
||||
{ |
||||
"path": "/bin", |
||||
"chattr": "i", |
||||
"s_mode": 365, |
||||
"d_mode": 365 |
||||
} |
||||
] |
||||
}, |
||||
"cron": { |
||||
"open": true, |
||||
"name": "计划任务加固", |
||||
"ps": "保护计划任务不被篡改,开启后无法添加删除计划任务!", |
||||
"paths": [ |
||||
{ |
||||
"path": "/usr/bin/crontab", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/crontab", |
||||
"chattr": "i", |
||||
"s_mode": 420, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/cron.d", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 509 |
||||
}, |
||||
{ |
||||
"path": "/etc/cron.daily", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/cron.hourly", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/cron.monthly", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/cron.weekly", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 420 |
||||
}, |
||||
{ |
||||
"path": "/etc/anacrontab", |
||||
"chattr": "i", |
||||
"s_mode": 384, |
||||
"d_mode": 384 |
||||
}, |
||||
{ |
||||
"path": "/var/spool/cron", |
||||
"chattr": "i", |
||||
"s_mode": 448, |
||||
"d_mode": 448 |
||||
}, |
||||
{ |
||||
"path": "/var/spool/cron/root", |
||||
"chattr": "i", |
||||
"s_mode": 384, |
||||
"d_mode": 384 |
||||
}, |
||||
{ |
||||
"path": "/var/spool/anacron", |
||||
"chattr": "i", |
||||
"s_mode": 509, |
||||
"d_mode": 509 |
||||
} |
||||
] |
||||
}, |
||||
"ssh": { |
||||
"open": true, |
||||
"name": "SSH服务加固", |
||||
"ps": "保护SSH不被暴力破解,记录用户登录日志", |
||||
"cycle": 120, |
||||
"limit": 3600, |
||||
"limit_count": 3 |
||||
}, |
||||
"process": { |
||||
"open": true, |
||||
"name": "异常进程监控", |
||||
"ps": "监控服务器进程列表,发现异常的进程后立即结束", |
||||
"process_white": [ |
||||
"pip", |
||||
"pip3", |
||||
"yum", |
||||
"apt-get", |
||||
"apt", |
||||
"redis-cli", |
||||
"memcached", |
||||
"sshd", |
||||
"vm", |
||||
"vim", |
||||
"htop", |
||||
"top", |
||||
"sh", |
||||
"bash", |
||||
"zip", |
||||
"gzip", |
||||
"rsync", |
||||
"tar", |
||||
"unzip", |
||||
"rar", |
||||
"unrar", |
||||
"php", |
||||
"composer", |
||||
"pkill", |
||||
"mongo", |
||||
"mongod", |
||||
"php-fpm", |
||||
"php-fpm5.6", |
||||
"php-fpm7.0", |
||||
"php-fpm7.1", |
||||
"php-fpm7.2", |
||||
"php-fpm7.3", |
||||
"php-fpm7.4", |
||||
"php-fpm8.1", |
||||
"php-fpm8.2", |
||||
"nginx", |
||||
"httpd", |
||||
"lsof", |
||||
"ps", |
||||
"vi", |
||||
"vim", |
||||
"redis-server", |
||||
"mysqld", |
||||
"mysqld_safe", |
||||
"mysql", |
||||
"pure-ftpd", |
||||
"sparse_dd", |
||||
"stunnel", |
||||
"squeezed", |
||||
"vncterm", |
||||
"awk", |
||||
"ruby", |
||||
"postgres", |
||||
"mpathalert", |
||||
"vncterm", |
||||
"multipathd", |
||||
"fe", |
||||
"elasticsyslog", |
||||
"syslogd", |
||||
"v6d", |
||||
"xapi", |
||||
"screen", |
||||
"runsvdir", |
||||
"svlogd", |
||||
"java", |
||||
"udevd", |
||||
"ntpd", |
||||
"irqbalance", |
||||
"qmgr", |
||||
"wpa_supplicant", |
||||
"mysqld_safe", |
||||
"sftp-server", |
||||
"lvmetad", |
||||
"gitlab-web", |
||||
"pure-ftpd", |
||||
"auditd", |
||||
"master", |
||||
"dbus-daemon", |
||||
"tapdisk", |
||||
"init", |
||||
"ksoftirqd", |
||||
"kworker", |
||||
"kmpathd", |
||||
"kmpath_handlerd", |
||||
"python", |
||||
"kdmflush", |
||||
"bioset", |
||||
"crond", |
||||
"kthreadd", |
||||
"migration", |
||||
"rcu_sched", |
||||
"kjournald", |
||||
"gcc", |
||||
"gcc++", |
||||
"nginx", |
||||
"mysqld", |
||||
"php-cgi", |
||||
"login", |
||||
"firewalld", |
||||
"iptables", |
||||
"systemd", |
||||
"network", |
||||
"dhclient", |
||||
"systemd-journald", |
||||
"chrony", |
||||
"chronyd", |
||||
"chronyc", |
||||
"NetworkManager", |
||||
"systemd-logind", |
||||
"systemd-udevd", |
||||
"polkitd", |
||||
"tuned", |
||||
"rsyslogd", |
||||
"AliYunDunUpdate", |
||||
"AliYunDun", |
||||
"du", |
||||
"sendmail", |
||||
"gunicorn", |
||||
"python2", |
||||
"python3", |
||||
"python34", |
||||
"python2.6", |
||||
"runsv", |
||||
"dd", |
||||
"mkfs", |
||||
"fdisk", |
||||
"systemd-resolve", |
||||
"rpm", |
||||
"cc1", |
||||
"cc1plus", |
||||
"as", |
||||
"acme.sh", |
||||
"cc", |
||||
"du", |
||||
"grep", |
||||
"awk", |
||||
"sed", |
||||
"cut", |
||||
"free", |
||||
"df", |
||||
"firewall-cmd", |
||||
"ufw", |
||||
"echo", |
||||
"ls", |
||||
"cp", |
||||
"mv", |
||||
"rm", |
||||
"diff", |
||||
"ln", |
||||
"cat", |
||||
"more", |
||||
"wtmp", |
||||
"date", |
||||
"e2fsck", |
||||
"gunzip", |
||||
"ifconfig", |
||||
"ip", |
||||
"route", |
||||
"ping", |
||||
"scp", |
||||
"telnet", |
||||
"cd", |
||||
"comm", |
||||
"touch", |
||||
"man", |
||||
"w", |
||||
"who", |
||||
"last", |
||||
"clock", |
||||
"uname", |
||||
"su", |
||||
"uptime", |
||||
"vmstat", |
||||
"mount", |
||||
"umount", |
||||
"mkdir", |
||||
"mkswap", |
||||
"swapon", |
||||
"e2fsck", |
||||
"tune2fs", |
||||
"groupadd", |
||||
"useradd", |
||||
"passwd", |
||||
"userdel", |
||||
"chown", |
||||
"chmod", |
||||
"chgrp", |
||||
"id", |
||||
"mail", |
||||
"gzip", |
||||
"bzip2", |
||||
"bunzip2", |
||||
"networking", |
||||
"ssh", |
||||
"find", |
||||
"locate", |
||||
"slocate", |
||||
"dir", |
||||
"vdir", |
||||
"pwd", |
||||
"rename", |
||||
"rmdir", |
||||
"updatedb", |
||||
"whereis", |
||||
"which", |
||||
"compress", |
||||
"ar", |
||||
"arj", |
||||
"gzexe", |
||||
"bzip2", |
||||
"cksum", |
||||
"cmp", |
||||
"col", |
||||
"colrm", |
||||
"csplit", |
||||
"diff3", |
||||
"emacs", |
||||
"join", |
||||
"head", |
||||
"sort", |
||||
"wc", |
||||
"uniq", |
||||
"tail", |
||||
"sum", |
||||
"ulimit", |
||||
"pkill", |
||||
"kill", |
||||
"killall", |
||||
"pidof", |
||||
"pstree", |
||||
"watch", |
||||
"pgrep", |
||||
"dumpe2fs", |
||||
"mke2fs", |
||||
"sync", |
||||
"lsyncd", |
||||
"tune2fs", |
||||
"basename", |
||||
"file", |
||||
"locate/slocate", |
||||
"ls/dir/vdir", |
||||
"bzcat", |
||||
"bzip2recover", |
||||
"bzless/bzmore", |
||||
"cpio", |
||||
"dump", |
||||
"lha", |
||||
"resotre", |
||||
"unarj", |
||||
"uncompress", |
||||
"zcat", |
||||
"zforce", |
||||
"zipinfo", |
||||
"znew", |
||||
"diffstat", |
||||
"ed", |
||||
"ex", |
||||
"expand", |
||||
"fmt", |
||||
"fold", |
||||
"grep/egrep/fgrep", |
||||
"ispell", |
||||
"jed", |
||||
"joe", |
||||
"less", |
||||
"look", |
||||
"od", |
||||
"paste", |
||||
"pico", |
||||
"spell", |
||||
"split", |
||||
"tac", |
||||
"tee", |
||||
"tr", |
||||
"unexpand", |
||||
"alias", |
||||
"bg", |
||||
"bind", |
||||
"declare", |
||||
"dirs", |
||||
"enable", |
||||
"eval", |
||||
"exec", |
||||
"exit", |
||||
"export", |
||||
"fc", |
||||
"fg", |
||||
"hash", |
||||
"history", |
||||
"jobs", |
||||
"logout", |
||||
"popd", |
||||
"pushd", |
||||
"set", |
||||
"shopt", |
||||
"umask", |
||||
"unalias", |
||||
"unset", |
||||
"accept", |
||||
"cancel", |
||||
"disable", |
||||
"lp", |
||||
"lpadmin", |
||||
"lpc", |
||||
"lpq", |
||||
"lpr", |
||||
"lprm", |
||||
"lpstat", |
||||
"pr", |
||||
"reject", |
||||
"bc", |
||||
"cal", |
||||
"clear", |
||||
"consoletype", |
||||
"ctrlaltdel", |
||||
"dircolors", |
||||
"eject", |
||||
"halt", |
||||
"hostid", |
||||
"hwclock", |
||||
"info", |
||||
"md5sum", |
||||
"letsencrypt", |
||||
"mandb", |
||||
"mesg", |
||||
"mtools", |
||||
"mtoolstest", |
||||
"poweroff", |
||||
"reboot", |
||||
"shutdown", |
||||
"sleep", |
||||
"stat", |
||||
"talk", |
||||
"wall", |
||||
"whatis", |
||||
"whoami", |
||||
"write", |
||||
"cmsgoagent.linu", |
||||
"yes", |
||||
"chfn", |
||||
"chsh", |
||||
"finger", |
||||
"gpasswd", |
||||
"groupdel", |
||||
"groupmod", |
||||
"groups", |
||||
"grpck", |
||||
"grpconv", |
||||
"grpunconv", |
||||
"logname", |
||||
"pwck", |
||||
"pwconv", |
||||
"dd", |
||||
"mariadbd", |
||||
"pwunconv", |
||||
"usermod", |
||||
"users", |
||||
"nice", |
||||
"nohup", |
||||
"renice", |
||||
"badblocks", |
||||
"blockdev", |
||||
"chattr", |
||||
"convertquota", |
||||
"e2image", |
||||
"e2label", |
||||
"edquota", |
||||
"fail2ban-server", |
||||
"findfs", |
||||
"fsck", |
||||
"grub", |
||||
"hdparm", |
||||
"lilo", |
||||
"lsattr", |
||||
"mkbootdisk", |
||||
"mkinitrd", |
||||
"mkisofs", |
||||
"mknod", |
||||
"mktemp", |
||||
"parted", |
||||
"quota", |
||||
"quotacheck", |
||||
"xargs", |
||||
"bcm-agent", |
||||
"bcm-si", |
||||
"quotaoff", |
||||
"quotaon", |
||||
"quotastat", |
||||
"repquota", |
||||
"swapoff", |
||||
"depmod", |
||||
"dmesg", |
||||
"insmod", |
||||
"iostat", |
||||
"ipcs", |
||||
"kernelversion", |
||||
"lsmod", |
||||
"modinfo", |
||||
"modprobe", |
||||
"mpstat", |
||||
"rmmod", |
||||
"sar", |
||||
"slabtop", |
||||
"sysctl", |
||||
"tload", |
||||
"startx", |
||||
"xauth", |
||||
"xhost", |
||||
"xinit", |
||||
"xlsatoms", |
||||
"xlsclients", |
||||
"xlsfonts", |
||||
"xset", |
||||
"chroot", |
||||
"nmap", |
||||
"ntfs-3g", |
||||
"sftp", |
||||
"slogin", |
||||
"sudo", |
||||
"awk/gawk", |
||||
"expr", |
||||
"gdb", |
||||
"ldd", |
||||
"make", |
||||
"nm", |
||||
"perl", |
||||
"test", |
||||
"arch", |
||||
"at", |
||||
"atq", |
||||
"atrm", |
||||
"batch", |
||||
"chkconfig", |
||||
"crontab", |
||||
"lastb", |
||||
"logrotate", |
||||
"logsave", |
||||
"logwatch", |
||||
"lsusb", |
||||
"patch", |
||||
"runlevel", |
||||
"service", |
||||
"telinit", |
||||
"dnsdomainname", |
||||
"domainname", |
||||
"hostname", |
||||
"ifcfg", |
||||
"ifdown", |
||||
"ifup", |
||||
"stmpd", |
||||
"nisdomainname", |
||||
"ypdomainname", |
||||
"arp", |
||||
"arping", |
||||
"arpwatch", |
||||
"dig", |
||||
"elinks", |
||||
"elm", |
||||
"ftp", |
||||
"host", |
||||
"ipcalc", |
||||
"lynx", |
||||
"ncftp", |
||||
"netstat", |
||||
"nslookup", |
||||
"pine", |
||||
"dhclient-script", |
||||
"rsh", |
||||
"tftp", |
||||
"tracepath", |
||||
"traceroute", |
||||
"wget", |
||||
"arptables", |
||||
"iptables-save", |
||||
"iptables-restore", |
||||
"tcpdump", |
||||
"ab", |
||||
"apachectl", |
||||
"exportfs", |
||||
"htdigest", |
||||
"htpasswd", |
||||
"mailq", |
||||
"mysqladmin", |
||||
"msqldump", |
||||
"mysqlimport", |
||||
"mysqlshow", |
||||
"nfsstat", |
||||
"showmount", |
||||
"smbclient", |
||||
"smbmount", |
||||
"smbpasswd", |
||||
"squid", |
||||
"pickup", |
||||
"local", |
||||
"localedef", |
||||
"bounce", |
||||
"smtp", |
||||
"smtpd", |
||||
"trivial-rewrite", |
||||
"xe-daemon", |
||||
"cleanup", |
||||
"nm-dispatcher", |
||||
"lsinitrd", |
||||
"barad_agent", |
||||
"stop.sh", |
||||
"YDService", |
||||
"agetty", |
||||
"systemctl", |
||||
"AliSecureCheckA", |
||||
"containerd", |
||||
"containerd-shim", |
||||
"certbot-auto", |
||||
"oneav", |
||||
"oneavd", |
||||
"oneav_service_m", |
||||
"s3fs", |
||||
"bosfs", |
||||
"cosfs", |
||||
"flock", |
||||
"raidcheck", |
||||
"run-parts", |
||||
"man-db.cron", |
||||
"YDLive", |
||||
"sgagent" |
||||
], |
||||
"process_white_rule": [ |
||||
"vif", |
||||
"node", |
||||
"pm2", |
||||
"npm", |
||||
"yarn", |
||||
"qemu", |
||||
"scsi_eh", |
||||
"xcp", |
||||
"xen", |
||||
"docker", |
||||
"yunsuo", |
||||
"scsi", |
||||
"jbd2", |
||||
"ext4", |
||||
"xfs", |
||||
"aliyun", |
||||
"kswapd", |
||||
"PM2", |
||||
"yunsuo", |
||||
"mkfs", |
||||
"Ali", |
||||
"watchdog", |
||||
"kworker", |
||||
"ksoftirqd", |
||||
"migration", |
||||
"mysql", |
||||
"/www/server/", |
||||
"cmsgoagent", |
||||
"python", |
||||
"python3", |
||||
"ifdown", |
||||
"node" |
||||
], |
||||
"process_exclude": [ |
||||
"php-fpm", |
||||
"mysqld", |
||||
"mongod", |
||||
"dockerd", |
||||
"docker-containerd", |
||||
"memcached", |
||||
"jsvc", |
||||
"jsvc.exec", |
||||
"nginx", |
||||
"node", |
||||
"pm2", |
||||
"npm", |
||||
"yarn", |
||||
"httpd", |
||||
"gunicorn", |
||||
"configure", |
||||
"make", |
||||
"curl", |
||||
"wget", |
||||
"anacron", |
||||
"mysqldump", |
||||
"node", |
||||
"php", |
||||
"mysql", |
||||
"netstat", |
||||
"redis", |
||||
"postfix" |
||||
] |
||||
} |
||||
} |
After Width: | Height: | Size: 812 B |
@ -0,0 +1,24 @@ |
||||
<div class="bt-form"> |
||||
<div class="bt-w-main"> |
||||
<div class="bt-w-menu"> |
||||
<p class="bgw" onclick="pluginService('system_safe');">服务</p> |
||||
<p onclick="pluginInitD('system_safe');">自启动</p> |
||||
<p onclick="ssConfigList();">防护配置</p> |
||||
<p onclick="ssLockAddress();">封锁IP</p> |
||||
<p onclick="ssLogAudit();">日志审计</p> |
||||
<p onclick="ssOpLog();">操作日志</p> |
||||
</div> |
||||
<div class="bt-w-con pd15"> |
||||
<div class="soft-man-con"></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
<script type="text/javascript" src="/plugins/file?name=system_safe&f=js/app.js"></script> |
||||
<script type="text/javascript"> |
||||
resetPluginWinWidth(800); |
||||
resetPluginWinHeight(500); |
||||
$.getScript("/plugins/file?name=system_safe&f=js/app.js", function(){ |
||||
pluginService('system_safe'); |
||||
}); |
||||
</script> |
@ -0,0 +1,20 @@ |
||||
{ |
||||
"sort": 1, |
||||
"ps": "提供灵活的系统加固功能,防止系统被植入木马,支持服务器日志审计功能", |
||||
"name": "system_safe", |
||||
"title": "系统加固", |
||||
"shell": "install.sh", |
||||
"versions":["1.0"], |
||||
"updates":["1.0"], |
||||
"tip": "soft", |
||||
"icon":"ico.png", |
||||
"checks": "server/system_safe", |
||||
"path": "server/system_safe", |
||||
"display": 1, |
||||
"author": "midoks", |
||||
"date": "2022-01-12", |
||||
"home": "", |
||||
"type": 0, |
||||
"pid": "4" |
||||
|
||||
} |
@ -0,0 +1,15 @@ |
||||
[Unit] |
||||
Description=system_safe server daemon |
||||
After=network.target |
||||
|
||||
[Service] |
||||
Type=forking |
||||
ExecStart={$SERVER_PATH}/init.d/system_safe start |
||||
ExecStop={$SERVER_PATH}/init.d/system_safe stop |
||||
ExecReload={$SERVER_PATH}/init.d/system_safe reload |
||||
ExecRestart={$SERVER_PATH}/init.d/system_safe restart |
||||
KillMode=process |
||||
Restart=on-failure |
||||
|
||||
[Install] |
||||
WantedBy=multi-user.target |
@ -0,0 +1,94 @@ |
||||
#!/bin/bash |
||||
# chkconfig: 2345 55 25 |
||||
# description:system_safe |
||||
|
||||
### BEGIN INIT INFO |
||||
# Provides: system_safe |
||||
# Required-Start: $all |
||||
# Required-Stop: $all |
||||
# Default-Start: 2 3 4 5 |
||||
# Default-Stop: 0 1 6 |
||||
# Short-Description: starts system_safe |
||||
# Description: starts the system_safe |
||||
### END INIT INFO |
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin |
||||
mw_path={$SERVER_PATH} |
||||
rootPath=$(dirname "$mw_path") |
||||
PATH=$PATH:$mw_path/bin |
||||
|
||||
if [ -f $rootPath/mdserver-web/bin/activate ];then |
||||
source $rootPath/mdserver-web/bin/activate |
||||
fi |
||||
|
||||
sys_start() |
||||
{ |
||||
isStart=$(ps aux |grep -E "(system_safe)"|grep -v grep|grep -v '/bin/bash'|grep -v 'system_safe/index.py start' | grep -v 'system_safe/index.py reload' | grep -v 'system_safe/index.py restart' | grep -v systemctl | grep -v '/bin/sh' | awk '{print $2}'|xargs) |
||||
if [ "$isStart" == '' ];then |
||||
echo -e "Starting system_safe service... \c" |
||||
cd $rootPath/mdserver-web |
||||
nohup python3 plugins/system_safe/index.py bg_start &> $mw_path/service.log & |
||||
sleep 0.5 |
||||
isStart=$(ps aux |grep -E "(system_safe)"|grep -v grep|awk '{print $2}'|xargs) |
||||
if [ "$isStart" == '' ];then |
||||
echo -e "\033[31mfailed\033[0m" |
||||
echo '------------------------------------------------------' |
||||
cat $mw_path/service.log |
||||
echo '------------------------------------------------------' |
||||
echo -e "\033[31mError: system_safe service startup failed.\033[0m" |
||||
return; |
||||
fi |
||||
echo -e "\033[32mdone\033[0m" |
||||
else |
||||
echo "Starting system_safe service (pid $isStart) already running" |
||||
fi |
||||
} |
||||
|
||||
sys_stop() |
||||
{ |
||||
echo -e "Stopping system_safe service... \c"; |
||||
pids=$(ps aux |grep -E "(system_safe)"|grep -v grep|grep -v '/bin/bash'|grep -v systemctl | grep -v 'system_safe/index.py bg_stop'|grep -v 'system_safe/index.py stop' | grep -v 'system_safe/index.py reload' | grep -v 'system_safe/index.py restart' |awk '{print $2}'|xargs) |
||||
arr=($pids) |
||||
for p in ${arr[@]} |
||||
do |
||||
kill -9 $p |
||||
done |
||||
cd $rootPath/mdserver-web |
||||
python3 plugins/system_safe/index.py bg_stop |
||||
echo -e "\033[32mdone\033[0m" |
||||
} |
||||
|
||||
sys_status() |
||||
{ |
||||
isStart=$(ps aux |grep -E "(system_safe)"|grep -v grep|grep -v systemctl|awk '{print $2}'|xargs) |
||||
if [ "$isStart" != '' ];then |
||||
echo -e "\033[32msystem_safe service (pid $isStart) already running\033[0m" |
||||
else |
||||
echo -e "\033[31msystem_safe service not running\033[0m" |
||||
fi |
||||
} |
||||
|
||||
case "$1" in |
||||
'start') |
||||
sys_start |
||||
;; |
||||
'stop') |
||||
sys_stop |
||||
;; |
||||
'restart') |
||||
sys_stop |
||||
sleep 0.2 |
||||
sys_start |
||||
;; |
||||
'reload') |
||||
sys_stop |
||||
sleep 0.2 |
||||
sys_start |
||||
;; |
||||
'status') |
||||
sys_status |
||||
;; |
||||
*) |
||||
echo "Usage: systemctl {start|stop|restart|reload} system_safe" |
||||
;; |
||||
esac |
@ -0,0 +1,47 @@ |
||||
#!/bin/bash |
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin |
||||
export PATH |
||||
|
||||
curPath=`pwd` |
||||
rootPath=$(dirname "$curPath") |
||||
rootPath=$(dirname "$rootPath") |
||||
serverPath=$(dirname "$rootPath") |
||||
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl |
||||
SYSOS=`uname` |
||||
VERSION=$2 |
||||
APP_NAME=system_safe |
||||
|
||||
Install_App() |
||||
{ |
||||
echo '正在安装脚本文件...' > $install_tmp |
||||
mkdir -p $serverPath/system_safe |
||||
echo "$VERSION" > $serverPath/system_safe/version.pl |
||||
echo 'install complete' > $install_tmp |
||||
|
||||
#初始化 |
||||
cd ${serverPath}/mdserver-web && python3 plugins/system_safe/index.py start $VERSION |
||||
cd ${serverPath}/mdserver-web && python3 plugins/system_safe/index.py initd_install $VERSION |
||||
} |
||||
|
||||
Uninstall_App() |
||||
{ |
||||
|
||||
if [ -f /usr/lib/systemd/system/${APP_NAME}.service ] || [ -f /lib/systemd/system/${APP_NAME}.service ] ;then |
||||
systemctl stop ${APP_NAME} |
||||
systemctl disable ${APP_NAME} |
||||
rm -rf /usr/lib/systemd/system/${APP_NAME}.service |
||||
rm -rf /lib/systemd/system/${APP_NAME}.service |
||||
systemctl daemon-reload |
||||
fi |
||||
|
||||
rm -rf $serverPath/system_safe |
||||
echo "uninstall completed" > $install_tmp |
||||
} |
||||
|
||||
action=$1 |
||||
if [ "${1}" == 'install' ];then |
||||
Install_App |
||||
else |
||||
Uninstall_App |
||||
fi |
@ -0,0 +1,606 @@ |
||||
function ssPost(method,args,callback){ |
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){ |
||||
_args = JSON.stringify(toArrayObject(args)); |
||||
} else { |
||||
_args = JSON.stringify(args); |
||||
} |
||||
|
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); |
||||
|
||||
|
||||
|
||||
var req_data = {}; |
||||
req_data['name'] = 'system_safe'; |
||||
req_data['script'] = 'system_safe'; |
||||
req_data['func'] = method; |
||||
req_data['args'] = _args; |
||||
$.post('/plugins/run', req_data, function(data) { |
||||
layer.close(loadT); |
||||
if (!data.status){ |
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
||||
return; |
||||
} |
||||
|
||||
if(typeof(callback) == 'function'){ |
||||
callback(data); |
||||
} |
||||
},'json');
|
||||
} |
||||
|
||||
function ssAsyncPost(method,args){ |
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){ |
||||
_args = JSON.stringify(toArrayObject(args)); |
||||
} else { |
||||
_args = JSON.stringify(args); |
||||
} |
||||
return syncPost('/plugins/run', {name:'system_safe', func:method, args:_args});
|
||||
} |
||||
|
||||
function ssPostCallbak(method, args, callback){ |
||||
var loadT = layer.msg('正在获取...', { icon: 16, time: 0, shade: 0.3 }); |
||||
|
||||
var req_data = {}; |
||||
req_data['name'] = 'system_safe'; |
||||
req_data['func'] = method; |
||||
req_data['script'] = 'system_safe'; |
||||
args['version'] = '1.0'; |
||||
|
||||
|
||||
if (typeof(args) == 'string'){ |
||||
req_data['args'] = JSON.stringify(toArrayObject(args)); |
||||
} else { |
||||
req_data['args'] = JSON.stringify(args); |
||||
} |
||||
|
||||
$.post('/plugins/callback', req_data, function(data) { |
||||
layer.close(loadT); |
||||
if (!data.status){ |
||||
layer.msg(data.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
||||
return; |
||||
} |
||||
|
||||
if(typeof(callback) == 'function'){ |
||||
callback(data); |
||||
} |
||||
},'json');
|
||||
} |
||||
|
||||
function getSafeConfigPathList(tag){ |
||||
ssPost('get_safe_data', {tag:tag}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var slist = rdata.data.paths; |
||||
|
||||
var body = ''; |
||||
for (var i = 0; i < slist.length; i++) { |
||||
body += "<tr>"; |
||||
body += "<td>"+slist[i]['path']+"</td>"; |
||||
|
||||
if (slist[i]['chattr'] == 'i'){ |
||||
body += "<td>只读</td>"; |
||||
} else if (slist[i]['chattr'] == 'a'){ |
||||
body += "<td>追加</td>"; |
||||
} else{ |
||||
body += "<td>只读</td>"; |
||||
} |
||||
|
||||
if (rdata.msg['open']){ |
||||
body += "<td>"+slist[i]['d_mode']+"</td>"; |
||||
body += "<td><a class='btlink'>已保护</a></td>"; |
||||
} else { |
||||
body += "<td>"+slist[i]['s_mode']+"</td>"; |
||||
body += "<td><a style='color:red;'>未保护</a></td>"; |
||||
} |
||||
body += "<td style='text-align: right;'><a class='btlink safe_path_delete' row='"+i+"'>删除</a></td>"; |
||||
body += "</tr>"; |
||||
} |
||||
|
||||
$('#safe-file-table tbody').html(body); |
||||
$('.safe_path_delete').click(function(){ |
||||
var id = $(this).attr('row'); |
||||
ssPost('del_safe_path',{tag:tag,index:id}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
getSafeConfigPathList(tag); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
function setSafeConfigPath(tag, alist){ |
||||
|
||||
layer.open({ |
||||
type: 1, |
||||
area: ['700px','535px'], |
||||
title: '配置【'+alist['name']+'】', |
||||
content: "<form class='bt-form pd20'>\ |
||||
<div style='border-bottom:#ccc 1px solid;margin-bottom:10px;padding-bottom:10px'>\ |
||||
<input class='bt-input-text' name='s_path' id='s_path' type='text' value='' style='width:370px;margin-right:5px;' placeholder='被保护的文件或目录完整路径'>\ |
||||
<a class='glyphicon cursor glyphicon-folder-open' onclick='changePath(\"s_path\")' style='color:#edca5c;margin-right:20px;font-size:16px'></a>\ |
||||
<select class='bt-input-text' name='chattr'>\ |
||||
<option value='i'>只读</option>\ |
||||
<option value='a'>追加</option>\ |
||||
</select>\ |
||||
<input class='bt-input-text mr5' name='d_mode' type='text' style='width:120px;' placeholder='权限'>\ |
||||
<button type='button' class='btn btn-success btn-sm va0 pull-right add_safe_config'>添加</button>\ |
||||
</div>\ |
||||
<div class='divtable'>\ |
||||
<div id='safe-file-table' class='table_head_fix' style='max-height:300px;overflow:auto;border:#ddd 1px solid'>\ |
||||
<table class='table table-hover' style='border:none'>\ |
||||
<thead>\ |
||||
<tr>\ |
||||
<th width='360'>路径</th>\ |
||||
<th>模式</th>\ |
||||
<th>权限</th>\ |
||||
<th>状态</th>\ |
||||
<th style='text-align: right;'>操作</th>\ |
||||
</tr>\ |
||||
</thead>\ |
||||
<tbody></tbody>\ |
||||
</table>\ |
||||
</div>\ |
||||
</div>\ |
||||
<ul class='help-info-text c7 ptb10' style='margin-top: 5px;'>\ |
||||
<li>【只读】无法修改、创建、删除文件和目录</li>\ |
||||
<li>【追加】只能追加内容,不能删除或修改原有内容</li>\ |
||||
<li>【权限】设置文件或目录在受保护状态下的权限(非继承),关闭保护后权限自动还原</li>\ |
||||
<li>【如何填写权限】请填写Linux权限代号,如:644、755、600、555等,如果不填写,则使用文件原来的权限</li>\ |
||||
</ul>\ |
||||
</form>", |
||||
success:function(){ |
||||
|
||||
$('.add_safe_config').click(function(){ |
||||
var path = $('input[name="s_path"]').val(); |
||||
var chattr = $('select[name="chattr"]').val(); |
||||
var d_mode = $('input[name="d_mode"]').val(); |
||||
ssPost('add_safe_path',{tag:tag,path:path,chattr:chattr,d_mode:d_mode}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
getSafeConfigPathList(tag); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
getSafeConfigPathList(tag); |
||||
|
||||
|
||||
} |
||||
|
||||
function setSafeConfigSsh(tag, alist){ |
||||
|
||||
|
||||
function setSafeConfigSshData(){ |
||||
ssPost('get_ssh_data', {}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var info = rdata.data; |
||||
|
||||
$('input[name="s_cycle"]').val(info['cycle']); |
||||
$('input[name="s_limit_count"]').val(info['limit_count']); |
||||
$('input[name="s_limit"]').val(info['limit']); |
||||
}); |
||||
} |
||||
layer.open({ |
||||
type: 1, |
||||
area: ['700px','210px'], |
||||
title: '配置【'+alist['name']+'】', |
||||
content: "<form class='bt-form pd20'>\ |
||||
<div style='border-bottom:#ccc 1px solid;margin-bottom:10px;padding-bottom:10px'>\ |
||||
在(检测周期)\ |
||||
<input class='bt-input-text' min='30' max='1800' name='s_cycle' type='number' value='120' style='width:80px;margin-right:5px;'>\ |
||||
秒内,登录错误(检测阈值)\ |
||||
<input class='bt-input-text' min='30' max='1800' name='s_limit_count' type='number' value='120' style='width:80px;margin-right:5px;'>\ |
||||
次,封锁(封锁时间)\ |
||||
<input min='60' class='bt-input-text' name='s_limit' type='number' value='3600' style='width:80px;margin-right:12px;'>\ |
||||
<button type='button' class='btn btn-success btn-sm va0 pull-right save_safe_ssh'>保存</button>\ |
||||
</div>\ |
||||
<ul class='help-info-text c7 ptb10' style='margin-top: 5px;'>\ |
||||
<li>触发以上策略后,客户端IP将被封锁一段时间</li>\ |
||||
<li>请在面板日志或操作日志中查看封锁记录</li>\ |
||||
<li>请在面板日志或操作日志中查看SSH成功登录的记录</li>\ |
||||
</ul>\ |
||||
</form>", |
||||
success:function(){ |
||||
setSafeConfigSshData(); |
||||
|
||||
$('.save_safe_ssh').click(function(){ |
||||
var cycle = $('input[name="s_cycle"]').val(); |
||||
var limit_count = $('input[name="s_limit_count"]').val(); |
||||
var limit = $('input[name="s_limit"]').val(); |
||||
ssPost('save_safe_ssh',{cycle:cycle,limit_count:limit_count,limit:limit}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
setSafeConfigSshData(); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
} |
||||
|
||||
function setSafeConfigProcessList(tag){ |
||||
ssPost('get_process_data', {}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var slist = rdata.data.process_white; |
||||
|
||||
var body = ''; |
||||
for (var i = 0; i < slist.length; i++) { |
||||
body += "<tr>\ |
||||
<td>"+slist[i]+"</td>\ |
||||
<td style='text-align: right;'><a class='btlink safe_path_delete' row='"+i+"'>删除</a></td>\ |
||||
</tr>"; |
||||
} |
||||
|
||||
$('#safe-file-table tbody').html(body); |
||||
$('.safe_path_delete').click(function(){ |
||||
var id = $(this).attr('row'); |
||||
ssPost('del_safe_proccess_name',{tag:tag,index:id}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
setSafeConfigProcessList(tag); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
function setSafeConfigProcess(tag, alist){ |
||||
layer.open({ |
||||
type: 1, |
||||
area: ['700px','535px'], |
||||
title: '配置【进程白名单】', |
||||
content: "<form class='bt-form pd20'>\ |
||||
<div style='border-bottom:#ccc 1px solid;margin-bottom:10px;padding-bottom:10px'>\ |
||||
<input class='bt-input-text' name='s_name' id='s_name' type='text' value='' style='width:370px;margin-right:5px;' placeholder='完整的进程名'>\ |
||||
<button type='button' class='btn btn-success btn-sm va0 pull-right add_process_white'>添加</button>\ |
||||
</div>\ |
||||
<div class='divtable'>\ |
||||
<div id='safe-file-table' class='table_head_fix' style='max-height:300px;overflow:auto;border:#ddd 1px solid'>\ |
||||
<table class='table table-hover' style='border:none'>\ |
||||
<thead>\ |
||||
<tr>\ |
||||
<th width='360'>进程名称</th>\ |
||||
<th style='text-align: right;'>操作</th>\ |
||||
</tr>\ |
||||
</thead>\ |
||||
<tbody></tbody>\ |
||||
</table>\ |
||||
</div>\ |
||||
</div>\ |
||||
<ul class='help-info-text c7 ptb10' style='margin-top: 5px;'>\ |
||||
<li>【进程名称】请填写完整的进程名称,如: mysqld</li>\ |
||||
<li>【说明】在白名单列表中的进程将不再检测范围,建议将常用软件的进程添加进白名单</li>\ |
||||
</ul>\ |
||||
</form>", |
||||
success:function(){ |
||||
$('.add_process_white').click(function(){ |
||||
var process_name = $('input[name="s_name"]').val(); |
||||
ssPost('add_process_white',{process_name:process_name}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
setSafeConfigProcessList(tag); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
} |
||||
}); |
||||
|
||||
setSafeConfigProcessList(tag); |
||||
|
||||
|
||||
} |
||||
|
||||
function setSafeConfig(tag, alist){ |
||||
|
||||
if ($.inArray(tag, ['bin', 'service', 'home', 'user', 'bin', 'cron'])>-1){ |
||||
setSafeConfigPath(tag,alist); |
||||
} |
||||
|
||||
if ($.inArray(tag, ['ssh'])>-1){ |
||||
setSafeConfigSsh(tag,alist); |
||||
} |
||||
|
||||
if ($.inArray(tag, ['process'])>-1){ |
||||
setSafeConfigProcess(tag,alist); |
||||
} |
||||
} |
||||
|
||||
//设置安全状态
|
||||
function setSafeStatus(obj,tag){ |
||||
var o = $(obj).prev(); |
||||
var status = $(o).prop('checked'); |
||||
ssPost('set_safe_status', {tag:tag,status:!status}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
|
||||
if (!rdata.status){ |
||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
||||
$(o).prop('checked',status); |
||||
return; |
||||
} |
||||
layer.msg("配置成功!",{icon:1,time:2000,shade: [0.3, '#000']}); |
||||
}); |
||||
} |
||||
|
||||
function ssConfigList(){ |
||||
|
||||
ssPost('conf',{},function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var libs = rdata.data; |
||||
// console.log(libs);
|
||||
var body = ''; |
||||
for (var i in libs) { |
||||
|
||||
if (i == 'open'){ |
||||
continue; |
||||
} |
||||
|
||||
var checked = ''; |
||||
if (libs[i].open){ |
||||
checked = 'checked'; |
||||
} |
||||
|
||||
body += '<tr>' + |
||||
'<td>' + libs[i].name + '</td>' + |
||||
'<td>' + libs[i].ps + '</td>' + |
||||
'<td>\ |
||||
<div class="ssh-item">\ |
||||
<input class="btswitch btswitch-ios" id="sys_service_'+i +'" type="checkbox" '+checked+'>\ |
||||
<label class="btswitch-btn service_switch" for="sys_service_'+i+'" style="width: 2em; height: 1.1em;padding:1px;"></label>\ |
||||
</div>\ |
||||
</td>'+ |
||||
'<td style="text-align: right;"><a id="conf_sys_service_'+i+'" class="btlink set_safe_config">配置</a></td>' + |
||||
'</tr>'; |
||||
} |
||||
|
||||
var con = '<div class="divtable" id="system_safe_list" style="margin-right:10px;max-height: 320px; overflow: auto; margin-right: 0px;">' + |
||||
'<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">' + |
||||
'<thead>' + |
||||
'<tr>' + |
||||
'<th>名称</th>' + |
||||
'<th>描述</th>' + |
||||
'<th width="40">状态</th>' + |
||||
'<th style="text-align: right;" width="50">操作</th>' + |
||||
'</tr>' + |
||||
'</thead>' + |
||||
'<tbody>' + body + '</tbody>' + |
||||
'</table>' + |
||||
'</div>' + |
||||
'<ul class="help-info-text c7 pull-left">\ |
||||
<li>开启系统加固功能后,一些如软件安装等敏感操作将被禁止</li>\ |
||||
<li>开启【SSH服务加固】之后,用户登录SSH的行为将受到监控,若连续多次登录失败,将采取封IP措施</li>\ |
||||
<li>【异常进程监控】与【SSH服务加固】会占用一定服务器开销</li>\ |
||||
<li><span style="color:red;">【注意】如果您需要安装软件或插件,请先将系统加固关闭!</span></li>\ |
||||
</ul>'; |
||||
|
||||
$('.soft-man-con').html(con); |
||||
|
||||
$('#system_safe_list .service_switch').click(function(){ |
||||
var val = $(this).prev().attr('id'); |
||||
val = val.replace('sys_service_',''); |
||||
setSafeStatus(this,val); |
||||
}); |
||||
|
||||
$('.set_safe_config').click(function(){ |
||||
var name = $(this).attr('id'); |
||||
// console.log(name);
|
||||
name = name.replace('conf_sys_service_',''); |
||||
setSafeConfig(name, libs[name]); |
||||
}); |
||||
|
||||
}); |
||||
|
||||
} |
||||
|
||||
function ssOpLogList(p){ |
||||
ssPost('op_log',{p:p},function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var plist = rdata.data.data; |
||||
|
||||
var body = ''; |
||||
for (var i = 0; i < plist.length; i++) { |
||||
body += "<tr>\ |
||||
<td><em class='dlt-num'>" + plist[i].addtime + "</em></td>\ |
||||
<td>" + plist[i].log + "</td>\ |
||||
</tr>"; |
||||
} |
||||
|
||||
$("#system_safe_log_list tbody").html(body); |
||||
$("#system_safe_log_page").html(rdata.data.page); |
||||
}); |
||||
} |
||||
|
||||
function ssOpLog(){ |
||||
var con = '<div class="divtable" id="system_safe_log_list" style="margin-right:10px;max-height: 380px; overflow: auto; margin-right: 0px;">\ |
||||
<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">\ |
||||
<thead><tr><th style="width:135px;">时间</th><th>详情</th></tr></thead>\ |
||||
<tbody></tbody>\ |
||||
</table>\ |
||||
</div>\ |
||||
<div id="system_safe_log_page" class="dataTables_paginate paging_bootstrap page"></div>'; |
||||
$('.soft-man-con').html(con); |
||||
ssOpLogList(1); |
||||
} |
||||
|
||||
|
||||
function ssLogAuditList(){ |
||||
ssPost('get_sys_logfiles',{},function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var plist = rdata.data; |
||||
var option = ''; |
||||
// console.log(plist);
|
||||
for (var i = 0; i < plist.length; i++) { |
||||
option += '<option value="'+plist[i]['name']+'">'+plist[i]['name'] +' - '+plist[i]['title']+'</option>'; |
||||
} |
||||
|
||||
$("#system_safe_log_audit").html(option); |
||||
var log_name = $('#system_safe_log_audit option:first').val(); |
||||
ssLogAuditFile(log_name); |
||||
|
||||
$('#system_safe_log_audit').change(function(){ |
||||
var log_name = $('#system_safe_log_audit option:selected').val(); |
||||
ssLogAuditFile(log_name); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
function ssLogAuditFileRenderString(data){ |
||||
|
||||
var tbody = '<textarea style="margin: 0px;width: 100%;height: 380px;background-color: #333;color:#fff; padding:0 5px" id="system_safe_log_audit_str"></textarea>'; |
||||
$("#system_safe_log_audit_list").html(tbody); |
||||
var ob = document.getElementById('system_safe_log_audit_str'); |
||||
ob.scrollTop = ob.scrollHeight; |
||||
|
||||
$("#system_safe_log_audit_str").html(data); |
||||
} |
||||
|
||||
function ssLogAuditFileRenderObject(plist){ |
||||
|
||||
var pre_html = '<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">\ |
||||
<thead><tr><th>时间</th><th>角色</th><th>事件</th></tr></thead>\ |
||||
<tbody></tbody>\ |
||||
</table>'; |
||||
$("#system_safe_log_audit_list").html(pre_html); |
||||
|
||||
if (plist.length>0){ |
||||
var tmp = plist[0]; |
||||
// console.log(tmp);
|
||||
var thead = ''; |
||||
tbody += '<tr>' |
||||
for (var i in tmp) { |
||||
tbody+='<th>'+ i + '</th>'; |
||||
} |
||||
tbody += '</tr>'; |
||||
$("#system_safe_log_audit_list thead").html(tbody); |
||||
} |
||||
|
||||
|
||||
var tbody = ''; |
||||
for (var i = 0; i < plist.length; i++) { |
||||
tbody += '<tr>'; |
||||
for (var vv in plist[i]) { |
||||
tbody+= '<td>'+ plist[i][vv] + '</td>' |
||||
} |
||||
tbody += '</tr>'; |
||||
} |
||||
|
||||
$("#system_safe_log_audit_list tbody").html(tbody); |
||||
} |
||||
|
||||
function ssLogAuditFile(log_name){ |
||||
// ssPost('get_sys_log',{log_name:log_name},function(rdata){
|
||||
// try{
|
||||
// var rdata = $.parseJSON(rdata.data);
|
||||
// if (typeof(rdata.data) == 'object'){
|
||||
|
||||
// if (!rdata.status){
|
||||
// layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
|
||||
// return;
|
||||
// }
|
||||
// var plist = rdata.data;
|
||||
// ssLogAuditFileRenderObject(plist);
|
||||
// }
|
||||
// }catch(e){
|
||||
// if (typeof(rdata.data) == 'string'){
|
||||
// ssLogAuditFileRenderString(rdata.data);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
ssPostCallbak('get_sys_log',{log_name:log_name},function(rdata){ |
||||
try{ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
if (typeof(rdata.data) == 'object'){ |
||||
if (!rdata.status){ |
||||
layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']}); |
||||
return; |
||||
} |
||||
var plist = rdata.data; |
||||
ssLogAuditFileRenderObject(plist); |
||||
} |
||||
}catch(e){ |
||||
if (typeof(rdata.data) == 'string'){ |
||||
ssLogAuditFileRenderString(rdata.data); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
function ssLogAudit(){ |
||||
var con = '<select id="system_safe_log_audit" class="bt-input-text mr20" style="width:50%;margin-bottom: 3px;">\ |
||||
<option value="0">请选择</option>\ |
||||
</select>\ |
||||
<div class="divtable" id="system_safe_log_audit_list" style="margin-right:10px;height: 380px; overflow: auto; margin-right: 0px;"></div>'; |
||||
$('.soft-man-con').html(con); |
||||
ssLogAuditList(); |
||||
} |
||||
|
||||
function ssLockAddressList(){ |
||||
ssPost('get_ssh_limit_info',{},function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
var libs = rdata.data; |
||||
var tbody = ''; |
||||
for (var i in libs) { |
||||
var end_time = libs[i].end; |
||||
var time_title = '手动解封'; |
||||
if (end_time != '0'){ |
||||
time_title = '自动解封时间:'+end_time; |
||||
} |
||||
tbody += '<tr>' + |
||||
'<td style="width:100px;">' + libs[i].address + '</td>' + |
||||
'<td style="width:100px;">'+time_title+'</td>' + |
||||
'<td style="text-align: right;"><a ip="'+libs[i].address+'" class="btlink remove_ssh_limit">立即解封</a></td>' + |
||||
'</tr>'; |
||||
} |
||||
|
||||
$('#system_lock_address tbody').html(tbody); |
||||
$('#system_lock_address .remove_ssh_limit').click(function(){ |
||||
var address = $(this).attr('ip'); |
||||
ssPost('remove_ssh_limit', {ip:address}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
ssLockAddressList(); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
function ssLockAddress(){ |
||||
|
||||
var con = '<div style="margin-bottom:10px;">\ |
||||
<input class="bt-input-text" name="s_address" type="text" value="" style="width:250px;margin-right:12px;" placeholder="IP地址">\ |
||||
<button class="btn btn-success btn-sm va0 add_lock_address">添加</button>\ |
||||
</div>\ |
||||
<div class="divtable" id="system_lock_address" style="margin-right:10px;max-height: 320px; overflow: auto; margin-right: 0px;">' + |
||||
'<table class="table table-hover" width="100%" cellspacing="0" cellpadding="0" border="0">' + |
||||
'<thead>' + |
||||
'<tr>' + |
||||
'<th>IP</th>' + |
||||
'<th>解封时间</th>' + |
||||
'<th style="text-align: right;" width="50">操作</th>' + |
||||
'</tr>' + |
||||
'</thead>' + |
||||
'<tbody></tbody>' + |
||||
'</table>' + |
||||
'</div>' + |
||||
'<ul class="help-info-text c7 pull-left">\ |
||||
<li>【封锁IP】此处封锁的IP仅针对SSH服务,即被封锁的IP将无法连接SSH</li>\ |
||||
<li>【添加】手动添加的IP封锁只能手动解封!</li>\ |
||||
</ul>'; |
||||
|
||||
$('.soft-man-con').html(con); |
||||
|
||||
$('.add_lock_address').click(function(){ |
||||
var address = $('input[name="s_address"]').val(); |
||||
ssPost('add_ssh_limit', {ip:address}, function(rdata){ |
||||
var rdata = $.parseJSON(rdata.data); |
||||
showMsg(rdata.msg, function(){ |
||||
ssLockAddressList(); |
||||
},{icon:rdata.status?1:2,shade: [0.3, '#000']},2000); |
||||
}); |
||||
}); |
||||
ssLockAddressList(); |
||||
} |
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue