云原生安全日志审计

news2024/9/17 9:11:42

记得添加,把配置文件挂载进去

    - mountPath: /etc/kubernetes/audit
      name: audit-policy
      readOnly: true
    .....
     - hostPath:
      path: /etc/kubernetes/audit/
      type: DirectoryOrCreate
      name: audit-policy

/etc/kubernetes/manifests/kube-apiserver.yaml  具体配置文件如下

apiVersion: v1
kind: Pod
metadata:
  annotations:
    kubeadm.kubernetes.io/kube-apiserver.advertise-address.endpoint: 10.211.55.4:6443
  creationTimestamp: null
  labels:
    component: kube-apiserver
    tier: control-plane
  name: kube-apiserver
  namespace: kube-system
spec:
  containers:
  - command:
    - kube-apiserver
    - --advertise-address=10.211.55.4
    - --allow-privileged=true
    - --authorization-mode=Node,RBAC
    - --client-ca-file=/etc/kubernetes/pki/ca.crt
    - --enable-admission-plugins=NodeRestriction
    - --enable-bootstrap-token-auth=true
    - --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt
    - --etcd-certfile=/etc/kubernetes/pki/apiserver-etcd-client.crt
    - --etcd-keyfile=/etc/kubernetes/pki/apiserver-etcd-client.key
    - --etcd-servers=https://127.0.0.1:2379
    - --kubelet-client-certificate=/etc/kubernetes/pki/apiserver-kubelet-client.crt
    - --kubelet-client-key=/etc/kubernetes/pki/apiserver-kubelet-client.key
    - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
    - --proxy-client-cert-file=/etc/kubernetes/pki/front-proxy-client.crt
    - --proxy-client-key-file=/etc/kubernetes/pki/front-proxy-client.key
    - --requestheader-allowed-names=front-proxy-client
    - --requestheader-client-ca-file=/etc/kubernetes/pki/front-proxy-ca.crt
    - --requestheader-extra-headers-prefix=X-Remote-Extra-
    - --requestheader-group-headers=X-Remote-Group
    - --requestheader-username-headers=X-Remote-User
    - --secure-port=6443
    - --service-account-issuer=https://kubernetes.default.svc.cluster.local
    - --service-account-key-file=/etc/kubernetes/pki/sa.pub
    - --service-account-signing-key-file=/etc/kubernetes/pki/sa.key
    - --service-cluster-ip-range=10.96.0.0/12
    - --tls-cert-file=/etc/kubernetes/pki/apiserver.crt
    - --tls-private-key-file=/etc/kubernetes/pki/apiserver.key
    - --audit-log-path=/var/log/kubernetes/audit/audit.log
    - --audit-policy-file=/etc/kubernetes/audit/audit-default-policy.yaml
    image: registry.aliyuncs.com/google_containers/kube-apiserver:v1.23.17
    imagePullPolicy: IfNotPresent
    livenessProbe:
      failureThreshold: 8
      httpGet:
        host: 10.211.55.4
        path: /livez
        port: 6443
        scheme: HTTPS
      initialDelaySeconds: 10
      periodSeconds: 10
      timeoutSeconds: 15
    name: kube-apiserver
    readinessProbe:
      failureThreshold: 3
      httpGet:
        host: 10.211.55.4
        path: /readyz
        port: 6443
        scheme: HTTPS
      periodSeconds: 1
      timeoutSeconds: 15
    resources:
      requests:
        cpu: 250m
    startupProbe:
      failureThreshold: 24
      httpGet:
        host: 10.211.55.4
        path: /livez
        port: 6443
        scheme: HTTPS
      initialDelaySeconds: 10
      periodSeconds: 10
      timeoutSeconds: 15
    volumeMounts:
    - mountPath: /etc/ssl/certs
      name: ca-certs
      readOnly: true
    - mountPath: /etc/ca-certificates
      name: etc-ca-certificates
      readOnly: true
    - mountPath: /etc/pki
      name: etc-pki
      readOnly: true
    - mountPath: /etc/kubernetes/pki
      name: k8s-certs
      readOnly: true
    - mountPath: /usr/local/share/ca-certificates
      name: usr-local-share-ca-certificates
      readOnly: true
    - mountPath: /usr/share/ca-certificates
      name: usr-share-ca-certificates
      readOnly: true
    - mountPath: /etc/kubernetes/audit
      name: audit-policy
      readOnly: true
  hostNetwork: true
  priorityClassName: system-node-critical
  securityContext:
    seccompProfile:
      type: RuntimeDefault
  volumes:
  - hostPath:
      path: /etc/ssl/certs
      type: DirectoryOrCreate
    name: ca-certs
  - hostPath:
      path: /etc/ca-certificates
      type: DirectoryOrCreate
    name: etc-ca-certificates
  - hostPath:
      path: /etc/pki
      type: DirectoryOrCreate
    name: etc-pki
  - hostPath:
      path: /etc/kubernetes/pki
      type: DirectoryOrCreate
    name: k8s-certs
  - hostPath:
      path: /usr/local/share/ca-certificates
      type: DirectoryOrCreate
    name: usr-local-share-ca-certificates
  - hostPath:
      path: /usr/share/ca-certificates
      type: DirectoryOrCreate
    name: usr-share-ca-certificates
  - hostPath:
      path: /etc/kubernetes/audit/
      type: DirectoryOrCreate
    name: audit-policy
