Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #88

Merged
merged 19 commits into from
Feb 11, 2025
Merged

Dev #88

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ docker compose up -d

## 技术栈

* SpringBoot 2.7.+
* Mysql 8.0.+
* Redis 6.0.+
* Vue3 3.2.+
* Arco Design 2.55.+
* SpringBoot 2.7+
* Mysql 8+
* Redis 6+
* Vue3 3+
* Arco Design 2+

## 主要功能预览

Expand Down
2 changes: 1 addition & 1 deletion docker/adminer/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.3.1
version=2.3.2
docker build -t orion-visor-adminer:${version} .
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version}
docker tag orion-visor-adminer:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:latest
2 changes: 1 addition & 1 deletion docker/mysql/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.3.1
version=2.3.2
cp -r ../../sql ./sql
docker build -t orion-visor-mysql:${version} .
rm -rf ./sql
Expand Down
2 changes: 1 addition & 1 deletion docker/push.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.3.1
version=2.3.2
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-adminer:${version}
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-mysql:${version}
docker push registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version}
Expand Down
2 changes: 1 addition & 1 deletion docker/redis/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.3.1
version=2.3.2
docker build -t orion-visor-redis:${version} .
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:${version}
docker tag orion-visor-redis:${version} registry.cn-hangzhou.aliyuncs.com/orionsec/orion-visor-redis:latest
2 changes: 1 addition & 1 deletion docker/service/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#/bin/bash
version=2.3.1
version=2.3.2
mv ../../orion-visor-launch/target/orion-visor-launch.jar ./orion-visor-launch.jar
mv ../../orion-visor-ui/dist ./dist
docker build --no-cache -t orion-visor-service:${version} .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public interface AppConst extends OrionConst {
/**
* 同 ${orion.version} 迭代时候需要手动更改
*/
String VERSION = "2.3.1";
String VERSION = "2.3.2";

/**
* 同 ${spring.application.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,119 @@
*/
public interface ConfigKeys {

/**
* SFTP 文件预览大小
*/
String SFTP_PREVIEW_SIZE = "sftp_previewSize";

/**
* SFTP 重复文件备份
*/
String SFTP_UPLOAD_PRESENT_BACKUP = "sftp_uploadPresentBackup";

/**
* SFTP 备份文件名称
*/
String SFTP_UPLOAD_BACKUP_FILE_NAME = "sftp_uploadBackupFileName";

/**
* 加密公钥
*/
String ENCRYPT_PUBLIC_KEY = "encrypt.publicKey";
String ENCRYPT_PUBLIC_KEY = "encrypt_publicKey";

/**
* 加密私钥
*/
String ENCRYPT_PRIVATE_KEY = "encrypt.privateKey";
String ENCRYPT_PRIVATE_KEY = "encrypt_privateKey";

/**
* 日志前端显示行数
*/
String LOG_WEB_SCROLL_LINES = "log_webScrollLines";

/**
* 日志加载偏移行
*/
String LOG_TRACKER_LOAD_LINES = "log_trackerLoadLines";

/**
* 日志加载间隔毫秒
*/
String LOG_TRACKER_LOAD_INTERVAL = "log_trackerLoadInterval";

/**
* 是否生成详细的执行日志
*/
String LOG_EXEC_DETAIL_LOG = "log_execDetailLog";

/**
* 凭证有效期分
*/
String LOGIN_LOGIN_SESSION_TIME = "login_loginSessionTime";

/**
* 允许多端登录
*/
String LOGIN_ALLOW_MULTI_DEVICE = "login_allowMultiDevice";

/**
* 允许凭证续签
*/
String LOGIN_ALLOW_REFRESH = "login_allowRefresh";

/**
* 凭证续签最大次数
*/
String LOGIN_MAX_REFRESH_COUNT = "login_maxRefreshCount";

/**
* 凭证续签间隔分
*/
String LOGIN_REFRESH_INTERVAL = "login_refreshInterval";

/**
* 登录失败锁定
*/
String LOGIN_LOGIN_FAILED_LOCK = "login_loginFailedLock";

/**
* 登录失败锁定阈值分
*/
String LOGIN_LOGIN_FAILED_LOCK_THRESHOLD = "login_loginFailedLockThreshold";

/**
* 登录失败锁定时间分
*/
String LOGIN_LOGIN_FAILED_LOCK_TIME = "login_loginFailedLockTime";

/**
* 登录失败发信
*/
String LOGIN_LOGIN_FAILED_SEND = "login_loginFailedSend";

/**
* 登录失败发信阈值
*/
String LOGIN_LOGIN_FAILED_SEND_THRESHOLD = "login_loginFailedSendThreshold";

/**
* 是否开启自动清理命令记录
*/
String AUTO_CLEAR_EXEC_LOG_ENABLED = "autoClear_execLogEnabled";

/**
* 自动清理命令记录保留天数
*/
String AUTO_CLEAR_EXEC_LOG_KEEP_DAYS = "autoClear_execLogKeepDays";

/**
* 是否开启自动清理终端连接记录
*/
String AUTO_CLEAR_TERMINAL_LOG_ENABLED = "autoClear_terminalLogEnabled";

/**
* 自动清理终端连接记录保留天数
*/
String AUTO_CLEAR_TERMINAL_LOG_KEEP_DAYS = "autoClear_terminalLogKeepDays";

}
2 changes: 1 addition & 1 deletion orion-visor-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<url>https://github.com/dromara/orion-visor</url>

<properties>
<revision>2.3.1</revision>
<revision>2.3.2</revision>
<spring.boot.version>2.7.17</spring.boot.version>
<spring.boot.admin.version>2.7.15</spring.boot.admin.version>
<flatten.maven.plugin.version>1.5.0</flatten.maven.plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
*/
public class ReplaceVersion {

private static final String TARGET_VERSION = "2.3.0";
private static final String TARGET_VERSION = "2.3.1";

private static final String REPLACE_VERSION = "2.3.1";
private static final String REPLACE_VERSION = "2.3.2";

private static final String PATH = new File("").getAbsolutePath();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.dromara.visor.module.asset.entity.request.exec.ExecInterruptRequest;
import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest;
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
import org.dromara.visor.module.asset.entity.request.exec.ExecLogTailRequest;
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
import org.dromara.visor.module.asset.entity.vo.ExecLogStatusVO;
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
Expand Down Expand Up @@ -93,6 +92,14 @@ public ExecLogVO getExecCommandLog(@RequestParam("id") Long id) {
return execLogService.getExecLog(id, SOURCE);
}

@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get-host")
@Operation(summary = "查询执行主机日志")
@PreAuthorize("@ss.hasPermission('asset:exec-command-log:query')")
public ExecHostLogVO getExecCommandHostLog(@RequestParam("id") Long id) {
return execHostLogService.getExecHostLog(id);
}

@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/host-list")
@Operation(summary = "查询全部执行主机日志")
Expand Down Expand Up @@ -164,12 +171,12 @@ public Integer clearExecCommandLog(@Validated @RequestBody ExecLogClearRequest r
return execLogService.clearExecLog(request);
}

@PostMapping("/tail")
@GetMapping("/tail")
@Operation(summary = "查看批量执行日志")
@Parameter(name = "id", description = "id", required = true)
@PreAuthorize("@ss.hasAnyPermission('asset:exec-command-log:query', 'asset:exec-command:exec')")
public String getExecCommandLogTailToken(@Validated @RequestBody ExecLogTailRequest request) {
request.setSource(SOURCE);
return execLogService.getExecLogTailToken(request);
public String getExecCommandLogTailToken(@RequestParam("id") Long id) {
return execLogService.getExecLogTailToken(id);
}

@OperatorLog(ExecCommandLogOperatorType.DOWNLOAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import org.dromara.visor.module.asset.entity.request.exec.ExecInterruptRequest;
import org.dromara.visor.module.asset.entity.request.exec.ExecLogClearRequest;
import org.dromara.visor.module.asset.entity.request.exec.ExecLogQueryRequest;
import org.dromara.visor.module.asset.entity.request.exec.ExecLogTailRequest;
import org.dromara.visor.module.asset.entity.vo.ExecHostLogVO;
import org.dromara.visor.module.asset.entity.vo.ExecLogStatusVO;
import org.dromara.visor.module.asset.entity.vo.ExecLogVO;
Expand Down Expand Up @@ -92,6 +91,14 @@ public ExecLogVO getExecJobLog(@RequestParam("id") Long id) {
return execLogService.getExecLog(id, SOURCE);
}

@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/get-host")
@Operation(summary = "查询执行主机日志")
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
public ExecHostLogVO getExecJobHostLog(@RequestParam("id") Long id) {
return execHostLogService.getExecHostLog(id);
}

@IgnoreLog(IgnoreLogMode.RET)
@GetMapping("/host-list")
@Operation(summary = "查询全部执行主机日志")
Expand Down Expand Up @@ -153,12 +160,12 @@ public Integer clearExecJobLog(@Validated @RequestBody ExecLogClearRequest reque
return execLogService.clearExecLog(request);
}

@PostMapping("/tail")
@GetMapping("/tail")
@Operation(summary = "查看计划任务日志")
@PreAuthorize("@ss.hasPermission('asset:exec-job-log:query')")
public String getExecJobLogTailToken(@Validated @RequestBody ExecLogTailRequest request) {
request.setSource(SOURCE);
return execLogService.getExecLogTailToken(request);
@Parameter(name = "id", description = "id", required = true)
@PreAuthorize("@ss.hasPermission('exec:exec-job-log:query')")
public String getExecJobLogTailToken(@RequestParam("id") Long id) {
return execLogService.getExecLogTailToken(id);
}

@OperatorLog(ExecJobLogOperatorType.DOWNLOAD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Long getTerminalConnectLogCount(@Validated @RequestBody TerminalConnectLo
}

@IgnoreLog(IgnoreLogMode.RET)
@PostMapping("/session")
@PostMapping("/sessions")
@Operation(summary = "查询全部终端连接会话")
@PreAuthorize("@ss.hasPermission('asset:terminal-connect-session:management:query')")
public List<TerminalConnectLogVO> getTerminalConnectSessions(@Validated @RequestBody TerminalConnectLogQueryRequest request) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,20 @@ default List<ExecHostLogDO> selectByLogId(Long logId) {
.list();
}

/**
* 通过 logId 查询
*
* @param id id
* @param logId logId
* @return row
*/
default ExecHostLogDO selectByIdAndLogId(Long id, Long logId) {
return this.of()
.createWrapper()
.eq(ExecHostLogDO::getId, id)
.eq(ExecHostLogDO::getLogId, logId)
.then()
.get();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright (c) 2023 - present Dromara, All rights reserved.
*
* https://visor.dromara.org
* https://visor.dromara.org.cn
* https://visor.orionsec.cn
*
* Members:
* Jiahang Li - [email protected] - author
*
* 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.
*/
package org.dromara.visor.module.asset.define.config;

import org.dromara.visor.common.config.ConfigRef;
import org.dromara.visor.common.config.ConfigStore;
import org.dromara.visor.common.constant.ConfigKeys;
import org.springframework.stereotype.Component;

/**
* 自动清理设置
*
* @author Jiahang Li
* @version 1.0.0
* @since 2024/6/24 15:01
*/
@Component
public class AppAutoClearConfig {

/**
* 是否开启自动清理命令记录
*/
private final ConfigRef<Boolean> execLogEnabled;

/**
* 自动清理命令记录保留天数
*/
private final ConfigRef<Integer> execLogKeepDays;

/**
* 是否开启自动清理终端连接记录
*/
private final ConfigRef<Boolean> terminalLogEnabled;

/**
* 自动清理终端连接记录保留天数
*/
private final ConfigRef<Integer> terminalLogKeepDays;

public AppAutoClearConfig(ConfigStore configStore) {
this.execLogEnabled = configStore.bool(ConfigKeys.AUTO_CLEAR_EXEC_LOG_ENABLED);
this.execLogKeepDays = configStore.int32(ConfigKeys.AUTO_CLEAR_EXEC_LOG_KEEP_DAYS);
this.terminalLogEnabled = configStore.bool(ConfigKeys.AUTO_CLEAR_TERMINAL_LOG_ENABLED);
this.terminalLogKeepDays = configStore.int32(ConfigKeys.AUTO_CLEAR_TERMINAL_LOG_KEEP_DAYS);
}

public Boolean getExecLogEnabled() {
return execLogEnabled.value;
}

public Integer getExecLogKeepDays() {
return execLogKeepDays.value;
}

public Boolean getTerminalLogEnabled() {
return terminalLogEnabled.value;
}

public Integer getTerminalLogKeepDays() {
return terminalLogKeepDays.value;
}

}
Loading