Istio零信任安全架构设计

news2024/10/6 0:30:41

主要分为几个模块

  1. 安装
  2. 安全概念
  3. 整体安全架构
  4. 源码

1.安装istio (windows环境)

  1. windows安装Rancher的步骤 : https://docs.rancherdesktop.io/getting-started/installation,

    docker desktop开始面向中大型企业收费: https://baijiahao.baidu.com/s?id=1709665495660071676&wfr=spider&for=pc

    rancher desktop是一个开源项目 :

    官网:https://rancherdesktop.io/

    github代码: https://github.com/rancher-sandbox/rancher-desktop

  2. 下载window版本的istio:istio-1.12.6-win.zip

  3. 解压后进入安装istio的bin目录下

  4. 验证istio的版本

$ ./istioctl.exe version
client version: 1.12.6
control plane version: 1.12.6
data plane version: 1.12.6 (2 proxies)
  1. 执行安装命令
$ ./istioctl.exe manifest apply --set profile=demo
 This will install the Istio 1.12.6 demo profile with ["Istio core" "Istiod" "Ingress gateways" "Egress gateways"] components into the cluster. Proceed? (y/N) y
 ✔ Istio core installed
 ✔ Istiod installed
 ✔ Ingress gateways installed
 ✔ Egress gateways installed
 ✔ Installation complete                                                                                                                                                                                           
 Making this installation the default for injection and validation.

 Thank you for installing Istio 1.12.  Please take a few minutes to tell us about your install/upgrade experience!  https://forms.gle/FegQbc9UvePd4Z9z7
  1. 创建demo namespace
$ kubectl create ns demo
namespace/demo created
  1. 将Istio注入namespace
$ kubectl label namespace demo istio-injection=enabled
namespace/demo labeled
  1. 查看istio的pod

windows版本的没有安装kiali和prometheus, 猜测可能没有支持

$ kubectl get pods -n istio-system
NAME                                    READY   STATUS    RESTARTS   AGE
istiod-f97b6b446-jmwx8                  1/1     Running   0          17m
svclb-istio-ingressgateway-plw4t        0/5     Pending   0          16m  
istio-egressgateway-6976f7c4bb-xjgsn    1/1     Running   0          16m
istio-ingressgateway-678984b8f6-j7skh   1/1     Running   0          16m
  1. 验证istio是否安装成功 (验证成功了)
