使用TerraScan静态扫描KubernetsIaC文件

terrascan

https://github.com/tenable/terrascan
在这里插入图片描述

Terrascan 是基础架构即代码的静态代码分析器。Terrascan 允许:

  • 将基础架构作为代码无缝扫描,以查找错误配置。
  • 监控已配置的云基础架构,以查找引入终端安全评估漂移的配置更改,并启用恢复到安全终端
  • 检测安全漏洞和违规行为。
  • 在配置云原生基础架构之前降低风险。
  • 提供在本地运行或与 CI\CD 集成的灵活性。

terrascan的基本原理是,通过内置的策略,对目标进行扫描。使用前需要下载策略库,而策略库是经常更新的。类似于扫描病毒需要下载病毒库。它还有一个特点是支持涵盖了IaC和容器领域的的文件扫描:

  • Terraform (HCL2)
  • AWS CloudFormation Templates (CFT)
  • Azure Resource Manager (ARM)
  • Kubernetes (JSON/YAML), Helm v3, and Kustomize
  • Dockerfiles

可见IaC中常用的Cfn,Terraform,以及容器领域的K8S,Helm,Kustomize,Dockerfile都有支持,
一个产品搞定,不需要再部署其他的工具,简化了CICD的设计。

安装(Linux)

# 下载
aria2c https://github.com/tenable/terrascan/releases/download/v1.19.1/terrascan_1.19.1_Linux_x86_64.tar.gz

# 没有aria2c可以直接用wget
wget https://github.com/tenable/terrascan/releases/download/v1.19.1/terrascan_1.19.1_Linux_x86_64.tar.gz

# 解压
tar -xzvf terrascan.tar.gz

#安装
install terrascan /usr/local/bin && rm terrascan

命令帮助

Usage:
  terrascan [command]

Available Commands:
  init        Initializes Terrascan and clones policies from the Terrascan GitHub repository.
  scan        Detect compliance and security violations across Infrastructure as Code.
  server      Run Terrascan as an API server
  version     Terrascan version

Flags:
  -c, --config-path string      config file path
  -l, --log-level string        log level (debug, info, warn, error, panic, fatal) (default "info")
      --log-output-dir string   directory path to write the log and output files
  -x, --log-type string         log output type (console, json) (default "console")
  -o, --output string           output type (human, json, yaml, xml, junit-xml, sarif, github-sarif) (default "human")
      --temp-dir string         temporary directory path to download remote repository,module and templates

init:下载策略库,即从策略库仓库 git clone到本地$HOME/.terrascan目录
scan:具体的scan命令,命令行方式使用
server:作为服务器,提供API供外部调用使用,方便和第三方系统整合

扫描参数

  • 指定路径(默认为当前路径) -d
  • 指定文件 -f
  • 指定远程存储路径 -r
    • git, s3, gcs, http, terraform-registry
    • -u 指定具体的url
  • 指定目标类型 -i

arm, cft, docker, helm, k8s, kustomize, terraform, tfplan

  -i, --iac-type string           iac type (arm, cft, docker, helm, k8s, kustomize, terraform, tfplan)
      --iac-version string        iac version (arm: v1, cft: v1, docker: v1, helm: v3, k8s: v1, kustomize: v2, v3, v4, terraform: v12, v13, v14, v15, tfplan: v1)
  • 指定输出格式
    • yaml, json, human(默认),xml

工作原理

初次执行时,先从github上下载对应的策略库,并根据策略库的要求检查目标文件。
也可以主动指定init命令更新策略库

命令行执行

  1. 测试用例文件
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
  namespace: default
spec:
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        resources: {}
        volumeMounts:
        - mountPath: /data
          name: mytest
      restartPolicy: Always
      volumes:
      - name: mytest
        persistentVolumeClaim:
          claimName: my-test-pvc
  1. 执行命令行
terrascan scan -i k8s -f nginx.yaml 
terrascan scan -i k8s -f nginx.yaml -o json
terrascan scan -i k8s -f nginx.yaml -o yaml
  1. 检查结果
k8s@k8s-devp-master:~/yaml$ terrascan scan -i k8s -f nginx.yaml

