当前位置: 首页 > wzjs >正文

哈尔滨网站建设制作哪家便宜网站后台管理系统论文

哈尔滨网站建设制作哪家便宜,网站后台管理系统论文,做软件常用的网站有哪些软件有哪些,软文营销广告案例前言 我们被扫了一个漏洞,SpringBoot Actuator 未授权访问,漏洞描述是这样的: Actuator 是 springboot 提供的用来对应用系统进行自省和监控的功能模块,借助于 Actuator 开发者可以很方便地对应用系统某些监控指标进行查看、统计…

前言

我们被扫了一个漏洞,SpringBoot Actuator 未授权访问,漏洞描述是这样的:
Actuator 是 springboot 提供的用来对应用系统进行自省和监控的功能模块,借助于 Actuator 开发者可以很方便地对应用系统某些监控指标进行查看、统计等。在 Actuator 启用的情况下,如果没有做好相关权限控制,非法用户可通过访问默认的执行器端点(endpoints)来获取应用系统中的监控信息,从而导致信息泄露甚至服务器被接管的事件发生

正文

如果没有对admin的端点进行鉴权,那么对于开放的网关服务,可以直接通过xx/actuator访问,这将是非常危险的,如果你还暴露了所有端点,那么还可以获取环境中的账号密码信息,即使admin做了脱敏。
要对端点进行鉴权,也非常简单,只需要要引入spring-security依赖即可,下面是Spring Cloud Gateway中的配置。

1、引入xml依赖
spring-boot-starter-web scope 是provided,引入gateway中不能有web

 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-security</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><scope>provided</scope></dependency>