$ ./istioctl.exe verify-install -f ../manifests/profiles/demo.yaml
✔ Deployment: istio-ingressgateway.istio-system checked successfully
✔ PodDisruptionBudget: istio-ingressgateway.istio-system checked successfully
✔ Role: istio-ingressgateway-sds.istio-system checked successfully
✔ RoleBinding: istio-ingressgateway-sds.istio-system checked successfully
✔ Service: istio-ingressgateway.istio-system checked successfully
✔ ServiceAccount: istio-ingressgateway-service-account.istio-system checked successfully
✔ Deployment: istio-egressgateway.istio-system checked successfully
✔ PodDisruptionBudget: istio-egressgateway.istio-system checked successfully
✔ Role: istio-egressgateway-sds.istio-system checked successfully
✔ RoleBinding: istio-egressgateway-sds.istio-system checked successfully
✔ Service: istio-egressgateway.istio-system checked successfully
✔ ServiceAccount: istio-egressgateway-service-account.istio-system checked successfully
✔ ClusterRole: istiod-istio-system.istio-system checked successfully
✔ ClusterRole: istio-reader-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istio-reader-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-istio-system.istio-system checked successfully
✔ ServiceAccount: istio-reader-service-account.istio-system checked successfully
✔ Role: istiod-istio-system.istio-system checked successfully
✔ RoleBinding: istiod-istio-system.istio-system checked successfully
✔ ServiceAccount: istiod-service-account.istio-system checked successfully
✔ CustomResourceDefinition: wasmplugins.extensions.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: destinationrules.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: envoyfilters.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: gateways.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: serviceentries.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: sidecars.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: virtualservices.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: workloadentries.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: workloadgroups.networking.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: authorizationpolicies.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: peerauthentications.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: requestauthentications.security.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: telemetries.telemetry.istio.io.istio-system checked successfully
✔ CustomResourceDefinition: istiooperators.install.istio.io.istio-system checked successfully
✔ ClusterRole: istiod-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRole: istiod-gateway-controller-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istiod-gateway-controller-istio-system.istio-system checked successfully
✔ ConfigMap: istio.istio-system checked successfully
✔ Deployment: istiod.istio-system checked successfully
✔ ConfigMap: istio-sidecar-injector.istio-system checked successfully
✔ MutatingWebhookConfiguration: istio-sidecar-injector.istio-system checked successfully
✔ PodDisruptionBudget: istiod.istio-system checked successfully
✔ ClusterRole: istio-reader-clusterrole-istio-system.istio-system checked successfully
✔ ClusterRoleBinding: istio-reader-clusterrole-istio-system.istio-system checked successfully
✔ Role: istiod.istio-system checked successfully
✔ RoleBinding: istiod.istio-system checked successfully
✔ Service: istiod.istio-system checked successfully
✔ ServiceAccount: istiod.istio-system checked successfully
✔ EnvoyFilter: stats-filter-1.10.istio-system checked successfully
✔ EnvoyFilter: tcp-stats-filter-1.10.istio-system checked successfully
✔ EnvoyFilter: stats-filter-1.11.istio-system checked successfully
✔ EnvoyFilter: tcp-stats-filter-1.11.istio-system checked successfully
✔ EnvoyFilter: stats-filter-1.12.istio-system checked successfully
✔ EnvoyFilter: tcp-stats-filter-1.12.istio-system checked successfully
✔ ValidatingWebhookConfiguration: istio-validator-istio-system.istio-system checked successfully
✔ IstioOperator: .istio-system checked successfully
Checked 14 custom resource definitions
Checked 3 Istio Deployments
✔ Istio is installed and verified successfully
  1. 给命名空间添加标签,指示 Istio 在部署应用的时候,自动的注入 Envoy 边车代理
$ kubectl label namespace demo istio-injection=enabled
namespace/demo labeled
  1. 部署bookinfo服务 : https://istio.io/latest/docs/examples/bookinfo/
$ kubectl apply -f ../samples/bookinfo/platform/kube/bookinfo.yaml -n demo
service/details created
serviceaccount/bookinfo-details created
deployment.apps/details-v1 created
service/ratings created
serviceaccount/bookinfo-ratings created
deployment.apps/ratings-v1 created
service/reviews created
serviceaccount/bookinfo-reviews created
deployment.apps/reviews-v1 created
deployment.apps/reviews-v2 created
deployment.apps/reviews-v3 created
service/productpage created
serviceaccount/bookinfo-productpage created
deployment.apps/productpage-v1 created
  1. 部署gateway
$ kubectl apply -f ../samples/bookinfo/networking/bookinfo-gateway.yaml -n demo
gateway.networking.istio.io/bookinfo-gateway created
virtualservice.networking.istio.io/bookinfo created
  1. 访问链接,验证是否安装成功

http://localhost/productpage

  1. 工具可以分析错误

问题1:

$ ./istioctl.exe analyze
Error [IST0101] (VirtualService default/bookinfo) Referenced host not found: "productpage"
Error [IST0145] (Gateway default/bookinfo-gateway) Conflict with gateways demo/bookinfo-gateway (workload selector istio=ingressgateway, port 80, hosts *).
Error: Analyzers found issues when analyzing namespace: default.
See https://istio.io/v1.12/docs/reference/config/analysis for more information about causes and resolutions.

错误码对应的原因:https://istio.io/v1.12/docs/reference/config/analysis/

删除重复的CRD:

k8s删除命令:https://blog.csdn.net/lanwp5302/article/details/87470389

$ kubectl get gateway --all-namespaces
NAMESPACE   NAME               AGE
demo        bookinfo-gateway   28m
default     bookinfo-gateway   15m

$ kubectl delete -f ../samples/bookinfo/networking/bookinfo-gateway.yaml -n demo
gateway.networking.istio.io "bookinfo-gateway" deleted
virtualservice.networking.istio.io "bookinfo" deleted

xc.lu@dst74844 MINGW64 /e/ChromeDownload/istio-1.12.6/bin
$ kubectl get gateway --all-namespaces
NAMESPACE   NAME               AGE
demo        bookinfo-gateway   31m