Violation Details -

        Description    :        Memory Limits Not Set in config file.
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        Apply Security Context to Your Pods and Containers
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        No readiness probe will affect automatic recovery in case of unexpected errors
        File           :        nginx.yaml
        Line           :        1
        Severity       :        LOW
        -----------------------------------------------------------------------

        Description    :        CPU Limits Not Set in config file.
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        Container images with readOnlyRootFileSystem set as false mounts the container root file system with write permissions
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        Memory Request Not Set in config file.
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        No liveness probe will ensure there is no recovery in case of unexpected errors
        File           :        nginx.yaml
        Line           :        1
        Severity       :        LOW
        -----------------------------------------------------------------------

        Description    :        Image without digest affects the integrity principle of image security
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        CPU Request Not Set in config file.
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        Minimize Admission of Root Containers
        File           :        nginx.yaml
        Line           :        1
        Severity       :        HIGH
        -----------------------------------------------------------------------

        Description    :        Default Namespace Should Not be Used
        File           :        nginx.yaml
        Line           :        1
        Severity       :        HIGH
        -----------------------------------------------------------------------

        Description    :        Containers Should Not Run with AllowPrivilegeEscalation
        File           :        nginx.yaml
        Line           :        1
        Severity       :        HIGH
        -----------------------------------------------------------------------

        Description    :        Default seccomp profile not enabled will make the container to make non-essential system calls
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        AppArmor profile not set to default or custom profile will make the container vulnerable to kernel level threats
        File           :        nginx.yaml
        Line           :        1
        Severity       :        MEDIUM
        -----------------------------------------------------------------------

        Description    :        No tag or container image with :Latest tag makes difficult to rollback and track
        File           :        nginx.yaml
        Line           :        1
        Severity       :        LOW
        -----------------------------------------------------------------------


Scan Summary -

        File/Folder         :   /home/k8s/yaml/nginx.yaml
        IaC Type            :   k8s
        Scanned At          :   2024-04-19 08:37:56.943717392 +0000 UTC
        Policies Validated  :   42
        Violated Policies   :   15
        Low                 :   3
        Medium              :   9
        High                :   3

作为服务启动

  1. 启动
k8s@k8s-devp-master:~/yaml$ terrascan server -p 10888
2024-04-19T09:02:06.409Z        info    http-server/start.go:63 registering routes...
2024-04-19T09:02:06.409Z        info    http-server/start.go:75 Route GET - /health
2024-04-19T09:02:06.409Z        info    http-server/start.go:75 Route GET - /v1/providers
2024-04-19T09:02:06.409Z        info    http-server/start.go:75 Route POST - /v1/{iac}/{iacVersion}/{cloud}/local/file/scan
2024-04-19T09:02:06.409Z        info    http-server/start.go:75 Route POST - /v1/{iac}/{iacVersion}/{cloud}/remote/dir/scan
2024-04-19T09:02:06.409Z        info    http-server/start.go:75 Route POST - /v1/k8s/webhooks/{apiKey}/scan/validate
2024-04-19T09:02:06.409Z        info    http-server/start.go:109        http server listening at port 10888
  1. 执行

Server模式下,如何使用几乎没有任何说明,只能参考其源码猜测:
https://github.com/tenable/terrascan/blob/master/pkg/http-server/routes.go
https://github.com/tenable/terrascan/blob/master/pkg/http-server/file-scan_test.go

// Routes returns a slice of routes of API endpoints to be registered with
// http server
func (g *APIServer) Routes() []*Route {
    h := NewAPIHandler()
    routes := []*Route{
        {verb: "GET", path: "/health", fn: h.Health},
        {verb: "GET", path: versionedPath("/providers"), fn: h.iacProviders},
        {verb: "POST", path: versionedPath("/{iac}/{iacVersion}/{cloud}/local/file/scan"), fn: h.scanFile},
        {verb: "POST", path: versionedPath("/{iac}/{iacVersion}/{cloud}/remote/dir/scan"), fn: h.scanRemoteRepo},

        // k8s webhook Routes
        {verb: "POST", path: versionedPath("/k8s/webhooks/{apiKey}/scan/validate"), fn: h.validateK8SWebhook},
    }

    return routes
}
// http request of the type "/v1/{iacType}/{iacVersion}/{cloudType}/file/scan"
			url := fmt.Sprintf("/v1/%s/%s/%s/local/file/scan", tt.iacType, tt.iacVersion, tt.cloudType)

可以看到,它支持如下功能:

  • /providers:功能支持列表
  • /{iac}/{iacVersion}/{cloud}/local/file/scan:本地文件扫描
  • /{iac}/{iacVersion}/{cloud}/remote/dir/scan:远程目录扫描
  • /k8s/webhooks/{apiKey}/scan/validate:和Kubernetes整合用的webhook

