open-power / secvarctl

Secure Variable Control Tooling
Apache License 2.0
0 stars 7 forks source link

secvarctl

Suite of tools to manipulate and generate Secure Boot variables on POWER.

The purpose of this tool is to simplify and automate the process of reading and writing secure boot keys. secvarctl allows the user to communicate, via terminal commands, with the keys efficiently. It is supporting automate process of the both host and guest secure boot keys.

                                        |-------------------|
                                        |     secvarctl     |
                                        |-------------------|
                                                 |
                                                 |
                              |-----------------------------------|
                              |                                   |
                      |----------------|                 |-----------------|
                      |  Host Backend  |                 |  Guest Backend  |
                      |----------------|                 |-----------------|
                              |                                   |
                              |                                   |
                   |--------------------|               |---------------------|
                   |       edk2         |               |    libstb-secvar    |
                   |  external backend  |               |   external backend  |
                   |--------------------|               |---------------------|

1. Host Secure Boot

Secure variables are responsible for loading the target OS/hypervisor during Secure Boot. There are currently four secure variables in the Secure Boot process:

2. Guest Secure Boot

Secure variables are responsible for loading the target OS in LPAR during Secure Boot. There are currently nine secure variables in the Secure Boot process:

Being that the key management process is rather lengthy and difficult, secvarctl was created to simplify these steps.

REQUIREMENTS:

BUILDING:

Make CMake
Default Build (openssl is cryptolib) make [build options] mkdir build && cd build && cmake [build options] ../ . && cmake --build .
Build W Mbedtls as cryptolib MBEDTLS=1 -DMBEDTLS=1
Build W OpenSSL as cryptolib OPENSSL=1 mkdir build && cd build && cmake -DOPENSSL=1 [build options] ../ . && cmake --build .
Build W GnuTLS as cryptolib GNUTLS=1 -DGNUTLS=1
Static Build By Default Static build By Default Static build
Dynamic Build DYNAMIC_LIB=1 -DDYNAMIC_LIB=1
Reduced Size Build default -DSTRIP=1
Build W Specific Mbedtls Library CFLAGS="-I<path>/include" LDFLAGS="-L<path>/library" -DCUSTOM_MBEDTLS=<path>
Build for Coverage Tests make [options] coverage -DCoverage=1
Build W Debug Symbols make DEBUG=1 default
Run unit test make check
Install make install make install_lib
Uninstall make uninstall make uninstall

USAGE:

$ secvarctl [MODE] [COMMAND]

MODEs:

-m, --mode  supports both the Guest and Host secure boot variables in two different modes and
            either `-m host` or `-m guest` are acceptable values.

COMMANDs:

    --help/--usage

    read      prints info on secure variables,
              use 'secvarctl [MODE] read --usage/help' for more information
    write     updates secure variable with new auth,
              use 'secvarctl [MODE] write --usage/help' for more information
    validate  validates format of given esl/cert/auth,
              use 'secvarctl [MODE] validate --usage/help' for more information
    verify    compares proposed variable to the current variables,
              use 'secvarctl [MODE] verify --usage/help' for more information
    generate  creates relevant files for secure variable management,
              use 'secvarctl [MODE] generate --usage/help' for more information

For Host secure variable : host usage

For Guest secure variable : guest usage

FILE/KEY GENERATION:

Further Reading

For more background knowledge on key heirarchy and the Secure Boot process : IBM Secure Boot on POWER Doc

For information on the Secure Variable sysfs : Secvar Docs

For any questions regarding secvarctl, feel free to reach out: Nick Child

License

The files located in the external/host directory are borrowed files from other packages. They retain their licenses from their respective license headers. For example, the file external/linux/.clang-format is protected under GPL-2.0 as specified by its file header and external/linux/LICENSE . All other files not in the external/host directory are protected under Apache 2.0, as specified in the LICENSE file.