问题2:

$ ./istioctl.exe analyze -n demo
Warning [IST0140] (VirtualService demo/bookinfo) Subset in virtual service demo/productpage has no effect on ingress gateway demo/bookinfo requests

ingressgateway pending问题 :

https://stackoverflow.com/questions/60484080/the-external-ip-of-istio-ingress-gateway-stay-pending

关闭rancher网关 ?

  1. 开启mtls

如果需要启用双向 TLS,请执行以下命令:

$ kubectl apply -f samples/bookinfo/networking/destination-rule-all-mtls.yaml

等待几秒钟,等待目标规则生效,使用以下命令查看目标规则:

$ kubectl get destinationrules -o yaml
apiVersion: v1
items:
- apiVersion: networking.istio.io/v1beta1
  kind: DestinationRule
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"networking.istio.io/v1alpha3","kind":"DestinationRule","metadata":{"annotations":{},"name":"productpage","namespace":"default"},"spec":{"host":"productpage","subsets":[{"labels":{"version":"v1"},"name":"v1"}],"trafficPolicy":{"tls":{"mode":"ISTIO_MUTUAL"}}}}
    creationTimestamp: "2022-05-03T11:59:40Z"
    generation: 1
    name: productpage
    namespace: default
    resourceVersion: "37818"
    uid: 117e2cc4-4f6f-4046-85cc-2db9c955056c
  spec:
    host: productpage
    subsets:
    - labels:
        version: v1
      name: v1
    trafficPolicy:
      tls:
        mode: ISTIO_MUTUAL  (这个代表mtls)
  1. 验证mtls

验证步骤参考:

  • https://ultimatesecurity.pro/post/istio-mtls/
  • https://zhuanlan.zhihu.com/p/290557288
  1. istio排障工具

    有哪些错误码:

    排障工具:

    https://istio.io/latest/docs/tasks/traffic-management/ingress/ingress-control/

    ./istioctl.exe analyze -n demo

    https://istio.io/latest/docs/setup/install/istioctl/

2.安全的概念

what is istio

Simplify observability, traffic management, security, and policy with the leading service mesh.

istio = 流量管理 + 可观测性 + 安全

https://istio.io/

零信任架构 (ZTA)

传统的网络安全架构

  • 基于边界的安全架构,企业构建网络安全体系时,首先寻找安全边界,把网络划分为外网、内网、DMZ( DeMilitarized Zone)区等不同的区域,然后在边界上部署防火墙、入侵检测、WAF等产品。有些还会设置ip白名单。

  • 这种网络安全架构假设或默认了内网比外网更安全,在某种程度上预设了对内网中的人、设备和系统的信任,忽视加强内网安全措施。不法分子一旦突破企业的边界安全防护进入内网,会像进入无人之境,将带来严重的后果。

  • 传统的认证,即信任、边界防护、静态访问控制、以网络为中心。

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-lWy7TWN1-1684323450669)(D:\Users\xc.lu\AppData\Roaming\Typora\typora-user-images\image-20220519192712017.png)]

Zero Trust Architecture

随着云计算、大数据、物联网等新技术与业务的深度融合,网络安全边界也逐渐变得更加模糊,传统边界安全防护理念面临巨大挑战。

零信任即信任度为零,“永远不信任,始终要验证”(Never Trust,Always Verify)。

  • 以身份为中心

不论用户、设备、应用和接口都需要具备唯一的“ID身份”,经过认证、授权后才能通行。就好比在军营出入要出示令牌证件。

  • 最低权限访问

只给用户所需要的最小访问权限。同上,在军营,为防止军机泄露,将军只会让普通士兵掌握最基础的信息。

  • 微隔离单独访问

安全边界被分割成小区域,不同网络部分保持单独访问。比如军营分成多个区域,A区域的士兵如果没有被单独授权,就无法进入其他营区。

ISTIO安全目标

常见安全需求:

  • 为了抵御中间人攻击,需要流量加密。
  • 为了提供灵活的服务访问控制,需要双向 TLS 和细粒度的访问策略。
  • 要确定谁在什么时候做了什么,需要审计工具。