2、针对Admin端点认证的配置,只对/actuator/**进行认证,其他地址放行,使用业务自身认证。

package com.frame.ops.admin.client.config;import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;/*** 对客户端的actuator接口进行鉴权* 引入后,gateway 有性能问题*/
@EnableWebFluxSecurity
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
public class ReactiveAdminSecurityConfig {@Bean@Order(1)public SecurityWebFilterChain authorizationServerSecurityFilterChain(ServerHttpSecurity http) {http.authorizeExchange()//只对actuator接口认证.pathMatchers("/actuator/**").authenticated().anyExchange().permitAll().and().httpBasic().and().csrf().disable();return http.build();}}

3、如果是Servlet,配置为

package com.frame.ops.admin.client.config;import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.util.StringUtils;import java.util.List;
import java.util.regex.Pattern;/*** 对客户端的actuator接口进行鉴权*/
@Order(1)
@EnableWebSecurity
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class AdminSecurityConfig extends WebSecurityConfigurerAdapter {//这个InMemoryUserDetailsManager,如果你的业务中也使用了spring security,那么需要自定义一   //个,防止admin认证使用自定义的处理逻辑@Autowiredprivate InMemoryUserDetailsManager inMemoryUserDetailsManager;private static final String NOOP_PASSWORD_PREFIX = "{noop}";private static final Pattern PASSWORD_ALGORITHM_PATTERN = Pattern.compile("^\\{.+}.*$");private static final Log logger = LogFactory.getLog(AdminSecurityConfig.class);@Overrideprotected void configure(AuthenticationManagerBuilder auth) throws Exception {auth.userDetailsService(inMemoryUserDetailsManager);}@Beanpublic InMemoryUserDetailsManager inMemoryUserDetailsManager(SecurityProperties properties,ObjectProvider<PasswordEncoder> passwordEncoder) {SecurityProperties.User user = properties.getUser();List<String> roles = user.getRoles();return new InMemoryUserDetailsManager(User.withUsername(user.getName()).password(getOrDeducePassword(user, passwordEncoder.getIfAvailable())).roles(StringUtils.toStringArray(roles)).build());}private String getOrDeducePassword(SecurityProperties.User user, PasswordEncoder encoder) {String password = user.getPassword();if (user.isPasswordGenerated()) {logger.warn(String.format("%n%nUsing generated security password: %s%n%nThis generated password is for development use only. "+ "Your security configuration must be updated before running your application in "+ "production.%n",user.getPassword()));}if (encoder != null || PASSWORD_ALGORITHM_PATTERN.matcher(password).matches()) {return password;}return NOOP_PASSWORD_PREFIX + password;}@Overrideprotected void configure(HttpSecurity http) throws Exception {http.csrf().disable().authorizeRequests()//只有actuator开头的请求才需要认证.antMatchers("/actuator/**").authenticated().anyRequest().permitAll().and().httpBasic();}}

总结

⁉️ 奇怪的事来了,在本地测试gateway 请求正常,访问/actuator端点需要认证,但是在服务器上测试一些业务接口就会卡住超时,请求也没到下游服务,过段时间后gateway 假死,任何请求不通。

这个问题只发生在gateway中,对应servlet并没有发现这个问题,不清楚跟Gateway 使用Reactive 有没有关系, 这个问题暂未解决。但也不影响处理漏洞,只要去掉admin依赖,actuator依赖就行了。


作者其他要推荐的文章,欢迎来学习:
Prometheus 系列文章

  1. Prometheus 的介绍和安装
  2. 直观感受PromQL及其数据类型
  3. PromQL之选择器和运算符
  4. PromQL之函数
  5. Prometheus 告警机制介绍及命令解读
  6. Prometheus 告警模块配置深度解析
  7. Prometheus 配置身份认证
  8. Prometheus 动态拉取监控服务
  9. Prometheus 监控云Mysql和自建Mysql

Grafana 系列文章,版本:OOS v9.3.1

  1. Grafana 的介绍和安装
  2. Grafana监控大屏配置参数介绍(一)
  3. Grafana监控大屏配置参数介绍(二)
  4. Grafana监控大屏可视化图表
  5. Grafana 查询数据和转换数据
  6. Grafana 告警模块介绍
  7. Grafana 告警接入飞书通知


文章转载自:

http://he0K3QzP.tthmg.cn
http://ZJdLTDNU.tthmg.cn
http://9OjzYYnL.tthmg.cn
http://3Mm0M1Bd.tthmg.cn
http://2YrSdqiA.tthmg.cn
http://7eWScppH.tthmg.cn
http://c40y3ynN.tthmg.cn
http://Xi0KObFN.tthmg.cn
http://vxpsnTlJ.tthmg.cn
http://Owgv7VLA.tthmg.cn
http://6mI2OJIE.tthmg.cn
http://IuJUJ3ua.tthmg.cn
http://Dp3rljFE.tthmg.cn
http://uHK9GuzD.tthmg.cn
http://SrBIVLWi.tthmg.cn
http://bTQFHZfS.tthmg.cn
http://lJ7UEFPj.tthmg.cn
http://UuI71uh2.tthmg.cn
http://PKG5hEaW.tthmg.cn
http://1aiiX1o0.tthmg.cn
http://WLw3CD1Q.tthmg.cn
http://emm54rwY.tthmg.cn
http://eDJ3qVny.tthmg.cn
http://QX0KHRWo.tthmg.cn
http://LjqW24CJ.tthmg.cn
http://zuMiPaLM.tthmg.cn
http://9AZYwEqV.tthmg.cn
http://7S78Mu8v.tthmg.cn
http://sKmcwBQv.tthmg.cn
http://SSVq3G9O.tthmg.cn
http://www.dtcms.com/wzjs/725665.html

相关文章:

  • 信金在线制作网站网站制作营销型
  • 公司网站建设方案书例文高端玩家
  • 江苏高效网站制作公司安徽网站建设科技
  • Django可以做门户网站吗如果管理多个wordpress
  • 现在有哪些网站兼职可以做软件培训班
  • 15年做哪个网站能致富网站建设与
  • 福建建设厅网站网站建设 教学设计
  • 网站开发流程及顺序网站建设的主要技术指什么软件
  • 自助建站系统哪个好国外做问卷调查的网站
  • 建行官网个人银行seo方案
  • 做暑假工的网站wordpress如何cdn优化
  • 保险网站模板网站制作一般多少钱
  • 淘宝客网站管理网站做外链怎么样
  • 长沙com建站网站设计微信小程序在哪里找出来
  • 护肤品网站建设的意义自建网站有哪些
  • 菏泽网站建设兼职陕西一建考试最新消息
  • 站长之家商城it运维服务管理体系
  • 手机网站建设代码潜江市住房城乡建设厅网站
  • google收录网站网络服务推广
  • 浮梁网站推广关键词优化推广公司排名
  • 网上接做网站的单子天元建设集团有限公司设计研究院征求意见
  • 建设手机网站包括哪些费用拼多多网店怎么开
  • 建设网站用什么语言比较好珠海免费网站制作
  • 贺兰县住房和城乡建设局网站国外社交网站做的比较好的是
  • 360建设网站免费百度seo优化服务
  • 直播平台软件开发长春seo建站
  • 网站做互动临沂网站开发技术员
  • 网站开发税收分类搜索引擎排名优化方案
  • 百度速页建站企业网站策划应该怎么做
  • 网站建设中单页源码企业门户网站建设方案及报价