Commit Graph

220 Commits

Author SHA1 Message Date
Morten Linderud bedb8e8c83
main: fixed typo
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-09-05 15:33:17 +02:00
Morten Linderud 73be015150
list-*: Fixup linting
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-09-05 15:33:06 +02:00
Morten Linderud 9ff60964d5
list-*: Ensure we list all entries on error
Return some formatted string and return nil instead of aborting the
entire listing when we encounter an error.

Fixes: https://github.com/Foxboron/sbctl/issues/88

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-09-05 14:54:45 +02:00
Morten Linderud 947b6ba8e8
Formating: Added some misc formatting
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-09-05 14:42:31 +02:00
Morten Linderud 69e52d3efb
Makefile: Add completions
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-09-05 14:41:59 +02:00
Morten Linderud 66d1482dd9
go.sum: Forgot a /x/text dependency?
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-07-22 21:12:29 +02:00
Morten Linderud 05b4f88539
go.mod: Update go-uefi to latest master
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-07-22 21:11:19 +02:00
Morten Linderud 858e129c2d
Merge commit 'refs/pull/77/head' of github.com:Foxboron/sbctl 2021-07-22 21:10:42 +02:00
Morten Linderud dc88c5c93d
Merge commit 'refs/pull/81/head' of github.com:Foxboron/sbctl 2021-07-22 21:10:30 +02:00
Morten Linderud 868b0a9547
Merge commit 'refs/pull/83/head' of github.com:Foxboron/sbctl 2021-07-22 21:09:32 +02:00
Oskar Kohout ea325ca46f fix: restrict key file permissions 2021-07-16 18:32:47 +02:00
Hugo Osvaldo Barrera 1aca349c90 Attempt to trigger automounts to find the ESP
The ESP may be an automount partition, so try touching a file in each
candidate location so as to trigger an automounts.

This is the same way systemd attempts to find it:
https://github.com/systemd/systemd/blob/f565b86/src/shared/bootspec.c#L1014-L1018

I've also changed the function to return an error if no ESP is found.
The previous behaviour (an empty string) just results in a crash later
on.

When no ESP is found, the `bundle` command will have no default for the
`esp` flag. Passing an empty string to it as a default results in no
value being show in the output of `--help`.

This seemed like the most reasonable compromise instead of panicking.

Fixes #78
2021-06-28 20:37:56 +02:00
Morten Linderud 78cdabfa6d
sbctl/sign: the -o option would fail on non-existing output file
A few options where mixes around during the refactor. We also need to
capture the off case of failing signature verification on the output
file when it doesn't exist.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-28 12:34:19 +02:00
Morten Linderud 1614cfbd2e
logging: Rename to SBCTL_UNICODE, add manpage
Copypaste error from POC code landed in the released version. Also added
a quick note to the man page about the switch.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-19 22:58:57 +02:00
Morten Linderud 62fc79175f
Merge commit 'refs/pull/76/head' of github.com:Foxboron/sbctl 2021-06-19 22:57:04 +02:00
Haochen Tong a88a5b7e42
logging: use simple unicode symbols 2021-06-19 14:44:53 +08:00
Érico Nogueira 9e0ea82854 sbctl/verify: remove accidental newline
Was leading to double newlines in the "sbctl verify" output.

Signed-off-by: Érico Nogueira <erico.erc@gmail.com>
2021-06-17 00:30:17 -03:00
Morten Linderud 2b6b3f92a1
Forgot srcinfo
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-14 00:30:08 +02:00
Morten Linderud 2261630dbd
Updated sbctl-git
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-14 00:29:19 +02:00
Morten Linderud a43373ce3f
sbctl: Error looks better then Fatal
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-14 00:24:43 +02:00
Morten Linderud faf366f5e7
Merge commit 'refs/pull/75/head' of github.com:Foxboron/sbctl 2021-06-13 19:42:36 +02:00
Morten Linderud d8af3d80a1
sbctl/status: refactor to cleaner code
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-13 19:41:03 +02:00
Morten Linderud 0a0dc36030
Updated readme
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-13 19:01:08 +02:00
Morten Linderud 4ba10b9393
sbctl/remove-*: Added remove logging to the commands 2021-06-13 00:01:44 +02:00
Morten Linderud 64cbd26bb3
sbctl/sign: Added proper messages
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-12 21:38:13 +02:00
Morten Linderud 4de27722ee
Replace fmt.Println with internal logging
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-12 21:37:55 +02:00
Morten Linderud 070702abda
Removed extra print logging
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-12 21:22:09 +02:00
Hugo Osvaldo Barrera 95458395f1 Update some references to latest go-uefi
Current `master` of both branches cannot build together otherwise.
2021-06-12 01:45:54 +02:00
Morten Linderud 7c23cf35da
sign-all: don't exit if -g is used and we can't create bundles
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-05 14:36:02 +02:00
Morten Linderud 7e01fec4fa
generate-bundles: Return better error messages
Current errors doesn't really give you any details what is failing if
there is a failure. This rearranges it a little bit

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-05 14:34:54 +02:00
Morten Linderud fb79c38977
bundle: Ensure files exist before combining
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-05 14:33:28 +02:00
Morten Linderud 32ac267834
Merge branch 'morten/go-uefi' 2021-06-05 14:08:34 +02:00
Morten Linderud 5d528ff82a
Merge branch 'morten/cli' 2021-06-05 14:08:11 +02:00
Morten Linderud 240786b7d8
Idk go modules
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:03 +02:00
Morten Linderud 7192e52fa1
keys: Move from sbsigntools to go-uefi
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud 2031e3a210
keys: Removed unused functions
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud 03f9ab94d9
Removed erronous println
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud ec7dba937e
Silence ci
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud d108dbc9e0
Fixup
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud 683afec1d7
tests: Add secureboot enabled test
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud 95170e5117
tests: Fixup secureboot enrollment test
Also split out Exec, we need it in more tests

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud 9587644626
sbctl/enroll-keys: Implement support for enrolling keys with go-uefi
This enrolls the keys using go-uefi. Essentially it reworks the
sbkeysync into a set of enroll commands taken from the go-uefi test
suite.

Preferably this should be more flexible e.g for key rotation.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:02 +02:00
Morten Linderud 2d65668632
sbctl: Implement check for sbctl installation
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:56:00 +02:00
Morten Linderud d04e117cbc
sbctl/create-keys: Rework output and keypath handling
In the future we might want to initialize a new set of keys. It makes
sense to pass the output directory so we can create new keys directly in
an alternative path and overwrite, e.g for key rotation.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:37 +02:00
Morten Linderud 1bf2810228
keys: Rework key creation
With go-uefi we don't need anything else then a certificate and a
keyfile. This simplifies the key creation to only care about these two
byte slices and saving them.

No signing is done here.

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:37 +02:00
Morten Linderud ac8723dacd
util: Ensure we ignore when files do not exist in efivarfs
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:37 +02:00
Morten Linderud 13bbb90c03
sbctl/enroll-keys: Refactor immutable checking
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:37 +02:00
Morten Linderud 28eee4464d
sbctl/status: Do not fail if sbctl is not initialized
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:37 +02:00
Morten Linderud 0781f6bb98
sbctl/create-keys: Move up the GUID logic
We also make a helper for creating directories in a proper way

Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:37 +02:00
Morten Linderud 091b831f0b
tests: Added buildtag
Signed-off-by: Morten Linderud <morten@linderud.pw>
2021-06-02 21:55:36 +02:00