Istio 安全功能提供强大的身份,强大的策略,透明的 TLS 加密,认证,授权和审计工具来保护你的服务和数据。Istio 安全的目标是:

  • 默认安全:应用程序代码和基础设施无需更改
  • 深度防御:与现有安全系统集成以提供多层防御
  • 零信任网络:在不受信任的网络上构建安全解决方案

istio & k8s

K8S

命名空间级别
指定命名空间内的所有(或部分)服务可以被另一命名空间的所有(或部分)服务所访问,需要用户创建ServiceRole、ServiceRoleBinding策略来实现此过程。

服务级别
指定服务可以被另一个服务访问,需要用户创建Service Account、ServiceRole、ServiceRoleBinding策略来实现此过程。

istio

Istio 是独立于平台的,可以与 Kubernetes(或基础设施)的网络策略一起使用。但它更强大,能够在网络和应用层面保护pod到 pod 或者服务到服务之间的通信。

Istio 的安全特性解放了开发人员,使其只需要专注于应用程序级别的安全。Istio 提供了底层的安全通信通道,并为大规模的服务通信管理认证、授权和加密。

CA

CA是Certificate Authority的英文首字母缩写,是证书颁发机构的意思,CA机构是专门负责发放和管理数字证书的权威机构。而CA认证就是为电子签名相关各方提供真实可靠验证的电子认证服务。

证书的内容包括:电子签证机关的信息、公钥用户信息、公钥、权威机构的签字和有效期等等。证书的格式和验证方法普遍遵循X.509 国际标准。

认证&授权

在开发或者管理一个应用程序的时候,我们往往会看到两个名词——认证授权,在英文中,这两个词语更为相近 —— authenticationauthorization。尽管这两个术语经常出现在相同的上下文中,但两者在概念上却有很大差别。
认证,意味着确认用户或使用者的身份,而授权,则意味着授予对系统的访问权限。简单来说,认证是验证用户身份的过程,而授权是验证用户有权访问的过程。

https://istio.io/latest/docs/tasks/security/

3.整体安全架构:

组件

  • Citadel:用于负责密钥和证书的管理,在创建服务时会将密钥及证书下发至对应的Envoy代理中;
  • Pilot:用于接收用户定义的安全策略并将其整理下发至服务旁的Envoy代理中;
  • Envoy:用于存储Citadel下发的密钥和证书,保障服务间的数据传输安全;

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-G4Bbt14X-1684323452140)(null)]

Citadel认证授权过程

  • Kubernetes某集群节点新部署了服务A和服务B,此时集群中有两个Pod被启动,每个Pod由Envoy代理容器和Service容器构成,在启动过程中Istio的Citadel组件会将密钥及证书依次下发至每个Pod中的Envoy代理容器中,以保证后续服务A、B之间的安全通信。
  • 用户通过Rules API下发安全策略至Pilot组件,Pilot组件通过Pilot-discovery进程整理安全策略中Kubernetes服务注册和配置信息并以Envoy API方式暴露给Envoy。
  • Pod A、B中的Envoy代理会通过Envoy xDS API方式定时去Pilot拉取安全策略配置信息,并将信息保存至Envoy代理容器中。
  • 当服务A访问服务B时,会调用各自Envoy容器中的证书及密钥实现服务间的安全通信,同时Envoy容器还会根据用户下发的安全策略进行更细粒度的访问控制。

身份:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nIwVy4gB-1684323451735)(null)]

SDS :

Istio 供应身份是通过 secret discovery service(SDS)来实现的,具体流程如下:

  1. istiod 提供 gRPC 服务以接受证书签名请求(CSRs)。
  2. 当工作负载启动时,Envoy 通过秘密发现服务(SDS)API 向同容器内的 istio-agent 发送证书和密钥请求。
  3. 在收到 SDS 请求后,istio-agent 创建私钥和 CSR,然后将 CSR 及其凭据发送到 istiod CA 进行签名。
  4. istiod CA 验证 CSR 中携带的凭据,成功验证后签署 CSR 以生成证书。
  5. Istio-agent 通过 Envoy SDS API 将私钥和从 Istio CA 收到的证书发送给 Envoy。
  6. Istio-agent 会监工作负载证书的有效期。上述 CSR 过程会周期性地重复,以处理证书和密钥轮换。

