Giter Club home page Giter Club logo

k8s-node-stig-baseline's Introduction

Kubernetes Node STIG Automated Compliance Validation Profile

InSpec profile to validate the secure configuration of a Kubernetes node against DISA's Kubernetes Secure Technical Implementation Guide (STIG) Version 1 Release 1.

Getting Started

It is intended and recommended that InSpec and this profile be run from a "runner" host (such as a DevOps orchestration server, an administrative management system, or a developer's workstation/laptop) against the target remotely using the SSH transport.

For the best security of the runner, always install on the runner the latest version of InSpec and supporting Ruby language components.

Latest versions and installation options are available at the InSpec site.

The Kubernetes STIG includes security requirements for both the Kubernetes cluster itself and the nodes that comprise it. This profile includes the checks for the node portion. It is intended to be used in conjunction with the Kubernetes Cluster profile that performs automated compliance checks of the Kubernetes cluster.

Getting Started

Requirements

Kubernetes Cluster

  • Kubernetes Platform deployment
  • Access to the Kubernetes Node over ssh
  • Account providing appropriate permissions to perform audit scan

Required software on the InSpec Runner

Setup Environment on the InSpec Runner

Install InSpec

Go to https://www.inspec.io/downloads/ and consult the documentation for your Operating System to download and install InSpec.

Ensure InSpec version is at least 4.23.10

inspec --version

Profile Input Values

The default values for profile inputs are given in inspec.yml. These values can be overridden by creating an inputs.yml file -- see the InSpec documentation for inputs.

  - name: manifests_path
    description: 'Path to Kubernetes manifest files on the target node'
    type: string
    value: '/etc/kubernetes/manifests'
    required: true

  - name: pki_path
    description: 'Path to Kubernetes PKI files on the target node'
    type: string
    value: '/etc/kubernetes/pki/'
    required: true

  - name: kubeadm_path
    description: 'Path to kubeadm file on the target node'
    type: string
    value: '/usr/local/bin/kubeadm'
    required: true

  - name: kubectl_path
    description: 'Path to kubectl on the target node'
    type: string
    value: '/usr/local/bin/kubectl'
    required: true

  - name: kubernetes_conf_files
    description: 'Path to Kubernetes conf files on the target node'
    type: array
    value:
        - /etc/kubernetes/admin.conf
        - /etc/kubernetes/scheduler.conf
        - /etc/kubernetes/controller-manager.conf
    required: true

How to execute this instance

(See: https://www.inspec.io/docs/reference/cli/)

Execute the Kubernetes Node profile on each node in the cluster. The profile will adapt its checks based on the Kubernetes components located on the node.

Execute a single Control in the Profile

Note: Replace the profile's directory name - e.g. - <Profile> with . if currently in the profile's root directory.

inspec exec <Profile> -t ssh://TARGET_USERNAME@TARGET_IP:TARGET_PORT --sudo -i <your_PEM_KEY> --controls=<control_id> --show-progress

Execute a Single Control and save results as JSON

inspec exec <Profile> -t ssh://TARGET_USERNAME@TARGET_IP:TARGET_PORT --sudo -i <your_PEM_KEY> --controls=<control_id> --show-progress --reporter json:results.json

Execute All Controls in the Profile

inspec exec <Profile>  -t ssh://TARGET_USERNAME@TARGET_IP:TARGET_PORT --sudo -i <your_PEM_KEY> --show-progress

Execute all the Controls in the Profile and save results as JSON

inspec exec <Profile> -t ssh://TARGET_USERNAME@TARGET_IP:TARGET_PORT --sudo -i <your_PEM_KEY> --show-progress  --reporter json:results.json

Check Overview

Kubernetes Components

This profile evaluates the STIG compliance of the following Kubernetes Components by evaluating their process configuration:

  • kube-apiserver
  • kube-controller-manager
  • kube-scheduler
  • kubelet
  • kube-proxy
  • etcd

If these components are not in use in the target cluster or named differently, the profile has to be adapted for the target K8S distribution using an InSpec Profile Overlay.

k8s-node-stig-baseline's People

Contributors

em-c-rod avatar karikarshivani avatar rx294 avatar wdower avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

k8s-node-stig-baseline's Issues

Profile Dependency Error

When I run the baseline, I get the following error:
Screen Shot 2022-12-06 at 11 04 14 AM

What fixed it for me was adding the optional branch tag to inspec.yml:

depends:
  - name: inspec-k8s-node
    git: https://github.com/mitre/inspec-k8s-node.git
    branch: main

Please lmk if I'm missing anything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.