Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

订阅源联系隐私© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
spring-cloud__spring-cloud-config_CVE-2020-5410_2-1-8-RELEASE — 集中配置服务器,用于分布式系统,支持HTTP API、Git存储后端、属性加密/解密,并与Vault、JDBC和本地文件系统集成。 | Kitploit
工具/GitHubGitHub/shoucheng3/spring-cloud__spring-cloud-config_cve-2020-5410_2-1-8-release
身份验证与授权加密/解密工具配置审计云安全DevSecOpsAPI 安全
GitHubshoucheng3/spring-cloud__spring-cloud-config_cve-2020-5410_2-1-8-release

spring-cloud__spring-cloud-config_CVE-2020-5410_2-1-8-RELEASE

集中配置服务器,用于分布式系统,支持HTTP API、Git存储后端、属性加密/解密,并与Vault、JDBC和本地文件系统集成。

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
查看仓库
381年前尚未审核

//// 请勿编辑此文件。它是自动生成的。 对此文件的手动更改将在重新生成时丢失。 请改为编辑 src/main/asciidoc/ 目录下的文件。 ////

image::https://circleci.com/gh/spring-cloud/spring-cloud-config/tree/master.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-config/tree/master"] image::https://codecov.io/gh/spring-cloud/spring-cloud-config/branch/master/graph/badge.svg["Codecov", link="https://codecov.io/gh/spring-cloud/spring-cloud-config/branch/master"] image::https://api.codacy.com/project/badge/Grade/f064024a072c477e97dca6ed5a70fccd?branch=master["Codacy code quality", link="https://www.codacy.com/app/Spring-Cloud/spring-cloud-config?branch=master&utm_source=github.com&utm_medium=referral&utm_content=spring-cloud/spring-cloud-config&utm_campaign=Badge_Grade"]

Spring Cloud Config 为分布式系统中的外部化配置提供了服务端和客户端支持。通过配置服务器,您可以集中管理所有环境中应用程序的外部属性。 客户端和服务端的概念与 Spring 的 Environment 和 PropertySource 抽象完全一致,因此它们非常适合 Spring 应用程序,也可以与任何语言运行的任何应用程序一起使用。 当应用程序通过部署管道从开发环境到测试环境再到生产环境时,您可以管理这些环境之间的配置,并确保应用程序在迁移时拥有运行所需的一切。 服务器存储后端的默认实现使用 git,因此它轻松支持配置环境的带标签版本,并且可以被广泛的内容管理工具访问。 添加替代实现并利用 Spring 配置将它们集成起来非常容易。

== 特性

=== Spring Cloud Config 服务端

Spring Cloud Config 服务端提供以下优势:

  • 基于 HTTP 资源的外部配置 API(键值对或等效的 YAML 内容)
  • 加密和解密属性值(对称或非对称)
  • 可通过 @EnableConfigServer 轻松嵌入 Spring Boot 应用程序

=== Spring Cloud Config 客户端

特别针对 Spring 应用程序,Spring Cloud Config 客户端让您能够:

  • 绑定到配置服务器并使用远程属性源初始化 Spring Environment。
  • 加密和解密属性值(对称或非对称)。
  • 为希望在配置更改时重新初始化的 Spring @Beans 提供 @RefreshScope。
  • 使用管理端点: ** /env 用于更新 Environment 并重新绑定 @ConfigurationProperties 和日志级别。 ** /refresh 用于刷新 @RefreshScope 的 bean。 ** /restart 用于重启 Spring 上下文(默认禁用)。 ** /pause 和 /resume 用于调用 Lifecycle 方法(在 ApplicationContext 上调用 stop() 和 start())。
  • 引导应用程序上下文:主应用程序的父上下文,可以训练其执行任何操作(默认情况下,它绑定到配置服务器并解密属性值)。

== 快速开始

本快速入门将逐步介绍如何使用 Spring Cloud Config 的服务端和客户端。

首先,启动服务端,如下所示:


$ cd spring-cloud-config-server $ ../mvnw spring-boot:run

服务端是一个 Spring Boot 应用程序,因此您也可以从 IDE 运行它(主类是 ConfigServerApplication)。

接下来尝试客户端,如下所示:


$ curl localhost:8888/foo/development {"name":"foo","label":"master","propertySources":[ {"name":"https://github.com/scratches/config-repo/foo-development.properties","source":{"bar":"spam"}}, {"name":"https://github.com/scratches/config-repo/foo.properties","source":{"foo":"bar"}} ]}

定位属性源的默认策略是克隆一个 git 仓库(位于 spring.cloud.config.server.git.uri)并使用它来初始化一个迷你 SpringApplication。 迷你应用程序的 Environment 用于枚举属性源并通过 JSON 端点发布它们。

HTTP 服务具有以下形式的资源:


/{application}/{profile}[/{label}] /{application}-{profile}.yml /{label}/{application}-{profile}.yml /{application}-{profile}.properties /{label}/{application}-{profile}.properties

其中 application 被注入为 SpringApplication 中的 spring.config.name(通常是一个标准 Spring Boot 应用程序中的 application),profile 是一个激活的 profile(或以逗号分隔的属性列表),label 是一个可选的 git 标签(默认为 master)。

Spring Cloud Config 服务端从各种来源为远程客户端拉取配置。以下示例从 git 仓库(必须提供)获取配置,如下所示:

[source,yaml]

spring: cloud: config: server: git: uri: https://github.com/spring-cloud-samples/config-repo

其他来源包括任何兼容 JDBC 的数据库、Subversion、Hashicorp Vault、Credhub 和本地文件系统。

=== 客户端使用

要在应用程序中使用这些功能,您可以将其构建为一个依赖 spring-cloud-config-client 的 Spring Boot 应用程序(例如,请参见 config-client 的测试用例或示例应用程序)。 添加依赖的最便捷方式是使用 Spring Boot starter org.springframework.cloud:spring-cloud-starter-config。 此外,还有为 Maven 用户提供的父 pom 和 BOM(spring-cloud-starter-parent),以及为 Gradle 和 Spring CLI 用户提供的 Spring IO 版本管理属性文件。以下示例展示了一个典型的 Maven 配置:

[source,xml,indent=0] .pom.xml

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>{spring-boot-docs-version}</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-dependencies</artifactId>
			<version>{spring-cloud-version}</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

<dependencies>
	<dependency>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-starter-config</artifactId>
	</dependency>
	<dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-test</artifactId>
		<scope>test</scope>
	</dependency>
</dependencies>

<build>
	<plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
	</plugins>
</build>

<!-- repositories also needed for snapshots and milestones -->

现在您可以创建一个标准的 Spring Boot 应用程序,例如以下 HTTP 服务器:


@SpringBootApplication @RestController public class Application {

@RequestMapping("/")
public String home() {
    return "Hello World!";
}

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

}

当此 HTTP 服务器运行时,它会从默认的本地配置服务器(如果正在运行)在端口 8888 上拾取外部配置。 要修改启动行为,您可以使用 bootstrap.properties(类似于 application.properties,但用于应用程序上下文的引导阶段)更改配置服务器的位置,如下所示:


spring.cloud.config.uri: http://myconfigserver.com

默认情况下,如果未设置应用程序名称,将使用 application。要修改名称,可以将以下属性添加到 bootstrap.properties 文件中:


spring.application.name: myapp

注意:设置属性 ${spring.application.name} 时,不要使用保留字 application- 作为应用程序名称的前缀,以防止在解析正确的属性源时出现问题。

引导属性会在 /env 端点中以高优先级属性源的形式显示,如下例所示。


$ curl localhost:8080/env { "profiles":[], "configService:https://github.com/spring-cloud-samples/config-repo/bar.properties":{"foo":"bar"}, "servletContextInitParams":{}, "systemProperties":{...}, ... }