mTLS (双向 TLS)

mTLS

当一个工作负载使用双向 TLS 认证向另一个工作负载发送请求时,该请求的处理方式如下:

  1. Istio 将出站流量从客户端重新路由到客户端的本地 sidecar Envoy。

  2. 客户端 Envoy 与服务器端 Envoy 开始双向 TLS 握手。在握手期间,客户端 Envoy 还做了安全命名检查,以验证服务器证书中显示的服务帐户是否被授权运行目标服务。

  3. 客户端 Envoy 和服务器端 Envoy 建立了一个双向的 TLS 连接,Istio 将流量从客户端 Envoy 转发到服务器端 Envoy。

  4. 授权后,服务器端 Envoy 通过本地 TCP 连接将流量转发到服务器服务。

宽容模式(permissive mode)

Istio 双向 TLS 具有一个宽容模式(permissive mode),即不需要授权和认证,允许 service 同时接受纯文本流量和双向 TLS 流量。该功能有利于测试,主要用于非Istio客户端和非 Istio 服务端间的通信,避免因权限而导致无法连接的情况。

举个实际场景,启用宽容模式后,服务同时接受纯文本和双向 TLS 流量。这个模式为入门提供了极大的灵活性。服务中安装的 Istio sidecar 立即接受双向 TLS 流量而不会打断现有的纯文本流量。因此,运维人员可以逐步安装和配置客户端 Istio sidecars 发送双向 TLS 流量。一旦客户端配置完成,运维人员便可以将服务端配置为仅 TLS 模式。

4.源码

SPIFFE

SPIFFE 是 Istio 所采用的安全命名的规范,它也是云原生定义的一种标准化的、可移植的工作负载身份规范。

SPIFFE ID 规定了形如 spiffe://<trust domain>/<workload identifier> 的 URI 格式,作为工作负载(Workload)的唯一标识。

Istio 使用形如 spiffe://<trust_domain>/ns/<namespace>/sa/<service_account> 格式的 SPIFFE ID 作为安全命名,注入到 X.509 证书的 subjectAltName 扩展中。其中“trust domain”参数通过 Istiod 环境变量 TRUST_DOMAIN 注入,用于在多集群环境中交互。

spiffe://cluster.local/ns/<pod namespace>/sa/<pod service account>
type Identity struct {
	TrustDomain    string
	Namespace      string
	ServiceAccount string
}

SDS(秘钥发现服务)

SDS 带来的最大的好处就是简化证书管理。要是没有该功能的话,我们就必须使用 Kubernetes 中的 secret 资源创建证书,然后把证书挂载到代理容器中。如果证书过期,还需要更新 secret 和需要重新部署代理容器。使用 SDS,中央 SDS 服务器将证书推送到所有 Envoy 实例上。如果证书过期,服务器只需将新证书推送到 Envoy 实例,Envoy 可以立即使用新证书而无需重新部署。

Istio:xDS协议解析

SDS server 需要实现 SecretDiscoveryService 这个 gRPC 服务。遵循与其他 xDS 相同的协议。

启动流程:
cmd.go 
	func newDiscoveryCommand()
	
server.go 
	func NewServer(args *PilotArgs, initFuncs ...func(*Server))
	func (s *Server) initSecureDiscoveryService(args *PilotArgs)
	
ads.go
	func (s *DiscoveryServer) Stream(stream DiscoveryStream) error
	func (s *DiscoveryServer) processRequest(req *discovery.DiscoveryRequest, con *Connection) error
	func (s *DiscoveryServer) pushXds(con *Connection, push *model.PushContext,
	w *model.WatchedResource, req *model.PushRequest) error
	
sdsservice.go
	func (s *sdsservice) Generate(_ *model.Proxy, _ *model.PushContext, w *model.WatchedResource,
	updates *model.PushRequest)
	func (s *sdsservice) generate(resourceNames []string)
	
agent.go
	func (a *Agent) Run(ctx context.Context)

secretcache.go
	func (sc *SecretManagerClient) GenerateSecret(resourceName string) (secret *security.SecretItem, err error) 