status: {}

策略文件如下所示 

apiVersion: audit.k8s.io/v1
kind: Policy
rules:
# do not log requests to the following 
- level: None
  nonResourceURLs:
  - "/healthz*"
  - "/logs"
  - "/metrics"
  - "/swagger*"
  - "/version"

# limit level to Metadata so token is not included in the spec/status
- level: Metadata
  omitStages:
  - RequestReceived
  resources:
  - group: authentication.k8s.io
    resources:
    - tokenreviews

# extended audit of auth delegation
- level: RequestResponse
  omitStages:
  - RequestReceived
  resources:
  - group: authorization.k8s.io
    resources:
    - subjectaccessreviews

# log changes to pods at RequestResponse level
- level: RequestResponse
  omitStages:
  - RequestReceived
  resources:
  - group: "" # core API group; add third-party API services and your API services if needed
    resources: ["pods"]
    verbs: ["create", "patch", "update", "delete"]

# log everything else at Metadata level
- level: Metadata
  omitStages:
  - RequestReceived

 

移动云帮助中心

云原生安全-从k8s日志审计视角检测自动化工具攻击

http://elkeid.bytedance.com/docs/ElkeidData/k8s_rule.html

https://github.com/jetstack/kubernetes.github.io/blob/master/docs/tasks/debug-application-cluster/audit.md

https://www.armosec.io/blog/kubernetes-audit-log-security/

https://www.datadoghq.com/blog/key-kubernetes-audit-logs-for-monitoring-cluster-security/

https://sysdig.com/learn-cloud-native/kubernetes-security/kubernetes-audit-log/

https://www.datadoghq.com/blog/monitor-kubernetes-audit-logs/#what-are-kubernetes-audit-logshttps://www.youtube.com/watch?v=h0h9QWhGFS4

Reference table for all security alerts - Microsoft Defender for Cloud | Microsoft Learn

https://github.com/knownsec/KCon/blob/master/2021/kubernetes%E4%B8%AD%E7%9A%84%E5%BC%82%E5%B8%B8%E6%B4%BB%E5%8A%A8%E6%A3%80%E6%B5%8B.pdf

https://cloud.tencent.com/developer/article/1988827

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

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

相关文章

2003. 每棵子树内缺失的最小基因值 (困难,DFS,Set.update)

困难,还是一如既往的不会做,但是得写写自己的想法 先从根节点开始作深度搜索,对于每一个以 node 为根的子树,我们返回该子树排序后的基因集合,类似与归并排序显然在每次合并集合进行排序的时候我们就可以知道 node 子…

innovus: 如何写出floorplan和power信息

我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧? 拾陆楼知识星球入口 相关文章链接: innovus 报告多边形floorplan的boundary坐标 defOut 如果是自己用的floorplan信息可用如下命令: defOut -floorplan -allLayers fp.def 如果是dc…

JavaWeb项目Tomcat运行上一次的记录?

问题:修改JavaWeb项目的代码之后,tomcat仍然运行上一次的代码记录 原因:可能是由于运行了上一次成功记录的缓存 接解决办法: 来到运行部署的网页,按F12,打开“网络”->“禁用缓存”

解决多模态大模型幻觉问题的秘密武器:“啄木鸟”免重训方法!哪里出问题啄哪里!

夕小瑶科技说 原创 作者 | 付奶茶、王二狗 最近多模态大模型的研究取得了巨大的进展。然而,这些模型在生成时存在着文本与图像不一致的问题,这个问题就是一直困扰研究者们的“幻觉难题”。 ▲给定一幅图像,MLLM会输出的回应,包括…

堆栈和队列算法-双向队列

目录 堆栈和队列算法-双向队列 C代码 堆栈和队列算法-双向队列 双向队列(Double Ended Queues,DEQue)为一个有序线性表,加入与删除操作可在队列的任意一端进行。 具体来说,双向队列就是允许队列两端中的任意一端都…

Acrel-3000水电站厂用电管理系统实现电站的发、用电监控、设备管理和运维管理-安科瑞黄安南

NB/T 10861-2021《水力发电厂测量装置配置设计规范》对水电厂的测量装置配置做了详细要求和指导。测量装置是水力发电厂运行监测的重要环节,水电厂的测量主要分为电气量测量和非电量测量。电气测量指使用电的方式对电气实时参数进行测量,包括电流、电压、…

【VR开发】【Unity】【VRTK】2-关于VR的基础知识