名为 ```configService:<远程仓库 URL>/<文件名>的属性源包含foo属性,其值为bar`,并且具有最高优先级。

注意:属性源名称中的 URL 是 git 仓库,而不是配置服务器 URL。

=== 示例应用程序

您可以在此处找到示例应用程序:https://github.com/spring-cloud/spring-cloud-config/tree/master/spring-cloud-config-sample[here]。 它是一个 Spring Boot 应用程序,因此您可以使用通常的机制(例如 mvn spring-boot:run)运行它。 运行时,它会在 http://localhost:8888(可配置的默认值)上查找配置服务器,因此您也可以运行服务器以查看它们如何协同工作。

该示例有一个测试用例,其中配置服务器也在同一个 JVM(使用不同端口)中启动,并且测试断言 git 配置仓库中的环境属性存在。 要更改配置服务器的位置,您可以在 bootstrap.yml(或系统属性和其他位置)中设置 spring.cloud.config.uri。

测试用例有一个 main() 方法,它以相同的方式运行服务器(查看日志以获取其端口),因此您可以在一个进程中运行整个系统并进行实验(例如,您可以在 IDE 中运行 main() 方法)。 main() 方法使用 target/config 作为 git 仓库的工作目录,因此您可以在那里进行本地更改,并看到它们反映在正在运行的应用程序中。以下示例展示了使用测试用例进行实验的过程:


$ curl localhost:8080/env/sample mytest $ vi target/config/mytest.properties .. change value of "sample", optionally commit $ curl localhost:8080/refresh ["sample"] $ curl localhost:8080/env/sample sampleValue

刷新端点报告 "sample" 属性已更改。

== 构建

:jdkversion: 1.7

=== 基本编译和测试

要构建源代码,您需要安装 JDK {jdkversion}。

Spring Cloud 使用 Maven 进行大多数与构建相关的活动,您应该能够通过克隆您感兴趣的项目并输入以下命令快速上手:


$ ./mvnw install

注意:您也可以自行安装 Maven(>=3.3.3)并在下面的示例中使用 mvn 命令代替 ./mvnw。如果这样做,并且您的本地 Maven 设置不包含用于 Spring 预发布工件的仓库声明,您可能还需要添加 -P spring。

注意:请注意,您可能需要通过设置 MAVEN_OPTS 环境变量(值如 -Xmx512m -XX:MaxPermSize=128m)来增加 Maven 可用的内存量。我们尝试在 .mvn 配置中涵盖这一点,因此如果您发现需要这样做才能成功构建,请提交工单以将该设置添加到源代码控制中。

有关如何构建项目的提示,请查看 .travis.yml(如果有)。应该有一个 "script" 命令,可能还有一个 "install" 命令。还要查看 "services" 部分,看看是否有任何服务需要在本地运行(例如 mongo 或 rabbit)。忽略 "before_install" 中可能与 git 相关的部分,因为它们与设置 git 凭据有关,而您已经拥有这些凭据。

需要中间件的项目通常包含一个 docker-compose.yml,因此请考虑使用 https://docs.docker.com/compose/[Docker Compose] 在 Docker 容器中运行中间件服务器。请参阅 https://github.com/spring-cloud-samples/scripts[scripts 示例仓库] 中的 README 以获取有关常见情况(如 mongo、rabbit 和 redis)的特定说明。

注意:如果所有其他方法都失败,请使用 .travis.yml 中的命令进行构建(通常是 ./mvnw install)。

=== 文档

spring-cloud-build 模块有一个 "docs" profile,如果启用它,它将尝试从 src/main/asciidoc 构建 asciidoc 源。在此过程中,它将查找 README.adoc 并通过加载所有包含文件来处理它,但不会解析或渲染它,只是将其复制到 ${main.basedir}(默认为 ${basedir},即项目的根目录)。如果 README 有任何更改,在 Maven 构建后,它将作为正确位置的已修改文件显示出来。只需提交并推送更改即可。

下载工具