• Stars
    star
    1,442
  • Rank 32,643 (Top 0.7 %)
  • Language
    Go
  • License
    MIT License
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ’» πŸ”’ πŸ”‘ Secure Boot key manager

sbctl - Secure Boot Manager

Build Status

sbctl intends to be a user-friendly secure boot key manager capable of setting up secure boot, offer key management capabilities, and keep track of files that needs to be signed in the boot chain.

It is written top-to-bottom in Golang using go-uefi for the API layer and doesn't rely on existing secure boot tooling. It also tries to sport some integration testing towards tianocore utilizing vmtest.

Features

  • User-friendly
  • Manages secure boot keys
  • Live enrollment of keys
  • Signing database to help keep track of files to sign
  • Verify ESP of files missing signatures
  • EFI stub generation
  • JSON output

Roadmap to 1.0

  • Key rotation
  • TPM support
  • Hardware token support
  • Configuration Files
  • Automatic boot chain signing using the Boot Loader Interface

Dependencies

  • util-linux (using lsblk)
  • binutils (using objcopy)
  • Go >= 1.16
  • asciidoc (only for building)

Installation

To fetch, build and install sbctl from the Github source:

$ go install github.com/foxboron/sbctl/cmd/sbctl@latest
$ $(go env GOPATH)/bin/sbctl

To install through git:

$ git clone https://github.com/foxboron/sbctl.git
$ cd sbctl
$ make
$ sbctl

Available packages

For Arch Linux:

$ pacman -S sbctl

For Alpine Linux:

$ apk add sbctl

You can find a updated list of sbctl packages on Repology.

In addition, sbctl is also available for openSUSE (experimental) & Ubuntu (unofficial). Follow the Expert Download links to find installation instructions according to your operating system.

Support and development channel

Development discussions and support happens in #sbctl on the libera.chat IRC network.

Usage

$ sbctl
Secure Boot Key Manager

Usage:
  sbctl [command]

Available Commands:
  bundle           Bundle the needed files for an EFI stub image
  create-keys      Create a set of secure boot signing keys
  enroll-keys      Enroll the current keys to EFI
  generate-bundles Generate all EFI stub bundles
  help             Help about any command
  list-bundles     List stored bundles
  list-files       List enrolled files
  remove-bundle    Remove bundle from database
  remove-file      Remove file from database
  sign             Sign a file with secure boot keys
  sign-all         Sign all enrolled files with secure boot keys
  status           Show current boot status
  verify           Find and check if files in the ESP are signed or not

Flags:
  -h, --help   help for sbctl
      --json   Output as json

Use "sbctl [command] --help" for more information about a command.

Key creation and enrollment

See example enrollment for a workflow with screenshots of real firmware setup menus.

# sbctl status
Installed:	✘ Sbctl is not installed
Setup Mode:	✘ Enabled
Secure Boot:	✘ Disabled

# sbctl create-keys
Created Owner UUID a9fbbdb7-a05f-48d5-b63a-08c5df45ee70
Creating secure boot keys...βœ”
Secure boot keys created!

# sbctl enroll-keys
Enrolling keys to EFI variables...βœ”
Enrolled keys to the EFI variables!

# sbctl status
Installed:	βœ” Sbctl is installed
Owner GUID:	a9fbbdb7-a05f-48d5-b63a-08c5df45ee70
Setup Mode:	βœ” Disabled
Secure Boot:	✘ Disabled

// Reboot!
# sbctl status
Installed:	βœ” Sbctl is installed
Owner GUID:	a9fbbdb7-a05f-48d5-b63a-08c5df45ee70
Setup Mode:	βœ” Disabled
Secure Boot:	βœ” Enabled

Signatures

# sbctl verify
Verifying file database and EFI images in /efi...
✘ /boot/vmlinuz-linux is not signed
✘ /efi/EFI/BOOT/BOOTX64.EFI is not signed
✘ /efi/EFI/BOOT/KeyTool-signed.efi is not signed
✘ /efi/EFI/Linux/linux-linux.efi is not signed
✘ /efi/EFI/arch/fwupdx64.efi is not signed
✘ /efi/EFI/systemd/systemd-bootx64.efi is not signed