功能列表获取

k8s@k8s-devp-master:~/yaml$ curl -X GET  -L http://localhost:10888/v1/providers
[
  {
    "type": "arm",
    "versions": [
      "v1"
    ],
    "defaultVersion": "v1"
  },
  {
    "type": "cft",
    "versions": [
      "v1"
    ],
    "defaultVersion": "v1"
  },
  {
    "type": "docker",
    "versions": [
      "v1"
    ],
    "defaultVersion": "v1"
  },
  {
    "type": "helm",
    "versions": [
      "v3"
    ],
    "defaultVersion": "v3"
  },
  {
    "type": "k8s",
    "versions": [
      "v1"
    ],
    "defaultVersion": "v1"
  },
  {
    "type": "kustomize",
    "versions": [
      "v2",
      "v3",
      "v4"
    ],
    "defaultVersion": "v4"
  },
  {
    "type": "terraform",
    "versions": [
      "v12",
      "v13",
      "v14",
      "v15"
    ],
    "defaultVersion": "v15"
  },
  {
    "type": "tfplan",
    "versions": [
      "v1"
    ],
    "defaultVersion": "v1"
  }

根据以上结果可以拼接访问URL:

  • kubernetes扫描:http://localhost:10888/v1/k8s/v1/k8s/local/file/scan
  • Dockerfile扫描:http://localhost:10888/v1/docker/v1/docker/local/file/scan

另外文件扫描接口只支持multipart/form-data类型的文件上传,不能作为POST的数据直接上传。
命令行参考以下:
可以看到执行结果和命令行一样,json格式。file等信息是内部中间结果信息,可忽略。

 curl -X POST  -L http://localhost:10888/v1/k8s/v1/k8s/local/file/scan -F 'file=@./nginx.yaml'
 
 {
  "results": {
    "violations": [
      {
        "rule_name": "privilegeEscalationCheck",
        "description": "Containers Should Not Run with AllowPrivilegeEscalation",
        "rule_id": "AC_K8S_0085",
        "severity": "HIGH",
        "category": "Compliance Validation",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "secCompProfile",
        "description": "Default seccomp profile not enabled will make the container to make non-essential system calls",
        "rule_id": "AC_K8S_0080",
        "severity": "MEDIUM",
        "category": "Identity and Access Management",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "appArmorProfile",
        "description": "AppArmor profile not set to default or custom profile will make the container vulnerable to kernel level threats",
        "rule_id": "AC_K8S_0073",
        "severity": "MEDIUM",
        "category": "Identity and Access Management",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "imageWithoutDigest",
        "description": "Image without digest affects the integrity principle of image security",
        "rule_id": "AC_K8S_0069",
        "severity": "MEDIUM",
        "category": "Infrastructure Security",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "securityContextUsed",
        "description": "Apply Security Context to Your Pods and Containers",
        "rule_id": "AC_K8S_0064",
        "severity": "MEDIUM",
        "category": "Infrastructure Security",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "MemorylimitsCheck",
        "description": "Memory Limits Not Set in config file.",
        "rule_id": "AC_K8S_0100",
        "severity": "MEDIUM",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "runAsNonRootCheck",
        "description": "Minimize Admission of Root Containers",
        "rule_id": "AC_K8S_0087",
        "severity": "HIGH",
        "category": "Identity and Access Management",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "MemoryRequestsCheck",
        "description": "Memory Request Not Set in config file.",
        "rule_id": "AC_K8S_0099",
        "severity": "MEDIUM",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "nolivenessProbe",
        "description": "No liveness probe will ensure there is no recovery in case of unexpected errors",
        "rule_id": "AC_K8S_0070",
        "severity": "LOW",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "noReadinessProbe",
        "description": "No readiness probe will affect automatic recovery in case of unexpected errors",
        "rule_id": "AC_K8S_0072",
        "severity": "LOW",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "readOnlyFileSystem",
        "description": "Container images with readOnlyRootFileSystem set as false mounts the container root file system with write permissions",
        "rule_id": "AC_K8S_0078",
        "severity": "MEDIUM",
        "category": "Identity and Access Management",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "imageWithLatestTag",
        "description": "No tag or container image with :Latest tag makes difficult to rollback and track",
        "rule_id": "AC_K8S_0068",
        "severity": "LOW",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "otherNamespace",
        "description": "Default Namespace Should Not be Used",
        "rule_id": "AC_K8S_0086",
        "severity": "HIGH",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "CpulimitsCheck",
        "description": "CPU Limits Not Set in config file.",
        "rule_id": "AC_K8S_0098",
        "severity": "MEDIUM",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      },
      {
        "rule_name": "CpuRequestsCheck",
        "description": "CPU Request Not Set in config file.",
        "rule_id": "AC_K8S_0097",
        "severity": "MEDIUM",
        "category": "Security Best Practices",
        "resource_name": "nginx",
        "resource_type": "kubernetes_deployment",
        "file": "terrascan-3209226987.yaml",
        "line": 1
      }
    ],
    "skipped_violations": null,
    "scan_summary": {
      "file/folder": "/tmp/terrascan-3209226987.yaml",
      "iac_type": "k8s",
      "scanned_at": "2024-04-19 09:13:38.989530627 +0000 UTC",
      "policies_validated": 42,
      "violated_policies": 15,
      "low": 3,
      "medium": 9,
      "high": 3
    }
  }


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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

k8s证书续期

证书即将到期了如何进行证书续签 k8s版本V1.23.6 1.查看证书期限 kubeadm certs check-expiration如果证书即将到期,此处的天数应该是几天,在过期之前进行续期,保证集群的可用 2. 备份证书 避免出现问题可以回退 cp -r /etc/kubernetes …

Swift知识点(三)

11. init、deinit、可选链、协议、元类型 构造和析构 构造方法 构造方法是一种特殊的方法 一个对象创建完毕后,都需要调用构造方法进行初始化(比如属性的初始化) 验证:init方法是在对象创建完毕的时候调用 回到存储属性 在对…

【全开源】国际版JAVA游戏陪玩系统源码陪练APP源码H5源码电竞系统源码支持Android+IOS+H5

国际版游戏陪玩系统:连接全球玩家的桥梁 在数字化时代,游戏已成为全球范围内跨越文化和地域的桥梁。随着游戏产业的蓬勃发展,玩家们对于游戏体验的需求也日益多样化。为了满足这一市场需求,我们隆重推出“国际版游戏陪玩系统”&a…

electron的Remote模块

03 【electron的Remote模块】 在渲染进程里(比如index.html里面加载了一些js文件,那里面的js如果要使用到 BrowserWindow 这些属性的话就必须使用 remote) 使用 remote 模块, 你可以调用 main 进程对象的方法 1.electron14.0之前版本使用 …

【微信小程序开发(从零到一)【婚礼邀请函】制作】——邀请函界面的制作(2)

👨‍💻个人主页:开发者-曼亿点 👨‍💻 hallo 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍💻 本文由 曼亿点 原创 👨‍💻 收录于专栏&#xff1a…

一篇文章拿下 Redis缓存穿透,缓存击穿,缓存雪崩

文章目录 ☃️缓存击穿❄️❄️解决方案一、使用锁❄️❄️解决方案二、逻辑过期方案❄️❄️解决方案三、永不过期 主动更新❄️❄️解决方案四、接口限流❄️❄️实战❄️❄️❄️利用互斥锁解决缓存击穿问题❄️❄️❄️利用逻辑过期解决缓存击穿问题 ☃️缓存穿透❄️❄️缓…

【python】将json内解码失败的中文修改为英文(‘utf-8‘ codec can‘t decode,labelme标注时文件名未中文)

出现问题的场景: 语义分割数据集,使用labelme工具进行标注,然后标注图片存在中文名,导致json标签文件写入中文图片名,从而解析失败。 代码解析json文件时,出现报错: python脚本需求&#x…

org.postgresql.util.PSQLException: 错误: 关系 “dual“ 不存在

springboot 项目连接 postgreps,启动时报错 org.postgresql.util.PSQLException: 错误: 关系 "dual" 不存在。 查阅资料后发现这是由配置文件中的配置 datasource-dynamic-druid-validationQuery 导致的 spring:datasource:druid:stat-view-servlet:ena…

SDL系列(四)—— 事件机制

事件循环 大多数多媒体程序依靠 事件系统 来处理输入。 SDL 为处理输入事件提供了灵活的 API 。 本质上, SDL 将来自设备(如键盘,鼠标或控制器)的输入记录为 事件 ,将它们存储在 “ 事件队列 ”中。 您可以将此…

使用Xterm实现终端构建

————html篇———— // 需要使用Xterm Xterm的官网&#xff1a; Xterm.js 新建项目 增加基本文件 下载 框架 npm init -y Xterm依赖 npm install xterm/xterm 参考文档写的代码 贴入代码 <html><head><link rel"stylesheet" href"nod…

【prometheus】prometheus基于consul服务发现实现监控

目录 一、consul服务发现简介 1.1 consul简介 二、prometheus配置 2.1 node-exporter服务注册到consul 2.2 修改prometheus配置文件 【Prometheus】概念和工作原理介绍_prometheus工作原理-CSDN博客 【Prometheus】k8s集群部署node-exporter 【prometheus】k8s集群部署p…

企业微信hook接口协议,ipad协议http,大文件网络上传

大文件网络上传 参数名必选类型说明url是String网络图片地址 请求示例 {"uuid":"2b0863724106a1160212bd1ccf025295","authkey":"0AAxxx031", "filekey":"346b7bff-08d5-4ac2-bc67-fd10e3eb2388", "fileur…

六西格玛绿带培训:解锁质量工程师的职场新篇章

在质量管理这条道路上&#xff0c;我们或许都曾有过这样的疑问&#xff1a;为何付出了同样的努力&#xff0c;却未能获得预期的回报&#xff1f;当我们看到身边的同行们逐渐步入高薪的行列&#xff0c;而自己却似乎陷入了职业的泥沼&#xff0c;这种对比无疑令人倍感焦虑。然而…

win10安装docker

控制面板-> 程序和功能 最好是是管理员进入cmd PS C:\Windows\system32> wsl --status PS C:\Windows\system32> wsl --install -d Ubuntu 正在安装: 适用于 Linux 的 Windows 子系统 已安装 适用于 Linux 的 Windows 子系统。 正在安装: Ubuntu 已安装 Ubuntu。 请…

银行风险系统的全面解析:功能作用与系统间的互联互通

银行风险管理系统是银行为控制风险而建立的一套重要系统&#xff0c;主要用于评估、监测和控制银行面临的各种风险&#xff0c;包括信用风险、市场风险、操作风险等。 一、主要功能 风险识别&#xff1a;系统首先识别在业务开展中可能会面临的各种风险。这通常涉及对客户信息、…

Kotlin核心编程知识点-02-面向对象

文章目录 1.类和构造方法1.1.Kotlin 中的类及接口1.1.1.Kotlin 中的类1.1.2.可带有属性和默认方法的接口 1.2.更简洁地构造类的对象1.2.1.构造方法默认参数1.2.2.init 语句块1.2.3.延迟初始化&#xff1a;by lazy 和 lateinit 1.3.主从构造方法 2.不同的访问控制原则2.1.限制修…

【虚拟仿真】Unity3D中实现对大疆无人机遥控器手柄按键响应

推荐阅读 CSDN主页GitHub开源地址Unity3D插件分享简书地址QQ群:398291828大家好,我是佛系工程师☆恬静的小魔龙☆,不定时更新Unity开发技巧,觉得有用记得一键三连哦。 一、前言 最近项目中需要用到大疆无人机遥控器对程序中无人机进行控制,遥控器是下图这一款: 博主发…

【案例】根据商品的颜色进行分组,同一种颜色的商品可以对应多种尺寸、价格以及库存

效果展示 效果说明 输入商品的颜色、尺寸后点击添加按钮&#xff0c;即可将对应的商品信息添加到下方的表格当中&#xff0c;表格中除了会显示商品的颜色和尺寸之外&#xff0c;还会显示商品的价格和库存&#xff0c;并且可以对商品的价格和库存进行修改&#xff0c;并且根据颜…

实现mysql的主从复制、实现MySQL的读写分离与负载均衡

实验环境 &#xff08;注明&#xff09;以下的所有关于yum和rpm以及tar的软件需要自己准备&#xff0c;没有的话可以私信博主 实验目标&#xff1a; 1.实现mysql主从复制 2.实现mysql读写分离与负载均衡 实验一、搭建mysql主从复制 1.建立时间同步环境&#xff0c;在主节…

圆上点云随机生成(人工制作模拟数据)

1、背景介绍 实际上,很多地物外表形状满足一定的几何形状结构,如圆形是作为常见一类。那么获取该类目标的点云数据便是位于一个圆上的点云数据。如下图所示为两簇典型的点云,其中一种为理想型,点均位于一个圆上,另外一簇则是近似位于一个圆上,这种更加符合真实情况。有时…