Skip to content

Apress/DevSecOps-for-Linux

Repository files navigation

Companion Resources: DevSecOps and DevOps for Linux

The Foundations

Welcome to the official repository for "DevSecOps and DevOps for Linux: The Foundations" by Marco Antonio Carcano (published by Apress).

This book bridges the gap between theoretical DevOps culture and production-ready Linux implementations: in addition to the ever-required theoretical concepts, the book goes beyond simply providing isolated examples and code snippets, also offering a self-contained Git repository that will allow you to interact with a live, ever-evolving codebase, mapped across multiple Git branches.


🚀 How to Get Started

  1. Download the Lab Files: Download the devsecops-pillars.tar.gz at the end of the description of the latest release.
  2. Follow the Book Journey: Extract the tarball as instructed in the book to access step-by-step chapter scripts and laboratory environments.

[!INFO] You can use the provided Vagrantfile to spin up the Lab Virtual Machine: it's not just convenient, it also gives you the opportunity to check a non-trivial Vagrantfile.


📦 What's Inside: The fancymonitor Project

The fancymonitor project is the hidden pearl in the book: it is a practical lab which evolves along with the topics explained in the chapters, adding features until it becomes a full-featured, standalone Python project designed to simulate a real-world enterprise development lifecycle, including Gitea Action Workflows.

Just to give you the gist of how it is in the end of the training, the fancymonitor's project main branch has been extracted into this Github repository in the fancymonitor directory.

🛡️ Continuous Integration & Shift-Left Security

  • .pre-commit-config.yaml: Pre-configured pre-commit framework executing static code analysis (Flake8, Pylint) and automated security vulnerability scanning (Bandit).
  • setup.cfg: Centralized, fine-tuned configurations for Flake8, Pylint, and Bandit.
  • .safety-project.ini: Dedicated policy configuration for dependency vulnerability scanning via Safety.

🛠️ Automation & Modern Packaging (RPM & Wheels)

  • src/pyproject.toml: Modern Python packaging definitions and metadata specification.
  • src/Makefile: A robust automation suite providing distinct targets to:
    • Install the project into a self-contained directory tree.
    • Build the project as a Python Wheel.
    • Execute PyTest unit tests and securely package the Wheel into a native RPM package.
    • Digitally sign the generated RPM package for trusted distribution.
  • RPM/SPECS/carcano_fancymonitor.spec: Advanced RPM specification file demonstrating how to cleanly split a project into a reusable library package and an executable application package.

🔄 CI/CD Pipelines (GitOps via Gitea)

[!INFO] The book also explains how to easily install Kubernetes (RKE2), Rancher and how to deploy Gitea and Gitea Workflows Runners using official Gitea Helm charts. It also shows how to easily deploy Pulp3 using Docker Compose. The result is a complete personal CI/CD toolchain that supports, via gitops, compiling, testing, packaging, and publishing digitally singed RPM packages to a private repository.


🌿 The Feature-Branch Methodology (No-Rework Architecture)

A core teaching of this book is managing architectural evolution without technical debt.

The fancymonitor's git repository is pre-populated with multiple feature branches. By switching between branches, you will see exactly how a clean, decoupled codebase can be extended with new capabilities with zero (or minimal) code rework. Even if you are not familiar with git, the book provides you with the proper commands to run to make an easy comparison to easily figure out the added pieces of code.


📖 Get the Book

Ready to master automation, CI/CD, and Linux hardening?
👉 [https://link.springer.com/book/9798868820762]


🗂️ Table of Contents

These are the topics covered in the book, grouped by section.

Section Chapter Title Code & Assets Location
Holistic Skills Set Chapter 1Team Working Theory only
Chapter 2Solution’s Lifecycle
Chapter 3An overview of Agile and Lean
Chapter 4An overview of Scrum and Kanban
Operating With The System Chapter 5The BASH shell And Command Line Utilities Embedded in book
Basic Data Formats Chapter 6Key-values, INI and CSV Embedded in book
Data Processing Chapter 7Regular Expressions (RegEx) Embedded in book
Chapter 8Working With Grep
Chapter 9Working With Sed
Chapter 10Working With AWK
Structured Data Processing Chapter 11XML with XPath, XMLStarlet and Python 📂 loaders/xml.py
Chapter 12JSON with Jq and Python 📂 ch12/ & loaders/json.py
Chapter 13YAML with Yq and Python 📂 ch13/ & loaders/yaml.py
Developing a Python Project Chapter 14Unit Tests 📂 fancymonitor/src/test/
Chapter 15Packaging As A WheelEmbedded in book
Chapter 16Managing The Build With GNU Make 📄 fancymonitor/src/Makefile
Chapter 17Packaging As RPM 📄 carcano_fancymonitor.spec
Chapter 18Setup Git And The pre-commit Framework 📄 .pre-commit-config.yaml
Chapter 19Auditing Source Code Compliance📄 setup.cfg
📄 .safety-project.ini
Chapter 20Scanning Vulnerabilities
Security Chapter 21System Security Embedded in book
Chapter 22Securing Data and Validating Identity (GPG)
Chapter 23X.509 Certificates And PKI 📂 ch23/
Common Protocols Chapter 24HTTP Embedded in book
Chapter 25TLS
Chapter 26LDAP
Working With Containers Chapter 27The Containers ecosystem Embedded in book
Chapter 28Docker And Podman 📂 ch28/
Chapter 29Deploying Pulp3 Using Docker ComposeEmbedded in book
Service Protocols Chapter 30SOAP and REST 📂 ch30/
Orchestrating Containers Chapter 31Kubernetes, Helm And Rancher 📂 ch31/
Chapter 32Deploying Gitea Using The Helm Chart 📂 ch32/
Chapter 33CI/CD And Continuous DeliveryEmbedded in book
Chapter 34Working With Gitea Actions Workflows📂 Gitea Actions Templates
Version Control Chapter 35Version Management With Git Embedded in book
Remote Configuration Management Chapter 36An overview of SSH Embedded in book
Chapter 37Ansible playbooks, roles and collections 📂 ch37/

🤝 Support & Errata