All Projects → Snawoot → Linux Secureboot Kit

Snawoot / Linux Secureboot Kit

Licence: mit
Tool for complete hardening of Linux boot chain with UEFI Secure Boot

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Linux Secureboot Kit

Content
Security automation content in SCAP, OSCAL, Bash, Ansible, and other formats
Stars: ✭ 1,219 (+2157.41%)
Mutual labels:  security-tools, security-automation, security-hardening
Hardening
Hardening Ubuntu. Systemd edition.
Stars: ✭ 705 (+1205.56%)
Mutual labels:  security-tools, security-automation, security-hardening
Vuls
Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices
Stars: ✭ 8,844 (+16277.78%)
Mutual labels:  security-tools, security-automation, security-hardening
Ansible Lockdown
Ansible playbook roles for security
Stars: ✭ 424 (+685.19%)
Mutual labels:  security-automation, security-hardening
Fwanalyzer
a tool to analyze filesystem images for security
Stars: ✭ 382 (+607.41%)
Mutual labels:  security-tools, security-automation
Huskyci
Performing security tests inside your CI
Stars: ✭ 398 (+637.04%)
Mutual labels:  security-tools, security-automation
Super
Secure, Unified, Powerful and Extensible Rust Android Analyzer
Stars: ✭ 340 (+529.63%)
Mutual labels:  security-tools, security-automation
Yasuo
A ruby script that scans for vulnerable & exploitable 3rd-party web applications on a network
Stars: ✭ 517 (+857.41%)
Mutual labels:  security-tools, security-automation
Burpa
Burp-Automator: A Burp Suite Automation Tool with Slack Integration. It can be used with Jenkins and Selenium to automate Dynamic Application Security Testing (DAST).
Stars: ✭ 427 (+690.74%)
Mutual labels:  security-tools, security-automation
Monkey
Infection Monkey - An automated pentest tool
Stars: ✭ 5,572 (+10218.52%)
Mutual labels:  security-tools, security-automation
Awesome Security Hardening
A collection of awesome security hardening guides, tools and other resources
Stars: ✭ 630 (+1066.67%)
Mutual labels:  security-tools, security-hardening
Marsnake
System Optimizer and Monitoring, Security Auditing, Vulnerability scanner for Linux, macOS, and UNIX-based systems
Stars: ✭ 16 (-70.37%)
Mutual labels:  security-tools, security-hardening
W5
Security Orchestration, Automation and Response (SOAR) Platform. 安全编排与自动化响应平台,无需编写代码的安全自动化,使用 SOAR 可以让团队工作更加高效
Stars: ✭ 367 (+579.63%)
Mutual labels:  security-tools, security-automation
Patrowlmanager
PatrOwl - Open Source, Smart and Scalable Security Operations Orchestration Platform
Stars: ✭ 363 (+572.22%)
Mutual labels:  security-tools, security-automation
Xss Listener
🕷️ XSS Listener is a penetration tool for easy to steal data with various XSS.
Stars: ✭ 414 (+666.67%)
Mutual labels:  security-tools, security-hardening
Taipan
Web application vulnerability scanner
Stars: ✭ 359 (+564.81%)
Mutual labels:  security-tools, security-automation
Gosec
Golang security checker
Stars: ✭ 5,694 (+10444.44%)
Mutual labels:  security-tools, security-automation
Golang Tls
Simple Golang HTTPS/TLS Examples
Stars: ✭ 857 (+1487.04%)
Mutual labels:  security-tools, security-hardening
Prowler
Prowler is a security tool to perform AWS security best practices assessments, audits, incident response, continuous monitoring, hardening and forensics readiness. It contains more than 200 controls covering CIS, ISO27001, GDPR, HIPAA, SOC2, ENS and other security frameworks.
Stars: ✭ 4,561 (+8346.3%)
Mutual labels:  security-tools, security-hardening
Shodansploit
🔎 shodansploit > v1.3.0
Stars: ✭ 342 (+533.33%)
Mutual labels:  security-tools, security-automation

linux-secureboot-kit

Tool for complete hardening of Linux boot chain with UEFI Secure Boot. Inspired by Hanno Heinrichs and Florent Hochwelker blog post.


❤️ ❤️ ❤️

You can say thanks to the author by donations to these wallets:

  • ETH: 0xB71250010e8beC90C5f9ddF408251eBA9dD7320e
  • BTC:
    • Legacy: 1N89PRvG1CSsUk9sxKwBwudN6TjTPQ1N8a
    • Segwit: bc1qc0hcyxc000qf0ketv4r44ld7dlgmmu73rtlntw

Why?

Even if your hard disk is encrypted with full disk encryption, your bootloader config or initramdrive may be spoofed while you left your computer unattended. And this way your encryption key may be silently extracted when you unlock your system next time.

What does it do?

This kit establishes following signature verification chain: UEFI Secure Boot -> Custom GRUB2 Image with your embedded verification keys -> Signed kernel, initramrs, grub config.

