
Welcome to Non-Human Identity Security: Secrets, Bots & API Keys. This opening lecture introduces the course, explains why machine identities have become one of the most important and most overlooked areas of cybersecurity, and shows how each section builds toward a practical, enterprise-style security platform.
We begin with the problem. Modern organizations run on automation. Applications call APIs, pipelines deploy code, containers talk to databases, cloud workloads assume roles, and AI agents use tools. Every one of these actors needs an identity and a credential, and in most companies the number of non-human identities far exceeds the number of employees. They are often created quickly, rarely reviewed, and frequently over-privileged, which makes them attractive targets for attackers.
You will see the learning path. We start with core concepts, discovery, and threats, then move into secrets scanning, least privilege, and secure secrets management with OpenBao. Later sections cover dynamic secrets, OAuth 2.0 and OpenID Connect, workload identity with SPIFFE and SPIRE, Kubernetes, cloud IAM, CI/CD pipelines, bots, AI agents and MCP, and finally monitoring, incident response, and governance.
Each section pairs concise concept lectures with a hands-on lab that you run in your own local environment. By the end of this lecture you will understand the scope of the course, the tools involved, and how to get the most from every lesson, lab, and the final capstone project.
What exactly is a non-human identity? This lecture defines the term clearly and gives you a vocabulary that you will use in every later section of the course.
A non-human identity, often shortened to NHI, is any digital identity that represents software, a device, or an automated process rather than a person. Examples include service accounts used by applications, API keys that identify a client, automation bots, build and deployment pipelines, containers and workloads, scheduled jobs, cloud roles, certificates, and increasingly AI agents that act autonomously on behalf of a team.
We explain why these identities exist. Systems must authenticate to one another without a person typing a password, so they rely on secrets such as keys, tokens, and certificates that grant access to data and services. Because these credentials are handled by code and configuration, they spread easily across repositories, containers, build logs, and chat messages.
You will learn why NHIs now outnumber human identities in most environments, often by a wide margin, and why this growth creates risk. Many have no clear owner, never expire, and carry permissions far beyond what they need.
We also introduce the lifecycle of a machine identity: creation, issuance, use, rotation, review, and retirement. By the end of this lecture you will be able to define NHIs, give concrete examples, and explain why securing them deserves its own discipline.
Human and machine identities may both be called accounts, but they behave very differently, and security controls designed for people often fail when applied to machines. This lecture compares the two and explains the consequences.
Humans authenticate interactively. They can type passwords, approve prompts on a phone, use biometrics, and notice when something looks suspicious. Organizations protect them with multi-factor authentication, single sign-on, onboarding and offboarding processes tied to HR systems, and regular access reviews.
Machines cannot do any of that. A service must present a credential automatically, thousands of times per day, without anyone watching. That credential is usually a long string stored somewhere, which means anyone who obtains it can act as the machine. Machines also operate at high speed and volume, work around the clock, and often share one identity across many instances.
We compare the two across several dimensions: creation, authentication, ownership, lifetime, privileges, monitoring, and offboarding. You will see that machine identities typically lack owners, are not tied to a leaver process, and rarely have multi-factor protection.
We then discuss what good looks like for machines: short-lived credentials, strong cryptographic authentication, narrow permissions, automated rotation, and clear accountability. By the end of this lecture you will understand why a dedicated approach to machine identity security is necessary.
This lecture explores the main types of non-human identities and credentials, so you can recognize them in any environment and understand how each one is used and misused.
We begin with service accounts, which are accounts created for applications and services rather than people. They may live in an operating system, a database, a directory, or a cloud platform. Next are API keys, which are simple secret strings sent with requests to identify a calling application. They are easy to use but also easy to leak, and they often lack expiration.
We then cover bots and automation accounts, such as those used in chat platforms, ticketing systems, and scheduled tasks. Tokens come next: bearer tokens, session tokens, and JSON Web Tokens that prove an identity or authorization for a limited time. Finally, we discuss certificates and keys, which provide stronger cryptographic proof of identity and are used in mutual TLS and workload authentication.
For each type, we look at how it is created, where it is typically stored, its common weaknesses, and better alternatives. For example, long-lived static keys are risky, while short-lived tokens issued on demand are safer.
By the end of this lecture you will be able to classify any machine credential, describe its strengths and weaknesses, and choose the right control for it.
Every credential, account, and integration adds to what security teams call the attack surface. This lecture explains the machine identity attack surface and why it grows so quickly.
We start by mapping where machine identities exist. They appear in source code repositories, configuration files, container images, environment variables, build and deployment pipelines, cloud accounts, Kubernetes clusters, SaaS integrations, databases, and developer laptops. Each location is a place where a secret might be stored, copied, logged, or leaked.
Next, we look at the factors that expand the surface: rapid cloud adoption, microservices, infrastructure as code, third-party integrations, and AI-driven automation. Teams create identities for convenience and speed, and the security review often comes later or never.
We then examine the characteristics that make machine identities attractive to attackers. They often have broad permissions, long lifetimes, no multi-factor protection, and weak monitoring, so misuse can go unnoticed for months. A single leaked credential may provide direct access to production data or a path to move deeper into the environment.
Finally, we introduce a defender's view. You cannot protect what you cannot see, so visibility, ownership, least privilege, and short credential lifetimes become the foundation of the program. By the end of this lecture you will be able to describe your organization's machine identity attack surface and where to begin reducing it.
In this first hands-on lab you will build the Non-Human Identity Security lab environment that supports every exercise in the course.
Start by confirming that your computer meets the requirements: a supported operating system, enough memory for several containers, and permission to install developer tools. Install Docker and Docker Compose, Python, and a code editor, then verify each installation with a version check.
Next, download the lab package and review its folder structure. You will see directories for sample applications, configuration files, policies, scripts, and sample data that are used in later labs. Create a Python virtual environment, install the required libraries, and keep the project organized so that you can find files easily.
Then start the base services with Docker Compose. These include a PostgreSQL database, a simple FastAPI application, and supporting tools that later become part of your secrets and identity platform. Check that each container is healthy, view its logs, and confirm that you can reach the web endpoints in your browser.
Finally, create a small notes file where you will record versions, ports, and commands. All credentials in the lab are fake and are used only in your isolated local environment. Keep the environment ready, since every later lab builds on it.
This lecture is your guide to the Non-Human Identity Security complete hands-on lab package, the collection of files and resources that supports every practical exercise in the course.
We explain what is included and how to use it. The package contains Docker Compose files for the lab services, sample Python and FastAPI applications, configuration templates, policy files for OpenBao, example Kubernetes manifests, CI/CD workflow samples, and test data that uses only fake, safe credentials. A README in each folder explains its purpose and how it connects to the course sections.
You will learn how to download and extract the package, where to place it on your computer, and how to keep a clean working directory. We recommend copying starter files before editing them so you can always return to the original version. We also explain naming conventions used across the labs, so you can quickly find the files for a given lab number.
We cover good habits for working with secrets in a lab: never commit real credentials to a repository, use dedicated test accounts, keep your lab isolated from production systems, and reset the environment after experiments.
Finally, we show how to check your progress, troubleshoot problems with containers and ports, and ask questions. By the end of this lecture you will know where every resource lives and be ready to follow the labs with confidence.
Why do so many organizations lose track of their machine identities? This lecture explores the causes and the real-world consequences of poor visibility.
We begin with how identities multiply. A developer creates a service account for a quick test, a team adds an API key for a new integration, a pipeline receives a token for deployment, and a vendor is granted access for a project. Each action is reasonable on its own, but few organizations record who created the identity, what it is for, or when it should be removed.
Next, we look at the structural reasons. Machine identities are spread across many systems, including cloud platforms, directories, databases, SaaS tools, and code repositories, and no single team owns them all. Staff change roles or leave, projects end, and the credentials remain active. Because the identities are not tied to a person, standard leaver processes do not remove them.
We discuss the consequences: orphaned accounts that nobody dares to delete, over-privileged credentials, duplicate keys, compliance gaps, and difficulty responding to incidents because nobody knows what a leaked key can access.
We finish by introducing the solution path: discovery, inventory, ownership, and lifecycle management. By the end of this lecture you will be able to explain why visibility is the first step in any non-human identity security program and what a good inventory should achieve.
You cannot secure what you have not found. This lecture shows practical methods for discovering service accounts and API credentials across a typical environment.
We begin with the main places to look. In directories and operating systems, you can list accounts that do not belong to people, using naming patterns, account types, and login behavior. In cloud platforms, you can enumerate roles, service accounts, access keys, and managed identities through the provider's own tools and APIs. In databases, you can review users that applications use. In Kubernetes, you can list service accounts and their bindings.
Next, we cover credentials in code and configuration. Source repositories, configuration files, container images, and build logs often contain API keys and tokens. Scanning tools can help find them, which we explore in depth later in the course. We also discuss reviewing SaaS integrations, OAuth applications, and webhooks.
We introduce the idea of combining sources. Authentication logs show which identities are actually active, while configuration data shows which exist. Differences between the two reveal unused or unknown accounts.
You will also learn how to record findings consistently, including identity name, type, location, creation date, last use, and permissions. By the end of this lecture you will have a repeatable discovery approach that you can apply to any environment you are authorized to assess.
Knowing that an identity exists is not enough. You must understand what it is used for. This lecture explains how to map machine identities to the applications and infrastructure that depend on them.
We start with the questions a good map answers. Which application uses this credential? Which environment does it run in? Which systems and data can it reach? Which teams depend on it? What would break if it were disabled? Without these answers, nobody can safely change or remove a credential.
You will learn techniques for building the map. Review application configuration and deployment manifests to see which secrets they reference. Examine infrastructure as code to find service accounts and roles. Use authentication logs to see which systems an identity contacts and how often. Interview application owners to confirm findings and capture business context.
We also introduce the concept of a dependency graph, which shows relationships between identities, applications, secrets, and resources. Such a graph reveals shared credentials used by many services, which are especially risky because one leak affects all of them.
Finally, we discuss classifying identities by environment and criticality, so that production credentials with access to sensitive data receive the highest attention. By the end of this lecture you will be able to connect identities to the systems they serve and prioritize protection effectively.
An identity without an owner is a liability. This lecture focuses on three attributes that every machine identity should have recorded: ownership, permissions, and credential expiration.
We begin with ownership. Each identity needs a responsible team or person who can answer questions, approve changes, and rotate or retire the credential. We discuss how to assign owners, what to do when the original owner leaves, and why a team alias is usually better than an individual.
Next, we examine permissions. You will learn how to list the roles, scopes, and policies attached to an identity and compare them with what the application really needs. We introduce the idea of permission drift, in which access grows over time as features are added but is never reduced. We discuss how to spot overly broad permissions, such as administrative rights or wildcard access.
Then we cover credential expiration. Long-lived or non-expiring credentials increase the window of opportunity for attackers. You will learn how to find creation and last-rotation dates, identify credentials that are overdue for rotation, and prefer short-lived alternatives wherever possible.
We finish by showing how to score these attributes so that the riskiest identities rise to the top. By the end of this lecture you will be able to evaluate an identity's ownership, access, and lifetime and recommend improvements.
Good security treats machine identities as having a full lifecycle, from creation to retirement. This lecture shows how to design a lifecycle for non-human identities that is practical and enforceable.
We begin with the stages. Request and approval establish why an identity is needed and who owns it. Creation follows standard templates that apply naming conventions, default least-privilege permissions, and required metadata. Issuance delivers credentials through a secure channel rather than email or chat. Use is monitored, rotation happens on a schedule or automatically, and periodic review confirms that the identity is still needed. Finally, retirement disables and removes the identity and its credentials when the application or project ends.
You will learn how to automate each stage with infrastructure as code, pipelines, and secrets management tools, so that processes are consistent and do not rely on memory. We discuss integrating the lifecycle with application deployment, so that identities are created together with the service and removed with it.
We also cover policies such as maximum credential age, required owners, review frequency, and handling of emergency access. We introduce metrics for lifecycle health, such as the percentage of identities with owners and the number past their review date.
By the end of this lecture you will be able to draft a lifecycle model that reduces risk and administrative effort.
In this hands-on lab you will create a machine identity inventory for your lab environment, practicing the discovery and documentation skills covered in this section.
Begin by listing the identities that already exist in your lab. Use database commands to list application users, inspect the sample applications' configuration to find API keys and service credentials, and review container and Compose settings for environment variables that reference secrets. All of the credentials in the lab are fake and local.
Next, create an inventory file in a spreadsheet or structured format such as CSV or JSON. For each identity, record its name, type, location, purpose, owning application, environment, creation date, last use, permissions, credential type, and expiration or rotation status. Where information is missing, mark it as unknown, because unknowns are findings in themselves.
Then analyze the inventory. Identify identities with no clear owner, credentials with no expiration, accounts with broad privileges, and secrets shared by several applications. Assign each a simple risk rating of low, medium, or high, with a short justification.
Finally, write recommendations: which identities to remove, which permissions to reduce, which credentials to rotate, and which owners to assign. Keep your inventory, because later labs reference it and improve it, and a well-kept inventory is one of the most valuable assets in any identity security program.
The OWASP Non-Human Identity Top 10 is a community-driven list of the most common risks affecting machine identities, and this lecture introduces it as a framework for organizing your defenses.
We begin with why a dedicated list is useful. General application security guidance often focuses on users and web flaws, while machine identity problems such as leaked keys, stale accounts, and excessive privileges are treated as side issues. A focused framework gives teams a shared language and a priority order.
We walk through the categories at a high level. They include improper offboarding of identities, secret leakage, vulnerable third-party non-human identities, insecure authentication, overprivileged identities, insecure cloud deployment configurations, long-lived secrets, environment isolation failures, non-human identity reuse, and human use of non-human identities. For each risk, we explain what it means, why it happens, and the kind of damage it can cause.
We also connect each risk to the defensive controls you will learn later in the course, such as inventory, scanning, least privilege, rotation, workload identity, and monitoring. This mapping helps you see how the sections fit together.
Finally, we discuss how to use the list for assessments, audits, and communication with leadership. By the end of this lecture you will be able to describe each risk category and use it to structure a review.
Few problems are as common as credentials that end up where they should not be. This lecture explains how exposed API keys and hardcoded credentials arise and why they are so dangerous.
We start with the habits that cause exposure. Developers place keys directly in source code for convenience, commit configuration files that contain passwords, paste tokens into scripts, or share credentials in chat and tickets. Once a secret enters a repository, it remains in the history even if later removed, and public repositories can be scanned by anyone within minutes.
Next, we look at other leak locations: container images that bake in secrets, build logs that print them, client-side code and mobile apps that embed keys, backups, and documentation. We discuss how automated tools constantly search public sources for exposed credentials, which means that exposure is often discovered by others before the owner.
We then examine the impact. An exposed key may allow data access, resource creation that leads to unexpected cost, or a foothold for further attacks, depending on its permissions.
Finally, we introduce defensive habits: keep secrets out of code, use secrets managers, scan repositories continuously, and rotate anything that has been exposed. By the end of this lecture you will understand why hardcoding secrets is a serious risk and how to prevent it in your own projects.
Stolen tokens and replayed credentials are a leading way for attackers to impersonate machines. This lecture explains how these attacks work conceptually and how defenders can reduce the risk.
We begin with the nature of bearer credentials. A token or session key is a proof that the holder is allowed to act. If someone copies it, the service often cannot tell the difference between the legitimate application and an impostor, because possession is the only test. This is called credential replay.
We discuss how tokens are typically exposed: logs and error messages, insecure storage on disk or in memory, compromised build systems, overly broad access to configuration, and network interception when encryption is missing. In cloud and Kubernetes environments, tokens that are available to a workload may be reachable by anything that runs in the same place, which makes isolation and permissions important.
The focus then turns to defense. Short token lifetimes limit how long a stolen credential works. Binding tokens to a workload, certificate, or network location makes replay harder. Strong audience and scope checks prevent a token for one service from working on another. Encryption in transit, careful logging, and monitoring for unusual use all help.
By the end of this lecture you will understand how stolen tokens are abused and which controls reduce both the likelihood and the impact.
Many incidents are made worse not by the initial compromise but by how much access the compromised identity has. This lecture examines excessive permissions and privilege escalation in machine identity environments.
We start with how excess permissions appear. Teams grant broad access to make something work quickly, use administrator roles for convenience, copy permissions from another service, or add rights for a feature and forget to remove them later. Over time, identities collect access that no longer matches their purpose.
Next, we explain privilege escalation. A low-privilege identity may be able to change its own permissions, create new credentials, modify roles, deploy code that runs with higher rights, or read secrets that belong to more powerful accounts. Attackers look for these paths, which is why permission to manage identities is among the most sensitive rights in any system.
We discuss how defenders identify risky patterns: wildcard permissions, administrative roles on application accounts, ability to create or attach policies, access to secrets stores, and shared identities across environments.
Then we cover remedies: least-privilege policies, regular access reviews, separation between environments, approval workflows for sensitive rights, and monitoring of permission changes. By the end of this lecture you will be able to recognize risky permission patterns and explain how to reduce the blast radius of a compromised machine identity.
Not every risk comes from active systems. Abandoned accounts and third-party identities quietly extend your attack surface, and this lecture shows how they enable lateral movement.
We begin with abandoned accounts. When a project ends, an application is retired, or an employee leaves, the related service accounts, keys, and tokens often remain. Because they are unused, nobody notices when they are misused, and they often retain valid permissions. We discuss how to detect them by comparing creation records with recent authentication activity.
Next, we examine third-party identities. Vendors, SaaS tools, contractors, and integrations are granted access through OAuth applications, API keys, and service accounts. A weakness at the vendor can become a weakness for you, as past supply chain incidents have shown. We cover how to review the scope of access you grant, limit it, and monitor it.
Then we explain lateral movement, the process by which an attacker who obtains one credential uses it to discover and reach other systems, often by finding more credentials along the way. Shared accounts, flat networks, and broad permissions make movement easier.
We finish with defensive practices: regular cleanup, vendor access reviews, network and identity segmentation, and monitoring. By the end of this lecture you will be able to explain how forgotten and external identities create risk and how to control it.
In this hands-on lab you will perform a machine identity threat assessment on your local lab environment, applying the risk categories covered in this section.
Start with your inventory from the previous section. For each identity, review its credential type, location, permissions, owner, and lifetime. Using the OWASP Non-Human Identity Top 10 as a checklist, note which risk categories apply, such as long-lived secrets, overprivileged accounts, missing owners, or shared credentials.
Next, inspect the sample applications for exposure points. Look for hardcoded credentials in the lab source code, secrets in configuration files, verbose logging that might print tokens, and credentials shared across the development and production-style containers. Use simple searches and review techniques, and record exactly where each issue was found.
Then evaluate impact. For each finding, ask what an attacker could reach if this credential were stolen, how likely exposure is, and how quickly it would be noticed. Assign a severity rating using a simple scale and write a short description of the risk in plain language.
Finally, build a prioritized remediation plan. List the fixes you would apply first, estimate the effort for each, and map each to a control from later in the course. Save the report, because you will use it to measure improvement as you progress.
Secrets rarely leak because of sophisticated attacks. Most exposures are accidental, and this lecture maps the common places where it happens so you know where to look and what to prevent.
We begin with source control. Developers commit configuration files, test scripts, notebooks, and example code that contain real keys. Even a quick commit that is deleted minutes later remains in Git history and in any clone or fork. Public repositories are scanned by automated tools almost immediately.
Next, we look at collaboration and operations. Credentials appear in chat messages, tickets, wikis, screenshots, shared documents, and email, usually pasted for convenience during troubleshooting. Build and deployment pipelines print secrets in logs, store them in artifacts, or pass them through insecure variables. Container images may include secrets in layers, even if a later step deletes the file.
We also cover application behavior: secrets in error messages, debug output, crash dumps, analytics events, and URLs. Client-side and mobile applications that embed keys expose them to every user. Backups and snapshots may preserve old credentials long after they should have been removed.
Finally, we discuss how to reduce exposure through developer training, safe templates, secret scanning, pre-commit checks, and central secrets storage. By the end of this lecture you will be able to list the common leak locations and prioritize protections for each of them.
Source code and version history are among the most common places for credentials to hide. This lecture explains how to detect secrets in code and in Git history, and why history matters.
We begin with how scanners find secrets. Some patterns are easy to recognize because providers use distinctive prefixes and formats, such as cloud access keys or token strings. Others are generic, like passwords assigned to variables named secret or password. Scanners combine pattern matching with entropy checks, which look for random-looking strings, and with context rules such as file type and variable names.
Next, we discuss Git history. When a commit adds a secret, every later commit still contains it in the history, and removing the file in a new commit does not erase the old one. Scanning only the current files misses these historical leaks, so a thorough review examines all commits, branches, and tags. We also mention that forks and local clones keep copies.
You will learn the stages of a detection program: scanning developer workstations with pre-commit hooks, scanning pull requests, scanning the full repository history periodically, and scanning other sources such as container images and documents.
Finally, we explain how to triage results and prioritize live, high-privilege credentials. By the end of this lecture you will understand how secret detection works and where to apply it.
Gitleaks is a widely used open-source tool for finding secrets in Git repositories, and this lecture introduces how it works and how to use it in your own projects.
We start with the basics. Gitleaks scans files, directories, and Git history using a set of rules, each defined by a regular expression, optional keywords, and settings for entropy and allowed values. The built-in rule set recognizes many common credential formats, and results are reported with the file, commit, author, line number, and rule that matched.
You will learn the common ways to run it. You can scan a local repository including its full history, scan only staged changes before a commit, or scan a directory without Git. Output formats such as JSON, CSV, and SARIF make it easy to integrate with other tools and dashboards. We also show how to run Gitleaks in a container, as a pre-commit hook, and as a step in a pipeline.
We explain how to read a finding: identify the rule, check whether the value is real, and determine which system it belongs to. We highlight that scan reports themselves can contain secrets, so they must be handled carefully.
By the end of this lecture you will be able to install Gitleaks, run basic scans, and interpret the results confidently.
Any scanning program must balance catching real secrets with avoiding noise. This lecture covers false positives, custom rules, and baselines so that your scanning stays useful and trusted.
We begin with false positives. Test data, example values in documentation, hashes, identifiers, and random-looking strings can all trigger a rule. If developers see too many incorrect alerts, they begin to ignore the tool, which defeats its purpose. You will learn how to investigate a finding, decide whether it is real, and record the decision.
Next, we cover tuning options. You can add allowlists for particular files, paths, commit identifiers, or specific values, adjust entropy thresholds, and restrict rules to certain file types. We stress documenting the reason for every exception and reviewing exceptions regularly so that they do not hide genuine problems.
Then we introduce custom rules. Organizations often have internal token formats, proprietary API keys, or naming conventions. Writing a custom rule with a clear pattern and keywords lets the scanner detect them. We explain how to test rules against sample data to avoid missing matches and creating noise.
Finally, we explain baselines. A baseline records existing known findings so that new scans report only new issues, which makes adoption manageable in older repositories. By the end of this lecture you will be able to tune scanning for accuracy and sustainable use.
Finding an exposed credential is only the first step. This lecture explains how to respond properly so that the risk is actually removed and not just hidden.
The first rule is to treat any exposed secret as compromised, no matter how briefly it was visible. Removing it from the repository does not help if someone already copied it. The correct first action is to revoke or rotate the credential at its source, so that the exposed value no longer works.
We walk through a response process. Confirm what the credential is and which system issued it. Determine its permissions and what it could have accessed. Revoke and replace it, updating the applications that depend on it using a secure channel. Review logs from the exposure period for unusual activity, such as unfamiliar locations, unexpected API calls, or new resources. If misuse is suspected, escalate to your incident response process.
Next, we discuss cleanup. Remove the secret from the current code and replace it with a reference to a secrets manager. History rewriting tools can remove it from Git history, but this does not replace rotation, and it requires coordination because collaborators must update their clones.
We finish with prevention and learning: add scanning, update templates, and share lessons without blame. By the end of this lecture you will be able to respond to an exposed credential quickly and in the right order.
In this hands-on lab you will find and remediate exposed API keys in a sample repository, practicing the full detection and response cycle with fake credentials.
Begin by reviewing the lab repository, which contains several intentionally planted example secrets, including values in source files, configuration files, and earlier commits. All of them are fake and safe. Run Gitleaks against the working directory first, then against the full Git history, and compare the results. Notice which findings only appear in history.
Next, triage the results. For each finding, decide whether it is a real credential, a test value, or a false positive. Record the file, commit, rule, and your decision. Then tune the scan by adding a small allowlist for the genuine false positives and a custom rule for an internal token format used in the repository. Re-run the scan to confirm the improvement.
Now remediate. Replace the hardcoded values with references to environment variables or a placeholder for the secrets manager that you build later. Simulate rotation by generating a new fake key and updating the application configuration. Optionally, practice removing a secret from history in a disposable copy of the repository.
Finally, add a pre-commit hook and a pipeline step that run Gitleaks automatically. Write a short incident note summarizing what was found and fixed.
Service accounts power applications and automation, so securing them correctly is a foundation for everything else in this course. This lecture covers the fundamentals.
We begin with what a service account is: an account that an application, script, or service uses to authenticate to other systems and perform actions without a person present. Service accounts exist in operating systems, directories, databases, cloud platforms, and SaaS tools, and each platform has its own conventions.
Next, we explain why they are risky. They are often created with broad permissions, shared among applications, configured with passwords that never expire, excluded from multi-factor authentication, and rarely reviewed. They may also be allowed to log in interactively, which lets humans use them and blurs accountability.
You will learn core protective practices. Use one service account per application and environment so that activity and permissions are clear. Prevent interactive logins where possible. Apply strong authentication methods, preferably short-lived or certificate-based credentials rather than static passwords. Grant only the permissions required. Use consistent naming that shows purpose, owner, and environment. Record ownership and review it regularly.
We also discuss monitoring, such as alerting when a service account is used from an unexpected location or at an unusual time. By the end of this lecture you will understand how to design and run service accounts that are accountable, constrained, and observable.
Authentication and authorization are often confused, yet mixing them up leads to serious design mistakes. This lecture explains the difference and why it matters for machine identities.
Authentication answers the question, who are you? A service proves its identity by presenting a credential such as a key, token, certificate, or signed assertion. Authorization answers a different question: what are you allowed to do? After identity is established, the system checks policies, roles, or scopes to decide whether a specific action on a specific resource is permitted.
We use simple examples. A reporting service authenticates to a database with its own credential, and the database authorizes it to read one schema but not write or delete. A token may prove who the caller is, while its scopes limit what it can access.
We discuss common errors. Treating a valid credential as permission to do everything, checking authentication but forgetting authorization on individual endpoints, and trusting identity claims without validating them are frequent causes of breaches. We also explain why authentication strength and authorization narrowness are independent controls: a very strong credential with excessive permissions is still dangerous.
Finally, we introduce the principle of checking authorization at every layer, close to the resource. By the end of this lecture you will be able to distinguish the two concepts and apply each correctly when designing machine access.
Access control models define how permissions are assigned and evaluated. This lecture compares role-based and attribute-based access control and shows how each applies to machine identities.
With role-based access control, or RBAC, permissions are grouped into roles that reflect a job or function, and identities are assigned those roles. For example, a role named invoice-reader may allow reading invoice data, and any service that needs that capability receives the role. RBAC is simple, widely supported, and easy to audit, but it can lead to role explosion when many fine-grained variations are needed.
With attribute-based access control, or ABAC, decisions use attributes of the identity, the resource, the action, and the context. A policy might allow a service to read data only if its environment attribute is production, the data classification is internal, and the request comes from an approved network. ABAC is flexible and expressive, though more complex to design and test.
We discuss when to use each, and how hybrid approaches work well: roles for broad capabilities and attributes for contextual restrictions. You will see examples in Kubernetes, cloud IAM, and secrets management.
We also cover good practices: design roles around tasks, avoid assigning permissions directly to identities, and review roles regularly. By the end of this lecture you will be able to choose and apply a suitable model.
Least privilege means giving an identity only the access it needs, nothing more. This lecture explains how to design least-privilege policies in practice, which is harder than it sounds.
We begin with why it matters. A compromised identity can only do what its permissions allow, so narrower permissions mean a smaller blast radius. Yet teams often grant broad rights because writing precise policies takes effort, and a failing application is more visible than excess access.
You will learn a practical method. First, describe exactly what the application needs to do, in terms of actions and resources. Second, start with the narrowest policy that supports those actions. Third, test in a safe environment and watch for denied requests. Fourth, add only what is demonstrably required. Fifth, review access logs over time and remove permissions that are never used. Many cloud platforms offer tools that analyze activity and recommend narrower policies.
We discuss specific techniques: avoiding wildcards, restricting resources by name or path, using conditions such as environment or time, separating read and write, and keeping administrative permissions away from application identities. We also emphasize separate identities for separate environments.
Finally, we explain how to document policies and manage exceptions. By the end of this lecture you will be able to write and refine policies that are narrow, testable, and maintainable.
Service accounts need ongoing care, not just careful creation. This lecture covers ownership, access reviews, and offboarding so that machine identities remain accountable throughout their lives.
We begin with ownership. Every service account should have a named responsible team, a documented purpose, and contact details. Owners approve changes, respond to incidents, and confirm that the account is still needed. We discuss what to do when ownership is unclear, such as assigning an interim owner and escalating to management.
Next, we cover reviews. At regular intervals, owners should confirm that each identity is still in use, that its permissions match its purpose, and that its credentials are within policy. Activity data helps, since accounts with no recent authentication are candidates for removal and accounts with sudden changes deserve attention. We suggest review frequency based on risk, with production and privileged identities reviewed most often.
Then we discuss offboarding. When an application is retired or a project ends, the identity should be disabled, observed for a period to confirm that nothing breaks, and then deleted along with its credentials and group memberships. Team changes should trigger ownership transfer.
We also show how to automate reminders, reports, and expiry dates. By the end of this lecture you will be able to implement a practical process that prevents abandoned and unmanaged service accounts.
In this hands-on lab you will secure overprivileged service accounts in your lab environment, applying least privilege, ownership, and review practices.
Begin by examining the sample database and application, which use a single service account with administrative rights for everything. Document what that account can do and what damage it could cause if its credential were exposed. Then analyze what each application component truly needs, for example, one component only reads orders and another only writes audit entries.
Next, create separate service accounts for each component and environment. Write least-privilege database roles that grant only the required actions on specific tables, and avoid wildcard permissions. Update the application configuration to use the new accounts, test that normal functions work, and verify that disallowed actions, such as deleting data or reading unrelated tables, are denied.
Then add governance. Record each new account in your inventory with an owner, purpose, environment, and review date. Disable interactive login for these accounts where applicable and remove the old administrative account from the application path.
Finally, simulate an access review. Check activity logs for unused permissions, remove one that is not needed, and document the change. Write a short summary comparing the risk before and after the changes, including what an attacker could reach with each account.
Environment variables are a popular way to supply configuration to applications, and they are often described as a secure place to put secrets. This lecture explains why that belief is incomplete.
We begin with what environment variables do well. They keep secrets out of source code, are simple to use, and work in every language and platform, so they are a clear improvement over hardcoded values. They are also fine for non-sensitive configuration.
Next, we examine their weaknesses. Environment variables are visible to the process and its child processes, and they can be read by anyone with access to the process list or container inspection tools. They often appear in crash dumps, diagnostic pages, and debug output. They may be printed by logging frameworks or captured by monitoring agents. In container platforms, they are commonly stored in plain text in deployment manifests, and they are inherited by every process started by the application.
Environment variables also lack lifecycle features. There is no built-in rotation, auditing, access policy, or revocation. Changing a value usually requires restarting the application, and copies persist across systems.
We discuss better alternatives, including secrets managers that provide fetch-time access with authentication, in-memory handling, files with restricted permissions, and short-lived credentials. By the end of this lecture you will understand the limits of environment variables and when stronger approaches are warranted.
How a secret reaches an application matters as much as where it is stored. This lecture covers secure configuration and secrets injection patterns.
We begin with the goals: secrets should be delivered only to the workload that needs them, only at the moment they are needed, through an authenticated and encrypted channel, and without being written to places that outlive their usefulness.
You will learn the main injection patterns. In the pull model, the application authenticates to a secrets manager at startup or on demand and retrieves what it needs. In the push or sidecar model, an agent or init container fetches secrets and places them in memory-backed files for the application to read. In platform integrations, an orchestrator mounts secrets as volumes or uses a driver that syncs from a central store. Each pattern has tradeoffs in complexity, refresh behavior, and coupling to the application.
We discuss good configuration hygiene: separating configuration from secrets, using different values per environment, validating that required secrets are present, failing safely when they are not, and avoiding default or fallback credentials. We also cover file permissions, in-memory storage, and not copying secrets into images or build artifacts.
By the end of this lecture you will be able to select an injection approach and configure applications to receive secrets safely.
Encryption protects secrets and data from anyone who gains access to storage or the network, and this lecture explains how encryption at rest and in transit work together.
We begin with encryption in transit. When a service sends credentials or data over a network, TLS prevents others from reading or modifying it. We discuss certificates, server verification, and why disabling certificate checks to make something work defeats the protection. We also cover mutual TLS, in which both sides prove their identity, which is valuable for machine-to-machine traffic.
Next, we cover encryption at rest. Data stored on disks, in databases, in object storage, and in backups should be encrypted so that stolen media or leaked snapshots are not readable. You will learn about the layers: disk or volume encryption, database-level encryption, and application-level encryption of particular fields. We explain the role of keys and why storing the key next to the encrypted data defeats the purpose.
We introduce key management concepts such as key hierarchies, separate key custodians, rotation, and hardware-backed or managed key services. We also discuss how secrets managers encrypt stored values and protect their own master keys.
By the end of this lecture you will understand how to apply encryption sensibly, avoid common pitfalls, and combine it with access controls for defense in depth.
There is more than one way to design the storage and delivery of secrets, and this lecture compares the main architectures and helps you choose among them.
We start with the simplest pattern: secrets in configuration files or environment variables managed by deployment tooling. It is easy but offers limited control. Next, we look at encrypted files in repositories, where secrets are stored encrypted alongside code and decrypted during deployment. This improves versioning but still depends on managing the decryption keys well.
Then we cover centralized secrets managers, such as OpenBao, HashiCorp Vault, and cloud provider services. They provide strong authentication, fine-grained policies, audit logs, encryption, versioning, and in many cases dynamic secrets and automated rotation. Applications retrieve secrets at runtime, which keeps them out of code and images.
We also discuss platform-native options, such as Kubernetes secrets, and the importance of enabling encryption and tight access controls for them, as well as hybrid designs that synchronize from a central manager.
We compare the choices by security, operational effort, availability requirements, cost, and ease of adoption. A key theme is avoiding a single point of failure, so we cover high availability and recovery of the secrets service itself. By the end of this lecture you will be able to select an architecture suited to your environment and maturity.
Even well-stored secrets can leak through the side effects of normal application behavior. This lecture shows how to prevent exposure through logs, errors, and debugging.
We begin with logging. Applications frequently log requests, headers, configuration, and database connection strings. If these contain tokens, passwords, or keys, anyone with log access can obtain them, and logs are usually retained for a long time and copied to several systems. You will learn to avoid logging sensitive fields, to mask values before they are written, and to review the output of frameworks that log headers or request bodies by default.
Next, we examine error handling. Stack traces, exception messages, and debug pages can reveal connection strings, file paths, and credentials. Production systems should return generic error messages to clients while recording detailed information securely and with redaction.
We then discuss debugging practices. Debug mode, verbose flags, and diagnostic endpoints should be disabled in production. Developers must avoid pasting real credentials into tickets, chat, or screenshots when troubleshooting, and should use test credentials instead.
We also cover monitoring and analytics tools, crash reporters, and third-party services that collect data automatically. Configure scrubbing rules and restrict what they capture. By the end of this lecture you will be able to identify and close the quiet channels through which secrets are commonly disclosed.
In this hands-on lab you will secure a Python FastAPI application by removing hardcoded secrets and applying safe configuration, logging, and error handling.
Begin with the provided sample application, which connects to a database and calls an external service using credentials that are hardcoded and printed in logs. All credentials are fake lab values. Run the application and observe where the secrets appear: in the source file, in the startup log, and in error responses.
Next, refactor the configuration. Create a settings module that loads values from the environment or from mounted files, validates that required values exist, and fails safely if they do not. Remove all defaults that contain credentials. Provide an example configuration file that contains placeholders only, and update ignore rules so that real configuration files are never committed.
Then address logging and errors. Add a logging filter that masks secrets, stop logging request headers that carry tokens, and configure exception handlers that return generic messages to clients while writing safe details to logs. Turn off debug features.
Finally, test the result. Trigger errors deliberately, inspect the output for leaks, and run Gitleaks again on the project. Document the changes and note which parts will later be replaced by retrieval from OpenBao.
Centralized secrets management is the backbone of a mature machine identity program, and this lecture introduces the two platforms you will use to build it: HashiCorp Vault and OpenBao.
We begin with the problem they solve. Instead of scattering credentials across code, configuration files, and pipelines, a secrets manager provides one controlled place where secrets are stored encrypted, accessed only after authentication, authorized by policy, and recorded in an audit log. Applications request secrets when needed rather than carrying them permanently.
Next, we explain the relationship between the two tools. HashiCorp Vault is the long-established product that popularized this model. OpenBao is an open-source, community-governed fork of Vault that preserves the same core concepts, API style, and workflows, which is why skills transfer between them. In this course, you will run OpenBao locally, and nearly everything you learn applies to Vault.
You will learn the core concepts: the server and its storage backend, sealing and unsealing, tokens, authentication methods, policies, secrets engines, leases, and audit devices. We also discuss deployment considerations such as high availability, backups, and protecting the unseal keys.
By the end of this lecture you will understand what a secrets manager does, how OpenBao and Vault relate, and how the pieces fit together before you install and configure them in the following lessons.
Secrets engines are the components that store, generate, or encrypt data inside OpenBao and Vault. This lecture explains how they work and how secure storage is protected.
We begin with the basic model. A secrets engine is mounted at a path, and requests to that path are handled by the engine. The key-value engine stores arbitrary secrets and supports versioning, so that you can read earlier values and recover from mistakes. Other engines generate credentials dynamically for databases and cloud platforms, issue certificates, or perform encryption operations as a service.
Next, we look at secure storage. Everything written to the storage backend is encrypted with an encryption key, which itself is protected by a master key. When the server starts, it is sealed and cannot read data. Unsealing requires a threshold of key shares, using a scheme in which several custodians must cooperate, which prevents any single person from unlocking the system. Auto-unseal options use a trusted external key service for convenience.
We explain the importance of the audit log, which records requests and responses with sensitive values hashed. We also touch on storage backend choices, backups, and recovery planning.
By the end of this lecture you will understand secrets engines, mount paths, versioning, and the protection of data at rest in your secrets platform.
In this lecture you will install OpenBao with Docker and get a working secrets server that you can use throughout the rest of the course.
We begin with the architecture of the local setup. A single OpenBao container will run with a simple storage backend suitable for learning. We review the Docker Compose definition, including the image, exposed port, configuration file, volumes for persistent data, and capabilities required by the process. We explain the difference between development mode, which is convenient but stores data in memory and uses a fixed root token, and a standard configuration that mirrors real deployments.
Next, you will start the container, check the logs, and initialize the server. Initialization produces unseal key shares and an initial root token. We discuss how to store them for the lab and why in production they would be distributed to separate custodians and never kept together. You will unseal the server, log in, and check its status using the command-line client.
We also cover enabling an audit device and setting environment variables for the client address.
Finally, we describe common problems, such as port conflicts, permissions on mounted volumes, and a server that returns to a sealed state after restart. By the end of this lecture you will have a running OpenBao instance ready for secrets and policies.
With OpenBao running, this lecture shows how to create and retrieve secrets using both the command-line client and the HTTP API, so that you understand the interfaces that applications will use.
We start by enabling the key-value secrets engine at a path and choosing between version one and version two, with version two adding versioning and metadata. We then write a secret using the CLI, supplying key-value pairs such as a database username and a fake password, and read it back in different output formats. You will learn to list paths, update values, view previous versions, delete versions, and restore them.
Next, we use the HTTP API. Every CLI action maps to an HTTP request that includes a token header and a JSON body. You will send requests with a command-line HTTP client to write and read secrets, and see how the response includes data and metadata. Understanding the API helps when you integrate OpenBao into applications and troubleshoot issues.
We discuss good habits: using clear path conventions that reflect application and environment, avoiding secrets in shell history by reading from files or standard input, and using limited tokens instead of the root token for routine tasks.
By the end of this lecture you will be comfortable storing and retrieving secrets through the CLI and API.
This lecture shows how to integrate secrets retrieval into Python applications, replacing hardcoded or environment-based credentials with secure runtime access to OpenBao.
We begin with the design. The application should authenticate to OpenBao, request only the secrets it needs, hold them in memory, and handle failures gracefully. We discuss when to fetch secrets at startup and when to fetch them on demand, and how caching affects freshness and load.
You will learn how to use a Python client library for Vault-compatible servers. We create a client with the server address, authenticate with a token for this lesson, and read a secret from the key-value engine, extracting fields such as database credentials. Then we use those values to connect to PostgreSQL, so that the password never appears in the source code or configuration file.
We also discuss error handling: what to do when the server is unreachable, when the secret does not exist, or when permissions are denied. Applications should fail clearly and safely and should not fall back to insecure defaults. We cover retries with backoff and logging that avoids printing secret values.
Finally, we mention how this pattern fits with FastAPI, using startup events or dependencies to load configuration. By the end of this lecture you will be able to write Python code that retrieves secrets securely at runtime.
In this hands-on lab you will build a centralized secrets vault with OpenBao and connect your lab application to it, replacing scattered credentials with a single managed source.
Begin by verifying that your OpenBao container is running and unsealed. Enable the key-value version two engine at a path for the lab, and create a structure that separates applications and environments, for example paths for development, testing, and production-style secrets. Enable an audit device and confirm that requests are logged.
Next, migrate secrets from your earlier lab work. Take the fake database credentials and API keys from the FastAPI application and store them in OpenBao. Remove the values from configuration files and the application code, and run Gitleaks to confirm that nothing remains.
Then update the application to retrieve its secrets from OpenBao at startup using a Python client. Start the stack, test that the application connects to PostgreSQL, and check the audit log to see the read requests. Update a secret, create a new version, and observe how the application behaves after a restart.
Finally, practice recovery by restarting OpenBao, unsealing it, and verifying that data persists. Document the paths, versions, and commands, and note the remaining weakness that you will fix in the next section: the application still uses a broad token.
Before a secrets manager releases anything, it must know who is asking. This lecture surveys authentication methods for machines and services and how to choose among them.
We begin with the trust problem, sometimes called the secret zero problem. To get a secret, an application must first prove its identity, but proving identity usually requires a credential, which is itself a secret. The goal is to bootstrap trust in a way that avoids a long-lived password sitting on disk.
You will learn the main approaches. Static tokens are simple but dangerous if long-lived. AppRole authentication uses a role identifier and a secret identifier to provide a machine-oriented login flow with controllable lifetimes. Platform-based methods let a workload prove its identity using what the platform already knows about it: a Kubernetes service account, a cloud instance identity, or an identity token from a continuous integration system. Certificate-based authentication uses mutual TLS. OIDC and JWT methods validate signed tokens from trusted issuers.
We compare these methods by security, ease of use, and operational fit. Platform-based methods are generally preferred because they avoid distributing initial secrets. We also discuss limiting what each authenticated identity can do through policies.
By the end of this lecture you will be able to select an appropriate authentication method for different kinds of workloads.
AppRole and token authentication are two core methods in OpenBao, and this lecture explains how each works and how to use them securely.
We begin with tokens. After any successful login, OpenBao issues a token that represents the session. Tokens have policies, a time to live, and may be renewable. A root token has unlimited power and should be used only for initial setup, then revoked or protected. We discuss token types, including service tokens and batch tokens, parent and child relationships, and why creating narrow tokens for specific tasks is better than reusing one broad token.
Next, we cover AppRole, designed for applications and automation. You create a role with attached policies and token settings. The role has a role identifier, which is similar to a username and is not highly secret, and secret identifiers, which are similar to passwords and can be single-use, time-limited, and restricted by network range. A trusted delivery process, such as a deployment pipeline, provides the secret identifier to the application, which then logs in and receives a token.
We discuss good practice: short secret identifier lifetimes, limited uses, response wrapping to deliver values safely, and separate roles per application. By the end of this lecture you will be able to configure and operate AppRole and token authentication responsibly.
Policies are how OpenBao decides what an authenticated identity may do, and writing them well is one of the most important skills in secrets management. This lecture teaches you to write least-privilege secrets policies.
We begin with the structure of a policy. It is a set of path rules, each granting capabilities such as create, read, update, delete, list, and sudo on a path. Access is denied by default, so a policy only adds permissions. We explain how path matching works, including exact paths and wildcard segments, and how multiple policies combine.
You will learn design principles. Give each application a policy limited to its own path, such as a single application's secrets in a single environment. Separate read-only access from write access. Avoid broad wildcards, avoid granting sudo or access to system paths, and keep administrative policies away from application identities. For key-value version two, remember that data and metadata paths are separate, so permissions must target the correct one.
We cover testing policies by logging in as the identity and checking that allowed requests succeed and unrelated ones fail, and by using capability checks. We also discuss naming, version control for policies, and review through pull requests.
By the end of this lecture you will be able to write, test, and maintain narrow secrets policies that limit the impact of any compromised application.
Credentials should not live forever, and OpenBao provides lifetimes, leases, and revocation to enforce that. This lecture explains how token lifetimes and renewable leases work.
We begin with time to live. Every token and every dynamic secret has a TTL, after which it becomes invalid. A maximum TTL puts a hard limit on how long renewal can extend it. Short lifetimes reduce the window in which a stolen credential is useful, but they require applications to handle renewal or reauthentication.
Next, we discuss leases. When OpenBao issues a dynamic secret, it returns a lease identifier that tracks the credential. Clients can renew the lease before it expires, if allowed, or let it end. When a lease expires or is revoked, OpenBao revokes the credential in the target system. We explain periodic tokens, which can be renewed indefinitely as long as the holder keeps renewing, and orphan tokens, which are not tied to a parent.
Then we cover revocation. You can revoke a single token, a lease, or an entire prefix of leases. Revoking a parent token also revokes its children, which is useful during incident response. We discuss practice scenarios, such as revoking everything issued to a compromised application.
Finally, we cover choosing values that balance security and reliability. By the end of this lecture you will understand how to control credential lifetime and respond quickly when something goes wrong.
Development, testing, and production should never share access, and this lecture shows how to separate them in your secrets platform and policies.
We begin with why separation matters. If a test system holds production credentials, then a weaker environment with fewer controls becomes a path to your most sensitive data. Developers also need freedom to experiment without risking real customers or real systems.
You will learn several isolation strategies. Use separate path prefixes for each environment, with policies that grant access only to the matching prefix. Use separate authentication roles for each environment so that a test workload cannot log in with a production role. For stronger isolation, use separate namespaces if supported, separate OpenBao clusters, or entirely separate accounts and networks for production.
We discuss managing different values and different access levels. Production secrets should be readable only by production workloads and a small group of approved administrators, with changes tracked in the audit log. Development secrets can be broader but should still be fake or low-risk. Never copy production data or credentials into lower environments.
We also cover promotion practices, naming conventions, and review of cross-environment access. By the end of this lecture you will be able to design environment boundaries that limit blast radius and make access decisions easier to audit.
In this hands-on lab you will configure secure machine-to-vault authentication using AppRole and least-privilege policies, replacing the broad token from the previous lab.
Begin by reviewing the current situation, in which the application uses a powerful token to read secrets. Write a policy that allows read-only access to a single application's path in one environment, and a second policy for a testing environment. Test each by creating a token with the policy and confirming that allowed reads succeed and other paths are denied.
Next, enable AppRole authentication. Create a role for the application with the policy attached, a short token lifetime, and limits on the number of uses of the secret identifier. Retrieve the role identifier and generate a secret identifier, ideally with response wrapping to practice safe delivery. Update the Python application to log in using AppRole, receive a token, read its secrets, and handle token expiry by logging in again.
Then verify environment separation. Confirm that the testing role cannot read production-style paths. Review the audit log to see successful logins and denied attempts, and revoke the application's token to observe how the application reacts.
Finally, remove or revoke the broad token used earlier and the root token, and document each role, policy, and lifetime in your inventory.
Secrets come in two broad categories, static and dynamic, and understanding the difference is key to reducing risk. This lecture compares them and explains why dynamic secrets are a major security improvement.
A static secret is created once and stays valid until someone changes it. Examples are a database password, an API key, or a shared token. Static secrets are simple, but they accumulate risk over time. They are often shared across instances, copied into several places, and rarely rotated, so if one leaks, the exposure may last for months or years and be difficult to trace.
A dynamic secret is generated on demand for a specific client and valid for a limited period. When an application needs database access, the secrets manager creates a unique username and password in the database, hands them to the application, and deletes them when the lease expires. Each instance receives its own credential, so activity is traceable and a leak is limited in both time and scope.
We discuss tradeoffs. Dynamic secrets need integration with the target system, applications must handle renewal and expiry, and the secrets manager becomes a critical dependency that must be highly available. Not every system supports them, so static secrets still exist and must be rotated carefully.
By the end of this lecture you will be able to choose between static and dynamic approaches and explain the benefits.
Time to live and credential leasing are the mechanisms that make dynamic secrets safe. This lecture explains how they work and how to choose appropriate values.
We begin with the lease concept. Each dynamic credential is associated with a lease, which defines how long it is valid, whether it can be renewed, and the maximum total lifetime. The secrets manager keeps track of every lease and is responsible for revoking the credential in the target system at the end. If the application disappears, the credential still expires, which is a major advantage over static secrets.
You will learn how default and maximum TTLs are configured for each secrets engine and role, and how a client can request a shorter lifetime but not a longer one than the maximum. We explain renewal: the client asks to extend the lease before it expires, and the manager grants additional time up to the maximum. After that, the client must request a new credential.
We discuss choosing values. Very short TTLs reduce exposure but increase load on the secrets manager and demand robust application logic. Longer TTLs reduce overhead but widen the attack window. Many teams start with hours and move toward minutes as their applications mature.
We also look at monitoring lease counts and expiry behavior. By the end of this lecture you will be able to configure and reason about TTLs and leases for dynamic credentials.
Database credentials are among the most valuable secrets in any organization, and this lecture introduces dynamic database credentials as a safer approach.
We begin with the traditional pattern, in which an application uses a long-lived database account whose password is shared across servers and rarely changed. If that password leaks, an attacker can use it indefinitely, and activity cannot be tied to a specific instance.
With the database secrets engine, OpenBao connects to PostgreSQL using a privileged management account that only it knows. You define roles that describe how to create a user, including the SQL statements, the privileges to grant, and the TTL. When an application requests credentials for a role, OpenBao creates a fresh database user with a random password, returns it with a lease, and removes the user when the lease expires or is revoked.
You will learn how to configure the connection, write creation and revocation statements that grant only the needed table permissions, and set default and maximum lifetimes. We also cover protecting the management account, rotating its password through the engine, and restricting which roles each application may request.
We discuss operational points such as connection limits, monitoring created users, and handling database restarts. By the end of this lecture you will understand how dynamic database credentials work and why they greatly reduce risk.
Credentials must be refreshed and retired reliably. This lecture covers rotation, renewal, and revocation, and how they fit into a routine security process.
We begin with rotation, which means replacing a credential with a new one on a schedule or after an event. For static secrets, rotation requires coordination: generate the new value, update the target system, distribute the value to applications, and retire the old one. We discuss strategies such as dual credentials, where two valid values overlap briefly so that applications can switch without downtime, and automated rotation performed by the secrets manager or a pipeline.
Next, we cover renewal, which extends the life of an existing lease or token without changing the credential. It is useful for long-running processes but is limited by maximum lifetimes, so applications eventually need new credentials.
Then we examine revocation, the immediate invalidation of a credential. Reasons include suspected compromise, an employee or project change, or a policy violation. We show how to revoke single leases, sets of leases, and tokens, and why the speed of revocation depends on how many places the credential has been copied.
We also discuss testing rotation in advance, since untested rotation causes outages. By the end of this lecture you will be able to design and run reliable rotation and revocation procedures.
Short-lived credentials only help if applications are built to cope with them. This lecture explains how to design applications that handle credential expiration gracefully.
We begin with common failure patterns. An application reads a credential once at startup and uses it until it expires, causing sudden errors and outages. Another caches an old value after rotation. A third crashes when the secrets manager is briefly unavailable.
You will learn robust design practices. Track the lease or expiry time and renew or refresh the credential before it ends, using a safety margin. When a request fails with an authentication error, fetch a new credential and retry once, rather than failing immediately. Use connection pools that can replace credentials and recycle connections. Separate the code that obtains credentials from the code that uses them, so that refresh logic is in one place.
We also discuss resilience. Cache credentials in memory for their valid lifetime, apply retries with exponential backoff and jitter when contacting the secrets manager, and add health checks and alerts that reveal repeated failures. Avoid writing credentials to disk, and ensure that logs never include them.
Finally, we cover testing: shorten TTLs in a test environment, simulate revocation, and confirm that the application recovers. By the end of this lecture you will be able to build applications that stay reliable while using short-lived secrets.
In this hands-on lab you will generate and rotate database credentials using OpenBao's database secrets engine and update your application to handle expiring credentials.
Begin by preparing PostgreSQL with a management account that OpenBao will use, and confirm that you can connect with it. Enable the database secrets engine, configure the connection to your lab database, and define two roles: a read-only role and a read-write role. Write creation statements that grant only the required table privileges, and set a short default TTL and a maximum TTL.
Next, request credentials for each role using the command line. Observe the generated username and password, log in to PostgreSQL with them, and verify the allowed and denied actions. Check the lease information, wait for the TTL to approach, and renew one lease. Then revoke another lease and confirm that the database user is removed.
Now update your Python application to request dynamic credentials, store the lease, refresh credentials before they expire, and retry once after an authentication failure. Run the application for several lease periods and watch it rotate credentials without downtime.
Finally, rotate the management account password through OpenBao, review the audit log, and document your TTL choices. Compare this design with the static password you started with, and note the improvement.
OAuth 2.0 is the most widely used framework for delegated authorization, and this lecture explains its fundamentals from the perspective of machine-to-machine communication.
We begin with the problem OAuth solves. Instead of every service storing and sharing long-lived passwords or API keys for every other service, a central authorization server issues short-lived access tokens that clients present to APIs. The API validates the token and decides whether to allow the request.
You will learn the core roles. The resource owner is the party who owns the data, the client is the application requesting access, the authorization server authenticates the client and issues tokens, and the resource server is the API that accepts them. In machine-to-machine scenarios, there is often no human involved, and the client acts on its own behalf.
We introduce the main concepts: client identifiers and client authentication, scopes that describe the permissions requested, audiences that identify the intended API, token endpoints, and token lifetimes. We contrast the common grant types and explain why flows designed for browsers and users are not suitable for background services, while the client credentials grant is designed for exactly this case.
We also discuss benefits such as centralized policy, short lifetimes, and easier revocation, along with risks such as weak client secrets and overly broad scopes. By the end of this lecture you will understand how OAuth supports secure service authentication.
Access tokens, JSON Web Tokens, and OpenID Connect appear throughout modern API security, and this lecture explains what they are and how to read them safely.
We start with access tokens. An access token is a credential presented to an API to prove that the caller has been authorized. Some tokens are opaque strings that the API validates by asking the authorization server, a process called introspection. Others are self-contained JSON Web Tokens, or JWTs, which the API can validate locally.
A JWT has three parts: a header describing the signing algorithm and key identifier, a payload containing claims, and a signature. Common claims include the issuer, subject, audience, expiration time, issued-at time, scopes, and a unique identifier. We explain that the payload is encoded, not encrypted, so it must never contain secrets, and that the signature proves integrity but only if it is verified properly.
Next, we introduce OpenID Connect, an identity layer built on OAuth 2.0. It adds ID tokens, standard claims, and discovery documents that publish endpoints and public keys, which makes automatic validation possible.
We highlight common mistakes, such as accepting unsigned tokens, trusting the algorithm in the header blindly, and skipping expiration checks. By the end of this lecture you will be able to decode and reason about tokens and understand what must be validated.
The client credentials grant is the standard OAuth flow for service-to-service communication, and this lecture explains how it works step by step.
We begin with the scenario. A backend service needs to call another API on its own behalf, with no user present. It authenticates directly to the authorization server using its client credentials, requests a token for a specific audience and set of scopes, and receives a short-lived access token. It then calls the API with that token in the authorization header.
You will learn the exact exchange. The client sends a request to the token endpoint, including the grant type, its client identifier, its authentication, and the desired scopes. The server verifies the client, checks that it is allowed to receive the requested scopes, and returns a token with an expiry time. The client caches the token until shortly before it expires, then requests another. No refresh token is normally needed.
We discuss how to register clients with the minimum scopes, how to protect client secrets using a secrets manager, and how to choose stronger authentication methods than a shared secret, which we cover later. We also explain why each service should have its own client, so that access can be revoked and audited individually.
By the end of this lecture you will understand the flow, its security considerations, and how to implement it correctly in your own services.
A token is only as trustworthy as the checks performed on it. This lecture explains how APIs should validate tokens, scopes, audiences, and expiration correctly.
We begin with signature validation. The API must verify that the token was signed by a trusted issuer, using the public keys published by the authorization server and selected by the key identifier. It must accept only the algorithms it expects and reject tokens that are unsigned or use unexpected methods. We cover key rotation and caching of public keys.
Next, we examine the claims that must be checked. The issuer must match the expected authorization server. The audience must include this API, so that a token issued for another service is rejected, which prevents token misuse across services. The expiration and not-before times must be valid, with a small allowance for clock differences. The scopes or roles must permit the specific operation requested.
We then discuss authorization design. Check permissions on each endpoint rather than only at the gateway, apply the principle of least privilege to scopes, and avoid treating the presence of a token as sufficient permission. We also discuss token revocation options, short lifetimes, and logging validation failures without recording the tokens themselves.
By the end of this lecture you will be able to write or review validation logic and recognize common weaknesses in token handling.
Shared client secrets are convenient but weak, and this lecture shows stronger ways for machines to authenticate to an authorization server: private key JWT and mutual TLS.
We begin with the limits of client secrets. They are long-lived strings that must be stored by the client and also known to the server, so a leak from either side lets an attacker impersonate the client. They are often shared and rarely rotated.
With private key JWT authentication, the client holds a private key that never leaves its environment. To authenticate, it creates a short-lived signed assertion containing its identity, the intended audience, a unique identifier, and an expiry, and sends it to the token endpoint. The server verifies the signature using the client's registered public key. Because the server stores only a public key, a server-side leak does not allow impersonation, and assertions expire quickly.
With mutual TLS, the client presents an X.509 certificate during the TLS handshake, and the server validates it against a trusted authority. Tokens can also be bound to the certificate, so a stolen token is useless without the matching private key.
We compare both approaches in terms of security, operational effort, and key management, and discuss rotating keys and certificates. By the end of this lecture you will understand how to move beyond shared secrets for stronger machine authentication.
In this hands-on lab you will secure a machine-to-machine API using OAuth 2.0 client credentials, token validation, and stronger client authentication.
Begin by starting Keycloak from the lab package and creating a realm for the course. Register two confidential clients that represent a reporting service and an orders service, and define scopes such as orders read and orders write. Assign each client only the scopes it needs, and set short access token lifetimes.
Next, build or review a FastAPI service that exposes order endpoints. Implement token validation that fetches the public keys from the issuer, verifies the signature, and checks the issuer, audience, expiration, and scope for each endpoint. Return appropriate error codes for missing, invalid, or insufficient tokens.
Then write a client script that requests a token using the client credentials grant, caches it until shortly before expiry, and calls the API. Store the client secret in OpenBao rather than in code. Test that the reporting client can read orders but cannot write them, and that a token for a different audience is rejected.
Finally, upgrade one client to private key JWT authentication, generating a key pair, registering the public key, and signing the client assertion. Document the settings and the differences between the approaches.
This course contains the use of artificial intelligence.
Master Machine Identity Security, Secrets Management, API Protection, and AI Agent Security
Modern organizations depend on thousands of non-human identities (NHIs), including service accounts, API keys, automation bots, machine identities, cloud workloads, microservices, and AI agents. These digital identities power enterprise applications, cloud infrastructure, and automated workflows. However, poorly managed credentials, excessive permissions, and insecure authentication create significant cybersecurity risks.
Non-Human Identity Security: Secrets, Bots & API Keys is a comprehensive, hands-on cybersecurity training course designed to help you discover, protect, monitor, and govern machine identities across modern enterprise environments.
Whether you're a cybersecurity professional, DevSecOps engineer, cloud security architect, software developer, IAM specialist, or AI engineer, this course provides practical techniques for securing automated identities and implementing enterprise-grade security controls.
What Will You Learn?
You'll explore essential machine identity security concepts and develop practical skills in:
Non-Human Identity Management (NHIM): Discover, inventory, classify, and govern machine identities, service accounts, and automation credentials.
Secrets Management: Secure API keys, passwords, tokens, certificates, and application secrets using OpenBao and HashiCorp Vault.
API Security: Implement OAuth 2.0, OpenID Connect (OIDC), JSON Web Tokens (JWT), and machine-to-machine authentication.
Credential Security: Automate secret rotation, credential expiration, token renewal, and access revocation.
Cloud Identity Security: Explore AWS IAM, Azure Managed Identities, Google Cloud IAM, and workload identity federation.
Kubernetes Security: Protect Kubernetes service accounts, implement Role-Based Access Control (RBAC), and secure containerized workloads.
DevSecOps Security: Integrate Gitleaks, GitHub Actions security, secret scanning, and CI/CD pipeline hardening.
Zero Trust Security: Apply least-privilege access, workload authentication, certificate security, and SPIFFE/SPIRE identity standards.
AI Agent Security: Secure autonomous AI agents, Model Context Protocol (MCP) servers, automation bots, and agent-to-tool authentication.
Identity Threat Detection: Identify compromised credentials, excessive permissions, unauthorized API access, and suspicious machine activity.
Learn Through Hands-On Cybersecurity Labs
This course emphasizes practical implementation rather than theory alone.
You'll build secure applications using Python, FastAPI, Docker, PostgreSQL, Kubernetes, Keycloak, and OpenBao. Through guided security labs, you'll investigate exposed secrets, configure authentication policies, implement dynamic credentials, secure APIs, and automate security testing.
You'll also explore OWASP Non-Human Identity Top 10 risks, Identity and Access Management (IAM) best practices, Privileged Access Management (PAM) principles, and enterprise security governance.
Build an Enterprise Security Capstone Project
Your final project brings everything together. You'll design a Non-Human Identity Security Platform that integrates centralized secrets management, secure machine authentication, least-privilege authorization, credential rotation, workload identity protection, and security monitoring.
This portfolio-ready project demonstrates practical approaches to protecting modern applications and automated enterprise environments.
Who Should Enroll?
This course is ideal for professionals interested in cybersecurity, cloud security, API security, DevSecOps, identity security, Kubernetes security, Zero Trust Architecture, secrets management, and AI security engineering.
No prior experience with specialized machine identity security tools is required.
Start building the skills to secure the invisible identities powering today's cloud applications, automation platforms, and AI-driven enterprises.