参考文档

  1. https://cloudnative.to/blog/istio-zero-trust-source-code-reading/
  2. https://cloudnative.to/blog/istio-security-best-practices/
  3. https://ultimatesecurity.pro/post/istio-mtls/
  4. https://istio.io/latest/
  5. https://jimmysong.io/istio-handbook/
  6. http://www.voycn.com/article/istioxdsxieyijiexi

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/537412.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

CVE-2022-39197(Cobalt Strike XSS <=4.7)漏洞复现(超详细)

0x00 漏洞概述 2022年09月22日&#xff0c;360CERT监测发现了Cobalt Strike远程代码执行漏洞&#xff0c;漏洞编号为CVE-2022-39197&#xff0c;漏洞等级&#xff1a;严重&#xff0c;漏洞评分&#xff1a;9.8   Cobalt Strike&#xff08;也称CS&#xff09;由美国Red Team开…

互联网内卷严重?你咋不看看其他行业呢?无非是三十晚上无月亮,大家都一样

一千个人眼中有一千个哈姆雷特&#xff0c;互联网行业就像一座围城&#xff0c;城外的人想进来&#xff0c;城内的人要么卷要么躺要么润 ​ 真实的感受你可以现在约几个面试体验一下。内卷到什么程度&#xff1f; 产品和运营岗&#xff0c;业务经验不完全对口简历都过不了&am…

洛谷P1036题解

一、问题引出 [NOIP2002 普及组] 选数 题目描述 已知 n n n 个整数 x 1 , x 2 , ⋯ , x n x_1,x_2,\cdots,x_n x1​,x2​,⋯,xn​&#xff0c;以及 1 1 1 个整数 k k k&#xff08; k < n k<n k<n&#xff09;。从 n n n 个整数中任选 k k k 个整数相加&…

nginx keepalive 高可用原理和实操

文章目录 前言一、nginxkeepalive搭建高可用服务方案&#xff1f;二、方案解析1.keepalive是什么2.nginx是什么 三、keepalive与nginx环境安装四、高可用配置实例总结 前言 一、nginxkeepalive搭建高可用服务方案&#xff1f; 使用nginx-keepalived双机热备机制&#xff0c;vi…

Java-锁相关

线程不安全的原因 1.调度器随机调度,抢占式执行(无能为力) 举个例子 有一个int变量 叫count 就俩线程同时count一万次 结果应该为两万 可多次运行程序 这结果每次都不一样(而且小于2w) 是为什么呢 因为count这行代码是分三步运行的 load 把数据读到cpu add 在cpu寄存器实现加法…

一、计算机系统基础

// 本章节内容根据下列代码的生命周期来讲解计算机系统的各个部分 hello.c #include <stdio.h>int main {printf("hello, world\n");return 0; }文章目录 1.1信息 位 上下文1.2程序的编译过程1.3系统的硬件组成1.4运行hello程序1.5高速缓存1.6操作系统管理硬…

小程序用什么开发?

近年来&#xff0c;随着智能手机的普及和移动互联网的发展&#xff0c;小程序成为了一种备受关注的新型应用。那么&#xff0c;小程序用什么开发呢&#xff1f; 首先&#xff0c;小程序可以使用多种技术进行开发&#xff0c;其中比较流行的有两种方式&#xff1a;一种是借助微…

( 背包问题) 1049. 最后一块石头的重量 II ——【Leetcode每日一题】

❓1049. 最后一块石头的重量 II 难度&#xff1a;中等 有一堆石头&#xff0c;用整数数组 stones 表示。其中 stones[i] 表示第 i 块石头的重量。 每一回合&#xff0c;从中选出任意两块石头&#xff0c;然后将它们一起粉碎。假设石头的重量分别为 x 和 y&#xff0c;且 x &…

尾调用优化

尾调用优化 最近遇到一个堆栈溢出的问题&#xff0c;分析后发现可收敛为递归边界问题。结合“红宝书”中相关内容和ES6规范中的一些优化机制&#xff0c;整理记录如下。 前言 程序运行时&#xff0c;计算机会为应用程序分配一定的内存空间。应用程序会自行分配所获得的内存空…

SpringBoot @JsonProperty + @JsonMixin注解 实现返回json数据key的转换