# sbctl sign -s /efi/EFI/BOOT/BOOTX64.EFI
βœ” Signed /efi/EFI/BOOT/BOOTX64.EFI...

# sbctl sign -s /efi/EFI/arch/fwupdx64.efi
βœ” Signed /efi/EFI/arch/fwupdx64.efi...

# sbctl sign -s /efi/EFI/systemd/systemd-bootx64.efi
βœ” Signed /efi/EFI/systemd/systemd-bootx64.efi...

# sbctl sign -s /usr/lib/fwupd/efi/fwupdx64.efi -o /usr/lib/fwupd/efi/fwupdx64.efi.signed
βœ” Signed /usr/lib/fwupd/efi/fwupdx64.efi...

# sbctl verify
Verifying file database and EFI images in /efi...
βœ” /usr/lib/fwupd/efi/fwupdx64.efi.signed is signed
βœ” /efi/EFI/BOOT/BOOTX64.EFI is signed
βœ” /efi/EFI/arch/fwupdx64.efi is signed
βœ” /efi/EFI/systemd/systemd-bootx64.efi is signed
✘ /boot/vmlinuz-linux is not signed
✘ /efi/EFI/BOOT/KeyTool-signed.efi is not signed
✘ /efi/EFI/Linux/linux-linux.efi is not signed

# sbctl list-files
/boot/vmlinuz-linux
Signed:		✘ Not Signed

/efi/EFI/BOOT/KeyTool-signed.efi
Signed:		✘ Not Signed

/efi/EFI/Linux/linux-linux.efi
Signed:		✘ Not Signed

/efi/EFI/arch/fwupdx64.efi
Signed:		βœ” Signed

/efi/EFI/BOOT/BOOTX64.EFI
Signed:		βœ” Signed

/usr/lib/fwupd/efi/fwupdx64.efi
Signed:		βœ” Signed
Output File:	/usr/lib/fwupd/efi/fwupdx64.efi.signed

/efi/EFI/systemd/systemd-bootx64.efi
Signed:		βœ” Signed

Generate Unified Kernel Images (UKI)

Note: It is generally recommended to use the initramfs generator for this. mkinitcpio and dracut support this through their respective --uki and --uefi flags, or the ukify tool from systemd.

This feature is considered a second class citizen in sbctl.

# sbctl bundle -s -i /boot/intel-ucode.img \
      -l /usr/share/systemd/bootctl/splash-arch.bmp \
      -k /boot/vmlinuz-linux \
      -f /boot/initramfs-linux.img \
      /efi/EFI/Linux/linux-linux.efi
Wrote EFI bundle /efi/EFI/Linux/linux-linux.efi

# sbctl list-bundles
Enrolled bundles:

/efi/EFI/Linux/linux-linux.efi
	Signed:		βœ” Signed
	ESP Location:	/efi
	Output:		└─/EFI/Linux/linux-linux.efi
	EFI Stub Image:	  └─/usr/lib/systemd/boot/efi/linuxx64.efi.stub
	Splash Image:	    β”œβ”€/usr/share/systemd/bootctl/splash-arch.bmp
	Cmdline:	    β”œβ”€/etc/kernel/cmdline
	OS Release:	    β”œβ”€/usr/lib/os-release
	Kernel Image:	    β”œβ”€/boot/vmlinuz-linux
	Initramfs Image:    └─/boot/initramfs-linux.img
	Intel Microcode:      └─/boot/intel-ucode.img


# sbctl generate-bundles
Generating EFI bundles....
Wrote EFI bundle /efi/EFI/Linux/linux-linux.efi

More Repositories

1

ssh-tpm-agent

πŸ’» πŸ”‘ ssh-agent for TPMs
Go
333
star
2

go-uefi

Linux UEFI library written in pure Go.
Go
137
star
3