【概述】 在VRTK的实操讲解之前,本篇先介绍几个重要的VR认识。 【VR对各个行业的颠覆】 如果互联网几乎把所有行业都重做了一遍,VR在接下来的几年很可能再把现有的行业都重做一遍,包括但不限于教育,房地产,零售&…

C#--继承

提高开发效率的一种手段 继承就是把大家共性的东西提取出来,共享 被僵尸咬一口你也是僵尸 C#不支持多重继承 C#类可以派生自另一个类和任意多个接口 继承具有单根性,一个派生类只能继承一个父类 如果没有写继承自那个类,默认继承object类&am…

面试官:聊聊kafka线上使用会有哪些问题?

哪些环节会造成消息丢失? 首先说说哪些环节会丢消息 消息生产者: (1)acks0: 表示producer不需要等待任何broker确认收到消息的回复,就可以继续发送下一条消息。性能最高,但是最容易丢消 息。大…

AMEYA360:村田量产面向汽车的1.0μF 0.18mm超薄LW逆转低ESL片状多层陶瓷电容器

株式会社村田制作所已开发出面向汽车ECU(电子控制单元)中使用的处理器、超小*(0.5mm1.0mm)且超薄的LW逆转低ESL片状多层陶瓷电容器“LLC15SD70E105ME01”,并于9月开始量产。该产品T尺寸标准值为0.16 0.02 mm(厚度为最大0.18 mm),与普通多层陶瓷电容器不…

通配符/泛域名SSL证书

在互联网发展迅速的今天,许多网站都拥有多个子域名,例如www.example.com、blog.example.com和shop.example.com等。为了确保这些子域名之间的数据传输安全,通配符/泛域名SSL证书成为了一种广泛采用的解决方案。 1,什么是通配符/泛…

Kubernetes Taint(污点) 和 Toleration(容忍)

Author:rab 目录 前言一、Taint(污点)1.1 概述1.2 查看节点 Taint1.3 标记节点 Taint1.4 删除节点 Taint 二、Toleration(容忍) 前言 Kubernetes 中的污点(Taint)和容忍(Toleration…

highcharts 3D环形饼图

1.下载安装highcharts npm install highcharts --save2.在页面引入 import highcharts from highcharts3.在main.js引入 import highcharts from highcharts import highcharts3d from highcharts/highcharts-3d highcharts3d(highcharts)4.html部分代码 <div class"…

时间复杂度为 O(nlogn) 的排序算法

归并排序 归并排序遵循 分治 的思想&#xff1a;将原问题分解为几个规模较小但类似于原问题的子问题&#xff0c;递归地求解这些子问题&#xff0c;然后合并这些子问题的解来建立原问题的解&#xff0c;归并排序的步骤如下&#xff1a; 划分&#xff1a;分解待排序的 n 个元素…

v-bind动态改变样式

通过v-bind切换样式&#xff0c;:class"{ active:true}"为true展示样式&#xff0c;false不展示。也可以由:style"{ width:percent %}"动态控制宽度。 注意后面是JS对象&#xff0c;所以后面的值不可以包含-&#xff0c;比如background-color会解析出错&a…

报修软件在企业管理中有哪些作用?有什么好用的设备质量管理软件?

在当今的信息化时代&#xff0c;企业需要不断加速自身的信息化建设&#xff0c;以适应日益激烈的市场竞争。在这个过程中&#xff0c;“的修”报修软件的引入对于企业设备报修与维护的管理显得尤为重要。本文将详细介绍报修软件的重要性以及其如何帮助企业实现更高效、更智能的…

毕业论文问卷分析思路

很多同学会通过收集问卷的方式获取论文研究需要的数据&#xff0c;但是收集到的问卷应该如何分析呢&#xff1f;问卷一般可以分为两类&#xff1a;非量表类与量表类问卷。不同类型的问卷有不同的分析思路&#xff0c;今天和大家探讨一下拿到一份问卷后&#xff0c;一般的分析思…

Day 15 python学习笔记

__str__ 用print打印对象时&#xff0c;会自动调用 class Test:def __init__(self,name):self.name name# 用print打印对象时&#xff0c;会自动调用def __str__(self):return f"姓名name的值是{self.name}"a Test("zhangsan") print(a)结果&#xff1…

40+专家齐聚共谋数据未来,StarRocks Summit 2023 议程公布!更多精彩议题等你探索...

数字经济时代&#xff0c;什么才是企业的核心竞争力&#xff1f; 答案是数据。 在过去的一年里&#xff0c;越来越多的企业率先行动起来&#xff0c;加入这场数智化的进程中&#xff0c;探寻最佳的底层数据架构模式和极致的数据分析方案。 作为数据进化的亲历者&#xff0c;Sta…

软考_软件设计师

算法&#xff1a; 1、直接插入排序 详解&#xff1a;https://blog.csdn.net/qq_44616044/article/details/115708056 void insertSort(int data[],int n){int i,j,temp;for(i1;i<n;i){if(data[i]<data[i-1]){temp data[i];data[i] data[i-1];for(ji-1;j>0&&am…