参考资料 Springboot 一个注解搞定返回参数key转换 【实用】Spring Boot 2.7新特性&#xff1a;JsonMixin 目录 一. 需求二. 前期准备三. 解决方式一: JsonProperty注解三. 解决方式二: JsonProperty JsonMixin注解3.1 方式1 混入单个类3.1.1 创建一个被JsonMixin注解修饰的抽…

ChatGPT初学者最佳实践

2022年11月底&#xff0c;ChatGPT引爆了新一轮AI的革命&#xff0c;也让人们意识到AI真的能够大幅度提高人们的工作效率&#xff0c;甚至有人担心自己的工作会因为AI不保。这种居安思危的意识是正确的&#xff0c;但是正如锛凿斧锯的出现&#xff0c;并没有让木匠这个行业消失&…

音频格式及转换代码

音频信号的读写、播放及录音 python已经支持WAV格式的书写&#xff0c;而实时的声音输入输出需要安装pyAudio(http://people.csail.mit.edu/hubert/pyaudio)。最后我们还将使用pyMedia(http://pymedia.org)进行Mp3的解码和播放。 音频信号是模拟信号&#xff0c;我们需要将其…

纯前端绘制的下雨效果

先上效果&#xff1a; 再上代码&#xff1a; <!--黏糊糊的菜单--> <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><title>Title</title><meta name"viewport" content"widt…

Golang笔记:使用os.Args和flag包编写命令行界面(CLIs)

文章目录 目的os.ArgsflagFlagSet总结 目的 命令行界面&#xff08;Command-line Interfaces&#xff09;是比较常用的一种软件形式。对于大部分开发运维人员来说很多时候CLIs可能比图形界面更加方便。软件开发时也经常会有需要开发命令行界面形式软件的情况&#xff0c;使用G…

Maven基础篇

Maven基本概念 Maven是什么 maven的本质是一个项目管理工程&#xff0c;将项目开发和管理过程抽象成一个项目对象模型&#xff08;POM&#xff09; POM&#xff08;Project Object Model&#xff09;&#xff1a;项目对象模型 作用 项目构建&#xff1a;提供标准的、跨平台…

什么是Selenium?如何使用Selenium进行自动化测试

目录 什么是 Selenium&#xff1f; Selenium 的优势是什么? 软件测试的需要 手动测试的挑战 自动化测试胜过手动测试 Selenium 对比 QTP 和 RFT Selenium 工具套件 Selenium 有哪些组件? Selenium RC &#xff08;远程控制&#xff09; Selenium IDE&#xff08;集成…

MIT6824——lab2(实现一个Raft库)的一些实现,问题,和思考

MIT 6824 关于lab2的实现&#xff0c;由于开源许可的问题&#xff0c;代码暂时不开源&#xff0c;下面是自己在实现过程中的思路&#xff0c;遇到的问题&#xff0c;以及总结 1 总结 1.1 raft整个流程 应用程序&#xff1a;kv数据库启动raft库&#xff0c;选举leader&#xf…

跳槽前,把自己逼成卷王...

前段时间席卷全互联网行业的内卷现象&#xff0c;想必有不少人都深陷其中。其实刚开始测试行业人才往往供不应求&#xff0c;而在发展了十几年后&#xff0c;很多人涌入这个行业开始面对存量竞争。红利期过去了&#xff0c;仅剩内部争夺。 即便如此&#xff0c;测试行业仍有许…

AspNetCore中的配置文件详解

1 配置文件 程序开发中&#xff0c;有些信息是要根据环境改变的&#xff0c;比如开发环境的数据库可能是本地数据&#xff0c;而生产环境下需要连接生产数据库&#xff0c;我们需要把这些信息放到程序外面&#xff0c;在程序运行时通过读取这些外部信息实现不改变程序代码适应…

计算机图形学-GAMES101-8

引言 着色是针对某一个点(片段)的应用&#xff0c;这里需要考虑着色的频率。  漫反射项代表光向四面八方均匀的反射出去&#xff0c;和观察方向无关。  Blinn-Phong反射模型结构如下&#xff1a; ) 一、Blinn-Phong模型 &#xff08;1&#xff09;Specular 什么时候才能看到…