age-plugin-tpm

πŸ”‘ TPM 2.0 plugin for age
Go
77
star
4

ssh-tpm-ca-authority

SSH Certificate Authority with device attestation
Go
44
star
5

SublimeClojure

Sublime Text 2/3 Clojure support
25
star
6

clave

πŸ”’ Remote signing
Go
25
star
7

pacreport.d

Known ghost files for Arch Linux
Shell
22
star
8

archlinux-pkgbuilds

PKGBUILDs in the Arch Linux repositories
Shell
20
star
9

PKGBUILDS

Stuff i maintain in AUR!
Shell
18
star
10

home

New dotfiles setup.
Perl
15
star
11

iii

Sucklessless File based IRC Client
Go
13
star
12

Hype

Function annotations for Hylang!
Python
11
star
13

efi-roller

EFI signing helper
Shell
11
star
14

Archur

Arch Linux wallpaper generator
Python
10
star
15

go-tpm-keyfiles

TPM 2.0 TSS keyfile library
Go
9
star
16

devtools

Arch Linux devtools reimplementation
Go
7
star
17

tpm-stuff

TPM Shenanigans and playground
Go
7
star
18

.dotfiles

Collection of dotfiles
Vim Script
7
star
19

Frank

Info Display
HTML
6
star
20

arch-auto-build

Arch build server
Python
6
star
21

kernel.org-git-verifier

kernel.org transparency log monitor
Go
6
star
22

tpmkey-fido

Store WebAuthn/FIDO keys in TPM
Go
6
star
23

ssh-the-planet

SSH The Planet
Go
5
star
24

WatcherBot

Python
4
star
25

Bosnov

Shell
4
star
26

KonkursVarsel

JavaScript
4
star
27

Parjer

Clojure IRCBot FTW!
Clojure
4
star
28

gobits

Go
3
star
29

chromecast-utils

simple scripts for chromecast streaming
Shell
3
star
30

authenticode-fulcio

Go
3
star
31

archlinux-snippets

Vim Snippet
3
star
32

Navytrap

Golang IRC bot with plugin support
Go
2
star
33

gandictl

Gandi livedns API client
Go
2
star
34

talks

Talks 'n stuff
JavaScript
2
star
35

mdns

Get chromecast
Go
2
star
36

tillitis-blink-zig

Zig
2
star
37

Blog

πŸ“
CSS
2
star
38

TorInit

Helps you generate a torrc file.
Python
2
star
39

infoscr

Python
2
star
40

ClojureDoc-Search

Sublime Text Plugin to browse clojuredocs
Python
2
star
41

astu

πŸ’€ Borg Wrapper
Python
2
star
42

poke-uefi

πŸ₯’ for UEFI/Microsoft Authenticode
2
star
43

secureboot.dev

Shell
2
star
44

archweb-signoff-helper

Detects packages installed from testing and reports the ones you haven't signed off
Python
2
star
45

docker-simple

Virtualenv for docker hosts
Shell
1
star
46

Irssiconfig

Irssi setup with scripts and other stuff
Prolog
1
star
47

master

Python
1
star
48

wii

Go
1
star
49

trsac

JavaScript
1
star
50

pics

Python
1
star
51

master-latex

TeX
1
star
52

Foxboron

1
star
53

rofiwarrior

Python
1
star
54

infrastructure

Arch Linux infrastructure repo
Shell
1
star
55

Bombarder

Clojure AI
Clojure
1
star
56

Todo

Buffalo pluss VueJS totes WIP
Go
1
star
57

arch-security-scripts

Python
1
star
58

archlinux.no

Drink your mead and pillage in #archlinux-nordics
CSS
1
star
59

jenkins.debian.net

Shell
1
star
60

PyDayDBz

Script to help modify the DayZ database if you are hosting your own private hive server.
Python
1
star
61

tpm-stuff-tpmdirect

tpmdirect examples and playground
Go
1
star
62

swtpm_test

Library for initializing user accessible swtpm socket
Go
1
star