Features

  • Risk-free deployment. Old bootloader is retained after installation and it is possible to fallback to it at any time. If something went wrong just disable Secure Boot and choose original bootloader in your boot menu.
  • No foreign code can be run on such protected machine, including live system images signed with vendor certificates.
  • Support for automatic signature of DKMS-built modules.
  • No MOK key enrollment required.

How to use it?

Here is step by step guide:

Step 1. Satisfy requirements

  1. x64 UEFI-enabled Linux installation with GRUB2 bootloader
  2. GRUB2 config without blscfg directives (they will fail boot since all files will have to be signed). Where applicable it is disabled automatically upon installation via GRUB_ENABLE_BLSCFG="false" variable in /etc/default/grub
  3. GRUB2 tools and modules (grub2-efi-x64-modules and grub2-tools packages on RPM-based distros, Debian-based provides them by default)
  4. sbsigntools (sbsigntool) 0.6+ (https://git.kernel.org/pub/scm/linux/kernel/git/jejb/sbsigntools.git/). If it is absent in your distro or too old, you have two options:
    • Use static build. HEAD commit of this gist can be verified with my PGP public key. See install instructions in gist comment.
    • Build it yourself. You'll need:
      1. @development-tools (build-essential)
      2. openssl-devel (libssl-dev)
      3. libuuid-devel (uuid-dev)
      4. binutils-devel (binutils-dev)
  5. efitools 1.9.2+ (https://git.kernel.org/pub/scm/linux/kernel/git/jejb/efitools.git). If it is absent in your distro or too old, you have two options:
    • Use static build. HEAD commit of this gist can be verified with my PGP public key. See install instructions in gist comment.
    • Build it yourself. You'll need:
      1. @development-tools (build-essential)
      2. openssl-devel (libssl-dev)
      3. gnu-efi-devel (gnu-efi)
      4. perl-File-Slurp (libfile-slurp-perl)
      5. help2man

Fedora 30 hint

If you are building efitools on Fedora you'll need this build script to workaroud library paths issue.

Step 2. Backup current UEFI keys

make backup

Step 3. Clear your current UEFI keys (putting platform into Setup Mode)

Usually, it can be done via BIOS Setup Menu.

When done, verify it. efi-readvar output should look like this:

# efi-readvar
Variable PK has no entries
Variable KEK has no entries
Variable db has no entries
Variable dbx has no entries
Variable MokList has no entries

Step 4. Build keys, certificates, signed grub2 image and password hash for grub2 root user

sudo make

Root access is required for proper embedded boot config generation. You will be asked for GRUB password during build process.

Step 5. Install UEFI keys, bootloader and boot GPG signing keys

sudo make install

Step 6. Sign all kernels, ramdrives and boot config

All new installed kernels, ramdrives and grub config has to be signed on update. Automation of this process may differ on various distros, but basicly all you have to do is generate detached signature with gpg like this:

FILE=/boot/vmlinuz-5.0.13-300.fc30.x86_64
gpg2 --quiet --no-permission-warning \
    --homedir /var/lib/secureboot/gpg-home \
    --detach-sign \
    --default-key "[email protected]" < "$FILE" > "$FILE.sig"

For some distros we already have such installable automation.

Fedora 30

sudo make fedora30-install

Debian 9, Debian 10

sudo make debian9-install

Ubuntu

sudo make ubuntu-install

Centos 7

sudo make centos7-install

Actually, you may just run single command with final target for your system and make will figure out which actions are pending. But step-by-step process is more explicit and easier to troubleshoot.

Step 7. Lockdown your system

Ensure Secure Boot is enabled in your BIOS settings and administrator password is set. Set 'SignedBoot' UEFI boot entry as your first boot option.

Notes

DKMS and custom modules

Linux kernel in some distrubutions requires all modules to be signed with trusted signature when Secure Boot is enabled. Some distros (like Ubuntu) even offer mechanism for signing DKMS modules after build with enrolled MOK keys. Since we already own all platform keys, we don't need to enroll additional MOK keys into UEFI - we can sign modules with db keys instead. linux-secureboot-kit sets own hooks in order to supress signature with MOK keys and put it's own. Such hook chained after original DKMS source hooks via override file in /etc/dkms. Symlinks to override file created for every installed DKMS package upon linux-secureboot-kit setup. If you will install some new DKMS after linux-secureboot-kit setup, you have to create such symlink like this:

ln -s /var/lib/secureboot/dkms/chain-sign-hook.conf /etc/dkms/<package_name>.conf

or just re-run setup_dkms.sh script from this source directory. It'll add missing symlinks and initiate rebuild of unsigned modules.

If you are building modules manually, you may sign them with /var/lib/secureboot/efi-keys/db.key and /var/lib/secureboot/efi-keys/db.der using tool like kmodsign in Ubuntu or scripts/sign_file from kernel source directory (see this issue for example).

See Also

  • mortar - all-up solution which intergrates together TPM, SecureBoot (with metered boot) and LUKS
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].