Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b207c5d253 | ||
|
|
5335a8d008 | ||
|
|
1e74659f15 | ||
|
|
58a1a7abd4 | ||
|
|
6c125a1c0d |
@@ -7,7 +7,7 @@ DEMO_MODE=false
|
||||
|
||||
API_CORS=true
|
||||
API_HOST=0.0.0.0
|
||||
# API_URL=http://127.0.0.1:9700/orion-visor/api
|
||||
# API_URL=http://127.0.0.1:9200/orion-visor/api
|
||||
API_IP_HEADERS=X-Forwarded-For,X-Real-IP
|
||||
API_EXPOSE_TOKEN=pmqeHOyZaumHm0Wt
|
||||
SECRET_KEY=uQeacXV8b3isvKLK
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
</a>
|
||||
<a target="_blank"
|
||||
style="text-decoration: none !important;"
|
||||
href="https://gitcode.com/dromara/orion-visor">
|
||||
<img src="https://gitcode.com/dromara/orion-visor/star/badge.svg" alt="star"/>
|
||||
href="https://atomgit.com/dromara/orion-visor">
|
||||
<img src="https://atomgit.com/dromara/orion-visor/star/2025top.svg" alt="star" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
* 🔗 演示地址: [https://dv.orionsec.cn/](https://dv.orionsec.cn/)
|
||||
* 🔏 演示账号: admin/admin
|
||||
* ⭐ 体验后可以点一下 `star`
|
||||
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [gitcode](https://gitcode.com/dromara/orion-visor)
|
||||
这对我很重要! [github](https://github.com/dromara/orion-visor) [gitee](https://gitee.com/dromara/orion-visor) [atomgit](https://atomgit.com/dromara/orion-visor)
|
||||
* 🌈 如果本项目对你有帮助请帮忙推广一下 让更多的人知道此项目!
|
||||
* 🎭 演示环境部分功能不可用, 完整功能请本地部署!
|
||||
|
||||
@@ -171,6 +171,6 @@ QQ群: 755242157
|
||||
|
||||

|
||||
|
||||
## GitCode 最有影响力的开源项目 G-Star
|
||||
## AtomGit 最有影响力的开源项目 G-Star
|
||||
|
||||

|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
version: '3.3'
|
||||
|
||||
# latest = 2.5.6
|
||||
|
||||
# 支持以下源
|
||||
@@ -50,7 +48,10 @@ services:
|
||||
SECRET_KEY: ${SECRET_KEY:-uQeacXV8b3isvKLK}
|
||||
API_EXPOSE_TOKEN: ${API_EXPOSE_TOKEN:-pmqeHOyZaumHm0Wt}
|
||||
API_IP_HEADERS: ${API_IP_HEADERS:-X-Forwarded-For,X-Real-IP}
|
||||
# 这里需要改为具体的服务地址 (宿主机ip)
|
||||
API_HOST: ${API_HOST:-0.0.0.0}
|
||||
# 若 API_HOST 不满足, 可以修改这里 http://<ip>:<port>/orion-visor/api
|
||||
API_URL: ${API_URL:-}
|
||||
API_CORS: ${API_CORS:-true}
|
||||
DEMO_MODE: ${DEMO_MODE:-false}
|
||||
volumes:
|
||||
|
||||
@@ -140,7 +140,7 @@ function modify_dockerfiles() {
|
||||
if [ -f "$file" ]; then
|
||||
echo "备份并修改: $file"
|
||||
cp "$file" "$file$backup_suffix"
|
||||
sed -i 's/--platform=\TARGETPLATFORM//g' "$file"
|
||||
sed -i "s/--platform=\$TARGETPLATFORM//g" "$file"
|
||||
else
|
||||
echo "文件不存在 -> $file"
|
||||
fi
|
||||
@@ -189,7 +189,7 @@ function push_image_to_registry() {
|
||||
# 推送版本
|
||||
docker push "${namespace}/${image_name}:${version}"
|
||||
# 推送 latest
|
||||
if [ "latest_image" = true ]; then
|
||||
if [ "$latest_image" = true ]; then
|
||||
docker push "${namespace}/${image_name}:latest"
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机探针端点 api
|
||||
@@ -90,9 +91,8 @@ public class HostAgentController {
|
||||
@PostMapping("/install")
|
||||
@Operation(summary = "安装主机探针")
|
||||
@PreAuthorize("@ss.hasPermission('asset:host:install-agent')")
|
||||
public Boolean installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
|
||||
hostAgentService.installAgent(request);
|
||||
return true;
|
||||
public Map<String, Long> installAgent(@Validated @RequestBody HostAgentInstallRequest request) {
|
||||
return hostAgentService.installAgent(request);
|
||||
}
|
||||
|
||||
@DemoDisableApi
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.dromara.visor.module.asset.entity.vo.HostAgentStatusVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 主机探针 服务类
|
||||
@@ -49,8 +50,9 @@ public interface HostAgentService {
|
||||
* 安装探针
|
||||
*
|
||||
* @param request request
|
||||
* @return agentKey:installId
|
||||
*/
|
||||
void installAgent(HostAgentInstallRequest request);
|
||||
Map<String, Long> installAgent(HostAgentInstallRequest request);
|
||||
|
||||
/**
|
||||
* 上传探针发布包
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
package org.dromara.visor.module.asset.service.impl;
|
||||
|
||||
import cn.orionsec.kit.lang.function.Functions;
|
||||
import cn.orionsec.kit.lang.utils.Exceptions;
|
||||
import cn.orionsec.kit.lang.utils.Strings;
|
||||
import cn.orionsec.kit.lang.utils.collect.Lists;
|
||||
@@ -133,7 +134,7 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void installAgent(HostAgentInstallRequest request) {
|
||||
public Map<String, Long> installAgent(HostAgentInstallRequest request) {
|
||||
// 查询主机信息
|
||||
List<Long> idList = request.getIdList();
|
||||
List<HostDO> hosts = hostDAO.selectBatchIds(idList);
|
||||
@@ -181,6 +182,12 @@ public class HostAgentServiceImpl implements HostAgentService {
|
||||
// 执行任务
|
||||
AgentInstaller.start(params);
|
||||
}
|
||||
|
||||
// 返回
|
||||
return agentLogs.stream()
|
||||
.collect(Collectors.toMap(HostAgentLogDO::getAgentKey,
|
||||
HostAgentLogDO::getId,
|
||||
Functions.right()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface HostAgentInstallStatusUpdateRequest {
|
||||
* 安装主机探针
|
||||
*/
|
||||
export function installHostAgent(request: HostInstallAgentRequest) {
|
||||
return axios.post('/asset/host-agent/install', request);
|
||||
return axios.post<Record<string, number>>('/asset/host-agent/install', request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -405,7 +405,6 @@
|
||||
} = useMonitorHostList({
|
||||
hosts: renderList,
|
||||
setLoading,
|
||||
reload,
|
||||
});
|
||||
|
||||
// 重置条件
|
||||
|
||||
@@ -456,7 +456,6 @@
|
||||
} = useMonitorHostList({
|
||||
hosts: tableRenderData,
|
||||
setLoading,
|
||||
reload,
|
||||
});
|
||||
|
||||
// 获取行样式
|
||||
|
||||
@@ -16,8 +16,6 @@ export interface UseMonitorHostListOptions {
|
||||
hosts: Ref<Array<MonitorHostQueryResponse>>;
|
||||
// 设置加载中
|
||||
setLoading: (loading: boolean) => void;
|
||||
// 重新加载
|
||||
reload: () => void;
|
||||
}
|
||||
|
||||
// 使用监控主机列表
|
||||
@@ -29,7 +27,7 @@ export default function useMonitorHostList(options: UseMonitorHostListOptions) {
|
||||
|
||||
const router = useRouter();
|
||||
const { toggleDict } = useDictStore();
|
||||
const { hosts, setLoading, reload } = options;
|
||||
const { hosts, setLoading } = options;
|
||||
|
||||
// 打开详情
|
||||
const openDetail = (hostId: number, name: string) => {
|
||||
@@ -65,10 +63,18 @@ export default function useMonitorHostList(options: UseMonitorHostListOptions) {
|
||||
onOk: async () => {
|
||||
try {
|
||||
// 调用安装
|
||||
await installHostAgent({ idList: hostIdList });
|
||||
const { data } = await installHostAgent({ idList: hostIdList });
|
||||
Message.success('开始安装');
|
||||
// 重新加载
|
||||
reload();
|
||||
// 设置状态
|
||||
installHosts.forEach(host => {
|
||||
const installId = data[host.agentKey];
|
||||
if (installId) {
|
||||
host.installLog = {
|
||||
id: installId,
|
||||
eventStatus: AgentLogStatus.WAIT,
|
||||
} as any;
|
||||
}
|
||||
});
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user